Find a file
2025-09-23 16:19:47 +02:00
assets feat: implemented game of life 2025-09-22 00:06:16 +02:00
src chore: minor formatting adjustment 2025-09-23 16:05:06 +02:00
vendor feat: moved clay to vendor (rather than include) 2025-09-22 20:48:45 +02:00
.gitignore feat: setup project 2025-09-22 00:06:08 +02:00
.gitmodules feat: added SDL3_ttf submodule 2025-09-22 20:48:27 +02:00
CMakeLists.txt feat: replaced premake5 with CMake to vendor SDL3 2025-09-22 21:19:47 +02:00
justfile feat: replaced premake5 with CMake to vendor SDL3 2025-09-22 21:19:47 +02:00
README.md feat: added README.md 2025-09-23 16:19:47 +02:00

Conway's Game of Life SDL3 implementation

Compiling

Remember to git submodule update --init --recursive!

Just use just

Use the justfile if you have just and bear installed:

just configure runs cmake configuration.

just build runs the cmake build and generates a compile_commands.json (assuming you have bear installed).

CMake works too, I guess

cmake -S. -Bbuild

cmake --build build

Same as always

Files

simulation.h/cpp

The Conway's Game of Life generation ticking and rendering.

thread_pool.h/cpp

Thread pool used for parallel GoL generation ticking.

application.h/cpp

UI and layout logic.

style.h/cpp

Reusable UI styling

resources.h/cpp

Font loading.

elements.h/cpp

Reusable UI elements

input.h/cpp

Handling of input events.

main.cpp:

Entrypoint, setup, and main application loop.

Prerequisites

  • Compiler capable of C++23 and C23.

  • CMake 3.21 or higher

Dependencies

SDL3

Included as git submodule at vendor/SDL3/ and dynamically linked.

SDL3_ttf

Included as git submodule at vendor/SDL3_ttf/ and dynamically linked.

Clay

Included as files in vendor/clay/clay.h; Single header library.

Clay SDL3 renderer

Included as files in vendor/renderer/ and compiled as part of the project.

Code Standards

  • Keep program structure as simple as possible. No Application class or other Java-isms. Prefer namespaces with static lifetime variables.

  • Use STL where possible. Don't reinvent the wheel.

  • K&R brackets. With notable exceptions(1)

  • camelCase for variables, PascalCase for types and functions (that's what SDL and Clay do).

  • In class member functions, always use this-> to access member variables.

  • const applies to the name to it's left, so it goes after the type, not const int x; but int const x.

  • * and & flush with the declaration name. void Function(Object const &inRef)

(1) Bracket exceptions:

  • using scoped_lock in arbitrary blocks, prefer tailed lisp brackets
void MyFunction() { // K&R here
    DoAsynchronousThings();
    { scoped_lock lock{ myMutex };
        myVariable++;
    } // not quite lisp, lisp with a tail
    DoMoreAsynchronousThings();
}