1 /************************************************************************************
2 
3 	AstroMenace
4 	Hardcore 3D space scroll-shooter with spaceship upgrade possibilities.
5 	Copyright (c) 2006-2019 Mikhail Kurinnoi, Viewizard
6 
7 
8 	AstroMenace is free software: you can redistribute it and/or modify
9 	it under the terms of the GNU General Public License as published by
10 	the Free Software Foundation, either version 3 of the License, or
11 	(at your option) any later version.
12 
13 	AstroMenace is distributed in the hope that it will be useful,
14 	but WITHOUT ANY WARRANTY; without even the implied warranty of
15 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 	GNU General Public License for more details.
17 
18 	You should have received a copy of the GNU General Public License
19 	along with AstroMenace. If not, see <https://www.gnu.org/licenses/>.
20 
21 
22 	Website: https://viewizard.com/
23 	Project: https://github.com/viewizard/astromenace
24 	E-mail: viewizard@viewizard.com
25 
26 *************************************************************************************/
27 
28 // TODO this is temporary code, should be removed on 'menu' code refactoring, since
29 //      we should separate "draw" and "action", so we should remove combuffer at all
30 
31 #ifndef COMMAND_H
32 #define COMMAND_H
33 
34 #include "core/base.h"
35 
36 // NOTE switch to nested namespace definition (namespace A::B::C { ... }) (since C++17)
37 namespace viewizard {
38 namespace astromenace {
39 
40 // commands, that should be proceeded after rendering cycle
41 enum class eCommand {
42 	DO_NOTHING,
43 	SWITCH_TO_MAIN_MENU,
44 	SWITCH_TO_TOP_SCORES,
45 	SWITCH_TO_INTERFACE,
46 	SWITCH_TO_OPTIONS,
47 	SWITCH_TO_CONFCONTROL,
48 	SWITCH_TO_OPTIONS_ADVANCED,
49 	SWITCH_TO_INFORMATION,
50 	SWITCH_TO_CREDITS,
51 	SWITCH_TO_PROFILE,
52 	SWITCH_TO_DIFFICULTY,
53 	SWITCH_TO_MISSION,
54 	SWITCH_TO_WORKSHOP,
55 	SWITCH_FROM_MENU_TO_GAME, // also used for mission restart
56 	SWITCH_FROM_GAME_TO_MISSION_MENU,
57 	SWITCH_FROM_GAME_TO_MAIN_MENU,
58 	SWITCH_FROM_GAME_TO_CREDITS
59 };
60 
61 class cCommand {
62 private:
63 	cCommand() = default;
64 	~cCommand() = default;
65 
66 	eCommand Command_{eCommand::DO_NOTHING};
67 
68 public:
69 	cCommand(cCommand const&) = delete;
70 	void operator = (cCommand const&) = delete;
71 
GetInstance()72 	static cCommand &GetInstance()
73 	{
74 		static cCommand Instance;
75 		return Instance;
76 	}
77 
78 	void Proceed();
79 	void Set(eCommand Command);
80 };
81 
82 } // astromenace namespace
83 } // viewizard namespace
84 
85 #endif // COMMAND_H
86