Posts
Search
Contact
Cookies
About
RSS

Complete Template for Raylib

Added 4 Aug 2019, 3:37 p.m. edited 18 Jun 2023, 5:55 p.m.

While there are some basic code templates included with raylib and they are of good quality, they still need integrating into whatever IDE or development system you're using, if you just want to quickly try something out this can be a needless repetitive task...

For this I have a project template that is all ready to go, with Makefile and all the resources it needs. At just over 600 bytes the Makefile is very easy to maintain, who wants an auto generated script 1000's of lines long...? What could possibly go wrong!

In order to use it, just copy and rename the whole directory, (the name of the projects directory is used for the compiled executable). Once you cd into the directory, you can simply type make (on windows assuming mingw make is in your path you'll have to add the parameter -f Makefile.win)

The Makefiles assumes that the raylib directory is in the same directory as the project (along side it not inside it!), on linux this can just as easily be a symbolic link.

The template shows a rotating torus, you might notice that it is also has lighting, this is because some (even subtle) shading will often let you see details of a model that are less easy to see with simple flat shading.

Having very quickly set this new project up (by copying and renaming a directory) you are now in a position to drop in whatever code / idea you want to test. As you need more source files you can just drop them into the src directory and they are automatically compiled into the project, similarly the include directory is in the Makefile "include path", the obj directory is just to tidy away the intermediate compilation objects.

The Makefile has the following targets :

So there you go, nice and simple and quick, grab it here.