A simple cross platform template for setting up a project with the bleeding edge raylib code. Works with C or C++.
Quickstart supports the main 3 desktop platforms:
- Windows
- Linux
- MacOS
- Download the quickstart
- Rename the folder to your game name
- Open the folder in VSCode
- Press F5 to build
- You are good to go
There are two compiler toolchains available for windows, MinGW-W64 (a free compiler using GCC), and Microsoft Visual Studio
- Double click the
build-MinGW-W64.bat
file - CD into the folder in your terminal
- run
make
- You are good to go
Make sure you have a modern version of MinGW-W64 (not mingw). The best place to get it is from the W64devkit from https://github.com/skeeto/w64devkit/releases or the version installed with the raylib installer
Make sure you have added the path
C:\raylib\w64devkit\bin
To your path environment variable so that the compiler that came with raylib can be found.
DO NOT INSTALL ANOTHER MinGW-W64 from another source such as msys2, you don't need it.
- Run
build-VisualStudio2022.bat
- double click the
.sln
file that is generated - develop your game
- you are good to go
- CD into the build folder
- run
./premake5 gmake2
- CD back to the root
- run
make
- you are good to go
- CD into the build folder
- run
./premake5.osx gmake2
- CD back to the root
- run
make
- you are good to go
The built code will be in the bin dir
The example uses a utility function from path_utils.h
that will find the resources dir and set it as the current working directory. This is very useful when starting out. If you wish to manage your own working directory you can simply remove the call to the function and the header.
Simply rename src/main.c
to src/main.cpp
and re-run the steps above and do a clean build.
Simply remove src/main.c
and replace it with your code, and re-run the steps above and do a clean build.
If you need to build for a different OpenGL version than the default (OpenGL 3.3) you can specify an OpenGL version in your premake command line. Just modify the bat file or add the following to your command line
--graphics=opengl11
--graphics=opengl21
--graphics=opengl43
--graphics=opengles2
--graphics=opengles3
Copyright (c) 2020-2024 Jeffery Myers
This software is provided "as-is", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
-
The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
-
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-
This notice may not be removed or altered from any source distribution.