Kumo

A hand-rolled game engine.

git clone https://git.sentomk.me/Kumo.git
commit 678937f448ba0ba0e781c8ad12bbd0158157c937
parent 96b935295319d940febb35ba3df30a71af085c72
Author: sentomk <mk20040924@outlook.com>
Date:   Mon, 16 Nov 2026 00:21:24 +0800

feat: add the game update and render interface

Diffstat:
Asrc/runtime/game.h | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/runtime/game.h b/src/runtime/game.h @@ -0,0 +1,29 @@ +#pragma once + +#include "core/clock.h" +#include "core/types.h" + +namespace kumo { + +struct FrameBuffer; + +/// Information about one fixed simulation update. +struct Tick { + uint64_t index; ///< Zero-based index of the update being executed. + Nanoseconds dt; ///< Fixed duration of this update. +}; + +/// Game logic driven by the engine's main loop. +/// The caller owns the game and keeps it alive while running. +class Game { + public: + virtual ~Game() = default; + + /// Advances the simulation by exactly one fixed step. + virtual void fixed_update(const Tick& tick) = 0; + + /// Draws the game without advancing the simulation. + /// alpha is the interpolation fraction in [0, 1). + virtual void render(FrameBuffer& frame, double alpha) const = 0; +}; +} // namespace kumo