Getting Started
First, please ensure that one of the following is set up for your corresponding system:
Get cerlib
Download cerlib and extract it.
That’s all!
Some knowledge of (modern) C++ is recommended. CMake knowledge is not required.
The Game
cerlib provides a Python script that generates a game template for you. After extracting cerlib, simply execute and follow the instructions:
The game template consists of:
src
: Contains the game’s source codeMain.cpp
: Implements the game
assets
: Contains the game’s asset files, such as images and soundsCMakeLists.txt
: Sets up the game project
Let’s have a look at Main.cpp
:
The Game
class represents the central game instance and is responsible for the entire game’s lifecycle.
As soon as a game instance is created, you’re able to create and load objects such as images and fonts.
The game’s tick
method has to be called continuously, and as long as it returns true
, the game counts as running.
Within the loop, you’re able to using the game’s time
property to perform game logic updates.
Finally, you can draw the game’s visuals.
Running the game
Note
You can always build the game however you please, since it’s a normal CMake project. You’re not tied to any editor or IDE. This introduction simply guides you through a path of least resistance.
You can now see the game running:
Congratulations! You got your game running.