
Lightweight 2D game framework for C++
cerlib focuses on a simple design and allows you to design your game architecture your way.
Features
Cross-Platform
Runs on multiple platforms, including Windows, macOS, Linux, Android and iOS.
Free
Permissive license with no royalties attached.
App Framework
Based on a minimal SDL3 fork, with easy-to-use input, window and event handling.
GPU-based 2D Graphics
Efficient GPU-based rendering using the platform’s native graphics API, such as OpenGL and Metal.
Math Library
From colors, to vectors, to matrices, cerlib has it.
Sprite Shading
Simple and safe shading language that transpiles to native shading languages.
Audio Library
Easy-to-use audio API, including faders and channels for playback control.
Content Management
Load common formats such as PNG, JPG, DDS, WAV, MP3, OGG, FLAC and many more.
Particle Systems
Customizable behaviors via emitters, modifiers and shapes.
Built-in Dear ImGui
Automatically available in your game. Simply #include <imgui.h>
and use it.
Graphics Debugger Support
Use RenderDoc or Xcode’s Metal Debugger for in-depth frame analysis and shader debugging.
Minimal C++ Subset
Improved containers and strings with bounds-checking and option types.
Minimal Example
#include <cerlib.hpp>
#include <cerlib/Main.hpp>
using namespace cer;
int main(int argc, char* argv[]) {
// Create the game instance.
auto game = Game("My Game");
auto window = game.window();
// Load an image.
auto img = Image("MyImage.png");
while (game.tick()) {
// Update game logic. Use 'time' as a reference point for
// how much time has passed since the last tick.
const auto time = game.time();
// Draw an animated image.
auto imgPos = (window.sizePx() - img.size()) / 2;
imgPos.x += sin(float(time.totalTime) * 2) * 100;
drawSprite(img, imgPos, white);
}
return 0;
}
What it does not provide
cerlib is not a 2D game engine and doesn’t provide any kind of visual level editor.
cerlib does not have any game scene representation or systems such as an entity-component-system.
In short, cerlib lets you define your game architecture however you desire it.
It doesn’t impose a strict model on the game’s code.
It provides every audiovisual aspect necessary to comfortably make a 2D game using a code-only approach.
Platform Support
Platform 69_d2588f-45> |
Version / Architecture 69_2dc2d3-5b> |
---|---|
Windows 69_4831b5-e8> |
≥ 8 (x64, ARM64) 69_e136b4-ef> |
Linux 69_2346fd-ad> |
Any (x64, ARM64) – RISC-V is planned 69_67fe55-64> |
Android 69_c2cfa1-cc> |
≥ 7 (All ABIs) 69_31a4bd-da> |
macOS 69_5dcea5-ce> |
≥ 13.5 (Intel, Apple Silicon) 69_796825-77> |
iOS, iPadOS, visionOS 69_d293e7-4f> |
≥ 16 (ARM64) – In Development 69_4b5623-99> |
Compiler Support
cerlib has been tested and is confirmed to work with the following compilers:
Compiler 69_ca045b-47> |
Version 69_244959-c8> |
---|---|
MSVC 69_35ef4c-b2> |
VS 2022 69_bbb70c-ee> |
Clang 69_dcf6a1-fb> |
≥ 16.0.6 (June 2023) 69_86c9af-58> |
GCC 69_f004a8-60> |
≥ 11.4 (May 2023) 69_03bc9d-74> |
Apple Clang 69_ac894d-5b> |
≥ 15 (September 2023) 69_706a4c-2f> |