|
|
||
|---|---|---|
| assets | ||
| py | ||
| src | ||
| .clang-format | ||
| .gitignore | ||
| README.md | ||
| xmake.lua | ||
Game Jam Kit
A simple framework for making small games with raylib, box2d, and LDtk.
Introduction
The framework in setup as a series of classes that manage the lifecycle of each other.
Game manages Managers and Scenes.
A Manager holds resources that are used across scenes. The resources are loaded at Game::init().
Scene manages Services and GameObjects.
Scenes also perform game logic for each level.
A Service holds resources that are used in a single scene. The resources are loaded during init and disposed when the scene is disposed.
GameObject manages Components
GameObjects also perform game logic for individual game entities.
A Component is a reusable tool for creating GameObject behavior.
Each of these pieces has lifecycle functions for init(), update(), and draw() that can be overridden when creating your own subclasses. These functions are called by the containing manager. If you do not wish for your class to be managed you shouldn't inherit from these base classes.
The managers also have larger overridable functions, init_*(), update_*(), and draw_*() that give you increased control over how the manager is used.
See engine/prefabs for prebuilt managers, services, game objects, and components.
See samples for examples on how to build a Scene.
See main.cpp for how to build a Game.
Building
This project uses xmake to build. Checkout xmake.lua for more details.
Using the xmake extension for VS Code is highly recommended.
Windows prerequisites
Install Visual Studio Community Edition, anything 2022 and over should be fine. Make sure to install the C++ packages. Install xmake.
Mac prerequisites
Install xmake:
brew install xmake
Linux prerequisites
Install xmake, cmake, opengl libs, and x11 libs:
sudo apt-get install xmake
sudo apt-get install g++
sudo apt-get install cmake
sudo apt-get install libgl1-mesa-dev
sudo apt-get install xorg-dev libx11-dev libxfixes-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
Build
xmake
Run
xmake run
Switch to debug mode
xmake config --mode debug
Then run with the VS Code debugger.
Switch to release mode
xmake config --mode release
Then run with xmake run.
Clean
xmake config --clean
Setup header includes for your editor
Option 1:
Generate compile_commands for VS Code.
xmake project -k compile_commands
This has to be every time a new file is added.
Add this line to c_cpp_properties.json by running the command C/C++: Edit Configurations (JSON) from the command pallette.
"compileCommands": "${workspaceFolder}/compile_commands.json",
Option 2:
Alternatively add the include directory for each library to your include path configs. They are located here for Windows:
C:\Users\user\AppData\Local\.xmake\packages\r\raylib\5.5\xxxxx\include
C:\Users\user\AppData\Local\.xmake\packages\b\box2d\v3.1.1\xxxxx\include
C:\Users\user\AppData\Local\.xmake\packages\l\ldtkloader\1.5.3+1\xxxxx\include
and here for Linux:
~/.xmake/packages/r/raylib/5.5/xxxxx/include
~/.xmake/packages/b/box2d/v3.1.1/xxxxx/include
~/.xmake/packages/l/ldtkloader/1.5.3+1/xxxxx/include
The specific hashes are for the different platforms, targets, and modes, selecting any of them will give you what you need.