A simple, cross-platform 2D game engine.
Find a file
2025-10-30 20:36:42 +01:00
.vscode Support for Windows platform 2023-08-13 00:06:04 +02:00
assets Offscreen rendering for sky 2025-07-23 11:40:12 +02:00
build Bump version to 1.0.5 2025-07-27 10:16:41 +02:00
src Pass VkCommandBuffer to ImageMemoryBarrier 2025-10-30 20:36:42 +01:00
.clang-format Remove OpenGL threaded rendering 2023-06-26 20:03:22 +02:00
.gitignore Update android build 2024-04-24 23:12:16 +02:00
.gn Replace the build system with gn 2023-08-03 11:32:28 +02:00
BUILD.gn Teapot 2024-03-25 20:09:49 +01:00
LICENSE Initial commit. 2020-09-08 21:08:07 +02:00
privacy.md Update. 2021-02-10 00:39:04 +01:00
README.md Update readme 2024-04-04 22:54:57 +02:00

Kaliber

A simple, cross-platform 2D game engine with OpenGL and Vulkan renderers. Supports Linux, Windows and Android platforms. This is a personal hobby project. I've published a little game on Google Play based on this engine. Full game code and assets are included in this repository.

Pre-requisites:

GN build system is required for all platforms:
https://gn.googlesource.com/gn/

Building from the command-line:

All platforms except Android:

Setup:

Generate build files for Ninja in release and debug modes.

gn gen out/release
gn gen --args='is_debug=true' out/debug

Building and running:

Build all games in release and debug modes and run "hello_world".

ninja -C out/release
ninja -C out/debug
./out/release/hello_world

You can also build a single target by passing the target name to ninja i.e. ninja -C out/debug demo

Android:

Build games in debug mode for all ABIs and install. GN will be run by Gradle so no setup is required. Valid ABI targets are Arm7, Arm8, X86, X86_64, AllArchs, ArmOnly, X86Only.

cd build/android
./gradlew :app:installHelloWorldAllArchsDebug
./gradlew :app:installDemoAllArchsDebug
./gradlew :app:installTeapotAllArchsDebug

Generate Visual Studio solution:

gn.exe gen --args="is_debug=true" --ide=vs2022 out\vs
devenv out\vs\all.sln

Build targets:

demo: 2D demo game.
hello_word: Hello world example.
teapot: 3D rendering demo with PBR material shader.

image info image info image info

Hello World example:

Shows a smoothly rotating "Hello World".

class HelloWorld final : public eng::Game {
 public:
  bool Initialize() final {
    eng::Engine::Get().SetImageSource(
        "hello_world_image",
        std::bind(&eng::Engine::Print, &eng::Engine::Get(), "Hello World",
                  /*bg_color*/ base::Vector4f(1, 1, 1, 0)));

    hello_world_.Create("hello_world_image").SetVisible(true);
    animator_.Attach(&hello_world_);
    animator_.SetRotation(base::PI2f, /*duration*/ 3,
                          std::bind(base::SmootherStep, std::placeholders::_1));
    animator_.Play(eng::Animator::kRotation, /*loop*/ true);
    return true;
  }

 private:
  eng::ImageQuad hello_world_;
  eng::Animator animator_;
};

GAME_FACTORIES{GAME_CLASS(HelloWorld)};

Third-party libraries:

glew, jsoncpp, minimp3, oboe, stb, texture-compressor, minizip, glslang, spirv-reflect, vma, vulkan-sdk, volk, imgui