Complete Template for Raylib

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

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 :

  • rlTemplate – (the name of your project) or specify no target and the app is compiled
  • clean – removes the executable and object files
  • debug – cleans the project and recompiles with the -g flag to add debug symbols
  • release – cleans and compiles the project with optimisations.
  • style – not 100% happy with the settings but it will tidy up your code.

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

Leave a Reply

Your email address will not be published. Required fields are marked *