ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
载入中...
搜索中...
未找到
Game.h
浏览该文件的文档.
1#pragma once
2#include "Core.h"
3
4namespace Shit {
16 class SHIT_API Game {
17 public:
20
21 bool init();
22 void run();
23
24 // --- 静态API ---
25 static Game& GetInstance();
26 inline static bool Init() { return GetInstance().init(); }
27 inline static void Run() { GetInstance().run(); }
28 static void Destroy();
29 static bool IsRunning() { return GetInstance().m_isRunning; }
30
31 Game(const Game&) = delete;
32 Game& operator=(const Game&) = delete;
33 Game(Game&&) = delete;
34 Game& operator=(Game&&) = delete;
35
36 private:
37 bool m_isRunning = false;
38 bool m_isInited = false;
39 };
40}
#define SHIT_API
定义 Core.h:12
Game & operator=(Game &&)=delete
void run()
启动主循环(阻塞直至窗口关闭)
Game & operator=(const Game &)=delete
Game(const Game &)=delete
static void Destroy()
反初始化,按依赖逆序清理子系统
static bool IsRunning()
主循环是否仍在运行
定义 Game.h:29
static void Run()
定义 Game.h:27
static Game & GetInstance()
static bool Init()
定义 Game.h:26
bool init()
初始化引擎所有子系统
Game(Game &&)=delete
定义 AudioPlayer.h:9