zoeesilcock/gamedev-playground
Playground for exploring ways of making game development a more pleasurable experience.
v0.2.5+3.2.18
master
master
Playground for exploring ways of making game development a more pleasurable experience.
This example is inspired by the classic game Diamonds. The objective is to clear the screen of colored blocks without hitting spiky blocks. It uses the SDL3 Renderer API to render 2D sprites based on Aseprite files.
This example uses the SDL3 GPU API to render a cube.
Both the code and the assets automatically update in-game when modified. For code this is achieved by having the entire game code inside a shared library with a thin executable that takes care of reloading the shared library when it changes. For assets the executable lets the game know when assets have changed so that it can react to that in whatever way that makes sense, in this case it simply reloads the assets without interrupting the game.
To automatically rebuild the shared library when you change the code you can leave the following command running in a separate terminal:
zig build -Dlib_only --watch
The project is built using the zig build system, use zig build -h
for a list of options or look at the build.zig
file for more details.
We build Dear ImGui from source and use Dear Bindings to generate C bindings which we then use directly from Zig. It is important to regenerate the bindings whenever updating the Dear ImGui dependency. This can be done by running the following build step:
zig build generate_imgui_bindings
This project is morphing into a simple runtime for building games and applications using SDL and Zig. It is still in active development and doesn't expose options that are required to customize the resulting executable yet. See the examples for exact details on how to integrate it into your own projects.
Building the runtime executable in a different project works by importing the dependency in the build.zig
file and using the buildExecutable
function to create the runtime executable which can then be installed using installArtifact
.