2024-08-14 19:35:12 -07:00
# Raylib-Quickstart
2024-09-27 07:41:45 -07:00
A simple cross platform template for setting up a project with the bleeding edge raylib code.
2024-09-30 20:57:20 +02:00
Works with C or C++.
2024-08-14 17:09:43 -07:00
2024-08-17 08:53:09 -07:00
## Supported Platforms
2024-11-23 23:53:41 +08:00
Quickstart supports the main 3 desktop platforms:
2024-08-17 08:53:09 -07:00
* Windows
* Linux
* MacOS
2025-01-29 12:40:10 -08:00
# Naming projects
2025-01-29 12:39:53 -08:00
Do not name your game project 'raylib', it will conflict with the raylib library.
2025-01-29 09:11:04 -08:00
2024-08-17 08:53:09 -07:00
# VSCode Users (all platforms)
2025-01-15 19:13:31 -08:00
*Note* You must have a compiler toolchain installed in addition to vscode.
2024-08-16 08:24:54 -07:00
* Download the quickstart
* Rename the folder to your game name
2024-11-23 23:53:41 +08:00
* Open the folder in VSCode
2025-01-29 12:39:17 -08:00
* Run the build task ( CTRL+SHIFT+B or F5 )
2024-11-23 23:53:41 +08:00
* You are good to go
2024-08-14 17:09:43 -07:00
# Windows Users
2024-11-18 15:48:51 -08:00
There are two compiler toolchains available for windows, MinGW-W64 (a free compiler using GCC), and Microsoft Visual Studio
2024-08-14 17:09:43 -07:00
## Using MinGW-W64
2024-11-24 00:00:41 +08:00
* Double click the `build-MinGW-W64.bat` file
2024-11-23 23:53:41 +08:00
* CD into the folder in your terminal
2024-11-24 00:00:41 +08:00
* run `make`
2024-08-17 08:53:09 -07:00
* You are good to go
2024-08-14 17:09:43 -07:00
### Note on MinGW-64 versions
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
2024-08-17 08:53:09 -07:00
or the version installed with the raylib installer
2024-11-23 23:53:41 +08:00
#### If you have installed raylib from the installer
2024-08-17 08:53:09 -07:00
Make sure you have added the path
2024-11-24 00:00:41 +08:00
`C:\raylib\w64devkit\bin`
2024-08-17 08:53:09 -07:00
2024-11-23 23:53:41 +08:00
To your path environment variable so that the compiler that came with raylib can be found.
2024-08-17 08:53:09 -07:00
2024-11-23 23:53:41 +08:00
DO NOT INSTALL ANOTHER MinGW-W64 from another source such as msys2, you don't need it.
2024-08-14 17:09:43 -07:00
## Microsoft Visual Studio
2024-11-23 23:53:41 +08:00
* Run `build-VisualStudio2022.bat`
* double click the `.sln` file that is generated
2024-08-14 19:36:33 -07:00
* develop your game
2024-11-23 23:53:41 +08:00
* you are good to go
2024-08-14 17:09:43 -07:00
2024-08-23 07:09:36 -07:00
# Linux Users
2024-08-14 19:36:33 -07:00
* CD into the build folder
2025-07-14 11:14:09 -07:00
* run `./premake5 gmake`
2024-08-14 19:36:33 -07:00
* CD back to the root
2024-11-24 00:00:41 +08:00
* run `make`
2024-08-14 19:36:33 -07:00
* you are good to go
2024-08-23 07:09:36 -07:00
# MacOS Users
* CD into the build folder
2025-07-14 11:14:09 -07:00
* run `./premake5.osx gmake`
2024-08-23 07:09:36 -07:00
* CD back to the root
2024-11-24 00:00:41 +08:00
* run `make`
2024-08-23 07:09:36 -07:00
* you are good to go
2024-08-14 19:36:33 -07:00
# Output files
The built code will be in the bin dir
2024-08-14 17:09:43 -07:00
2024-08-17 08:53:09 -07:00
# Working directories and the resources folder
2024-11-24 00:00:41 +08:00
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.
2024-08-17 08:53:09 -07:00
2024-09-20 15:56:00 -07:00
# Changing to C++
2024-11-24 00:00:41 +08:00
Simply rename `src/main.c` to `src/main.cpp` and re-run the steps above and do a clean build.
2024-09-20 15:56:00 -07:00
# Using your own code
2024-11-24 00:00:41 +08:00
Simply remove `src/main.c` and replace it with your code, and re-run the steps above and do a clean build.
2024-09-20 15:56:00 -07:00
2024-08-14 17:09:43 -07:00
# Building for other OpenGL targets
2024-11-23 23:53:41 +08:00
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
2024-08-14 17:09:43 -07:00
## For OpenGL 1.1
2024-11-24 00:00:41 +08:00
`--graphics=opengl11`
2024-08-14 17:09:43 -07:00
## For OpenGL 2.1
2024-11-24 00:00:41 +08:00
`--graphics=opengl21`
2024-08-14 17:09:43 -07:00
## For OpenGL 4.3
2024-11-24 00:00:41 +08:00
`--graphics=opengl43`
2024-08-14 17:09:43 -07:00
## For OpenGLES 2.0
2024-11-24 00:00:41 +08:00
`--graphics=opengles2`
2024-08-14 17:09:43 -07:00
## For OpenGLES 3.0
2024-11-24 00:00:41 +08:00
`--graphics=opengles3`
2024-08-14 17:09:43 -07:00
# License
2025-02-02 11:59:51 -08:00
Copyright (c) 2020-2025 Jeffery Myers
2024-08-14 17:09:43 -07:00
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:
1. 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.
2. Altered source versions must be plainly marked as such, and must not be misrepresented
as being the original software.
3. This notice may not be removed or altered from any source distribution.