ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
Toggle main menu visibility
载入中...
搜索中...
未找到
Game.h
浏览该文件的文档.
1
#pragma once
2
#include "
Core.h
"
3
4
namespace
Shit
{
16
class
SHIT_API
Game
{
17
public
:
18
Game
();
19
~Game
();
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
inline
static
void
Destroy
() {
GetInstance
().destroy(); }
29
static
bool
IsRunning
() {
return
GetInstance
().m_isRunning; }
30
inline
static
void
SetPaused
(
bool
paused) {
GetInstance
().m_isPaused = paused; }
31
inline
static
bool
IsPaused
() {
return
GetInstance
().m_isPaused; }
32
33
Game
(
const
Game
&) =
delete
;
34
Game
&
operator=
(
const
Game
&) =
delete
;
35
Game
(
Game
&&) =
delete
;
36
Game
&
operator=
(
Game
&&) =
delete
;
37
38
private
:
39
void
destroy();
40
41
bool
m_isRunning =
false
;
42
bool
m_isInited =
false
;
43
bool
m_isPaused =
false
;
44
};
45
}
Core.h
SHIT_API
#define SHIT_API
定义
Core.h:14
Shit::Game::IsPaused
static bool IsPaused()
是否处于暂停状态
定义
Game.h:31
Shit::Game::operator=
Game & operator=(Game &&)=delete
Shit::Game::run
void run()
启动主循环(阻塞直至窗口关闭)
Shit::Game::operator=
Game & operator=(const Game &)=delete
Shit::Game::Game
Game(const Game &)=delete
Shit::Game::SetPaused
static void SetPaused(bool paused)
全局暂停(冻结 Behavior/物理,UI 叠层照常)
定义
Game.h:30
Shit::Game::Destroy
static void Destroy()
反初始化,按依赖逆序清理子系统(init 部分失败时也能安全调用)
定义
Game.h:28
Shit::Game::Game
Game()
Shit::Game::IsRunning
static bool IsRunning()
主循环是否仍在运行
定义
Game.h:29
Shit::Game::Run
static void Run()
定义
Game.h:27
Shit::Game::GetInstance
static Game & GetInstance()
Shit::Game::~Game
~Game()
Shit::Game::Init
static bool Init()
定义
Game.h:26
Shit::Game::init
bool init()
初始化引擎所有子系统
Shit::Game::Game
Game(Game &&)=delete
Shit
定义
AudioPlayer.h:10
include
ShitEngine
Core
Game.h
制作者
1.17.0