ImagoEngine
A C++ 2D game engine built on a sparse-set ECS, with scenes, scheduled systems, events, and action-based input
Loading...
Searching...
No Matches
EngineControl.hpp
Go to the documentation of this file.
1
6
7
#pragma once
8
9
#include <string>
// for scene names in the switch_scene method
10
#include <optional>
// for returning values in the take request methods
11
12
namespace
Imago::Engine
13
{
20
class
EngineControl
{
21
private
:
22
23
// game needs to be a friend class so that it can read the requests
24
friend
class
Game;
25
friend
struct
EngineControlTestAccess;
//TODO: this is just for testing and should be removed in the release build
26
28
struct
SwitchRequest {
29
std::string name;
30
bool
persist;
31
};
32
33
std::optional<SwitchRequest> _pendingSwitch;
34
bool
_quitRequested =
false
;
35
40
std::optional<SwitchRequest> take_switch_request();
41
45
bool
quit_requested()
const
;
46
47
public
:
48
52
EngineControl
() =
default
;
53
54
// explicity disallow copy and move behavior
55
EngineControl
(
const
EngineControl
&) =
delete
;
56
EngineControl
& operator=(
const
EngineControl
&) =
delete
;
57
EngineControl
(
EngineControl
&&) =
delete
;
58
EngineControl
& operator=(
EngineControl
&&) =
delete
;
59
67
void
switch_scene
(
const
std::string& name,
bool
persist =
false
);
68
74
void
quit
();
75
};
76
}
Imago::Engine::EngineControl::EngineControl
EngineControl()=default
Construct a new Engine Control object.
Imago::Engine::EngineControl::quit
void quit()
Requests that the game ends. Called by the user within a system through the engine field in SceneCont...
Definition
EngineControl.cpp:38
Imago::Engine::EngineControl::switch_scene
void switch_scene(const std::string &name, bool persist=false)
Requests a switch to a registered Scene. Called by the user within a system through the engine field ...
Definition
EngineControl.cpp:11
engine
include
Imago
Engine
EngineControl.hpp
Generated by
1.15.0