Nimbin[12]?SDL & Graphics / sdl3_3d_oop_basic_game / src/core/game.hpp

sdl3_3d_oop_basic_game git · main

SDL3 3D OOP basic game (entities, systems, CMake)

sdl3 3d c++ game cmake · first commit 2026-04-19 · last commit 2026-04-19 (7 months ago) · synced 1 hour ago · upstream: git.ide3.de/chfis005/sdl3_3d_oop_basic_game

C++ 99%
git clone https://git.christianimmanuel.de/sdl-graphics/sdl3_3d_oop_basic_game.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl3_3d_oop_basic_game/archive/sdl3_3d_oop_basic_game.tar.gz
src/core/game.hpp 661 B · 38 lines raw
#pragma once

#include <SDL3/SDL.h>

#include "systems/input_system.hpp"
#include "systems/physics_system.hpp"
#include "entities/world.hpp"
#include "entities/player.hpp"

struct AppState {
    SDL_Window* window{};
    SDL_Renderer* renderer{};

    Player player{};
    PlayerInputState input{};
    Camera camera{};
    World world{};

    double accumulator{};
    double alpha{};
};

class Game {
public:
    bool init();
    void handleEvent(const SDL_Event& event);
    void update(double dt_ns);
    void render();

    AppState& state();

    void shutdown();

private:
    AppState m_state{};
    InputSystem m_input;
    PhysicsSystem m_physics;
};