Raylib – a C library for videogames
Much as I love SDL, I’m quite happy to look at alternatives and Raylib looks very good. It was inspired by Borland BGI graphics lib and by XNA framework (both of which I’ve used).
It’s written in C99 and is very cross-platform, even listing Raspberry Pi (I’m guessing they mean Raspberry Pi OS) as well as Windows, Mac, Linux, Android and HTML5. Basically any platform that supports C and OpenGL. There is a massive list of bindings for use in other programming languages.
Check out the examples page; you can try them online and each has a C source code listing so you can see how it’s done.
What I really like about RayLib is the scope of it and this is where I think it beats SDL. There’s 2D and 3D support, text support, in eight modules (core, shapes, textures, text, models, shaders, raudio and physac). It also comes with 8 free fonts but you can use your own custom fonts, pretty much the same way as I did in the Asteroids game.
I was very impressed with the text demo where a red box contains the text and if you resize it with the mouse the text is word wrapped.
The Spanish developer Ray (surname unknown) was cited today as the #1 trending C developer on GitHub and that’s a testament to the seven years that he has put into Raylib. His design philosophy with Raylib is to make programming fun and I am going to check it out. If it looks as good as I think it is, I will be switching to it for future games work. One thing that particular intrigues me is the RayGui library– an immediate mode GUI library. There are various tools that have been designed with it. and it supports these GUI controls:
Label | Button | LabelButton | ImageButton | Toggle | ToggleGroup | CheckBox ComboBox | DropdownBox | TextBox | TextBoxMulti | ValueBox | Spinner | Slider SliderBar | ProgressBar | StatusBar | ScrollBar | ScrollPanel | DummyRec | Grid