Pyrogenesis  trunk
GameSetup.h
Go to the documentation of this file.
1 /* Copyright (C) 2022 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_GAMESETUP
19 #define INCLUDED_GAMESETUP
20 
21 #include "ps/CStr.h"
22 
23 #include <vector>
24 
25 class CmdLineArgs;
26 class Paths;
27 
28 /**
29  * initialize global modules that are be needed before Init.
30  * must be called from the very beginning of main.
31  **/
32 extern void EarlyInit();
33 
34 extern void EndGame();
35 
37 {
38  // avoid setting a video mode / initializing OpenGL; assume that has
39  // already been done and everything is ready for rendering.
40  // needed by map editor because it creates its own window.
42 
43  // skip initializing the in-game GUI.
44  // needed by map editor because it uses its own GUI.
46 
47  // avoid setting display_error app hook
48  // needed by map editor because it has its own wx error display
50 
51  // initialize the mod folders from command line parameters
52  INIT_MODS = 8,
53 
54  // mount the public mod
55  // needed by the map editor as "mod" does not provide everything it needs
57 };
58 
60 {
61  // start shutdown from config down
62  // needed for loading mods as specified in the config
63  // without having to go through a full init-shutdown cycle
65 };
66 
67 extern const std::vector<CStr>& GetMods(const CmdLineArgs& args, int flags);
68 
69 /**
70  * Mounts all files of the given mods in the global VFS.
71  * Make sure to call CacheEnabledModVersions after every call to this.
72  */
73 extern void MountMods(const Paths& paths, const std::vector<CStr>& mods);
74 
75 /**
76  * Returns true if successful, false if mods changed and restart_engine was called.
77  * In the latter case the caller should call Shutdown() with SHUTDOWN_FROM_CONFIG.
78  */
79 extern bool Init(const CmdLineArgs& args, int flags);
80 extern void InitInput();
81 extern void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& installedMods = std::vector<CStr>());
82 extern bool InitNonVisual(const CmdLineArgs& args);
83 extern void Shutdown(int flags);
84 extern void CancelLoad(const CStrW& message);
85 
86 extern bool InDevelopmentCopy();
87 
88 #endif // INCLUDED_GAMESETUP
bool InDevelopmentCopy()
Definition: GameSetup.cpp:1269
Definition: GameSetup.h:41
Definition: GameSetup.h:56
void CancelLoad(const CStrW &message)
Definition: GameSetup.cpp:1254
void EarlyInit()
initialize global modules that are be needed before Init.
Definition: GameSetup.cpp:483
Definition: GameSetup.h:52
Definition: GameSetup.h:45
bool InitNonVisual(const CmdLineArgs &args)
Definition: GameSetup.cpp:719
const std::vector< CStr > & GetMods(const CmdLineArgs &args, int flags)
void Shutdown(int flags)
Definition: GameSetup.cpp:339
void InitInput()
Definition: GameSetup.cpp:228
InitFlags
Definition: GameSetup.h:36
Definition: GameSetup.h:49
Definition: CmdLineArgs.h:28
Definition: GameSetup.h:64
Wrapper class for OS paths used by the game.
Definition: Paths.h:27
bool Init(const CmdLineArgs &args, int flags)
Returns true if successful, false if mods changed and restart_engine was called.
Definition: GameSetup.cpp:525
ShutdownFlags
Definition: GameSetup.h:59
void InitGraphics(const CmdLineArgs &args, int flags, const std::vector< CStr > &installedMods=std::vector< CStr >())
Definition: GameSetup.cpp:630
void EndGame()
Definition: GameSetup.cpp:326
void MountMods(const Paths &paths, const std::vector< CStr > &mods)
Mounts all files of the given mods in the global VFS.
Definition: GameSetup.cpp:134