Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
main.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2013 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 /*
19 
20 This module drives the game when running without Atlas (our integrated
21 map editor). It receives input and OS messages via SDL and feeds them
22 into the input dispatcher, where they are passed on to the game GUI and
23 simulation.
24 It also contains main(), which either runs the above controller or
25 that of Atlas depending on commandline parameters.
26 
27 */
28 
29 // not for any PCH effort, but instead for the (common) definitions
30 // included there.
31 #define MINIMAL_PCH 2
32 #include "lib/precompiled.h"
33 
34 #include "lib/debug.h"
35 #include "lib/status.h"
36 #include "lib/secure_crt.h"
37 #include "lib/frequency_filter.h"
38 #include "lib/input.h"
39 #include "lib/ogl.h"
40 #include "lib/timer.h"
42 
43 #include "ps/ArchiveBuilder.h"
44 #include "ps/CConsole.h"
45 #include "ps/CLogger.h"
46 #include "ps/Filesystem.h"
47 #include "ps/Game.h"
48 #include "ps/Globals.h"
49 #include "ps/Hotkey.h"
50 #include "ps/Loader.h"
51 #include "ps/Profile.h"
52 #include "ps/Profiler2.h"
53 #include "ps/Pyrogenesis.h"
54 #include "ps/Replay.h"
55 #include "ps/TouchInput.h"
56 #include "ps/UserReport.h"
57 #include "ps/Util.h"
58 #include "ps/VideoMode.h"
59 #include "ps/World.h"
60 #include "ps/GameSetup/GameSetup.h"
61 #include "ps/GameSetup/Atlas.h"
62 #include "ps/GameSetup/Config.h"
64 #include "ps/GameSetup/Paths.h"
65 #include "ps/XML/Xeromyces.h"
66 #include "network/NetClient.h"
67 #include "network/NetServer.h"
68 #include "network/NetSession.h"
69 #include "graphics/Camera.h"
70 #include "graphics/GameView.h"
72 #include "gui/GUIManager.h"
73 #include "renderer/Renderer.h"
76 
77 #if OS_UNIX
78 #include <unistd.h> // geteuid
79 #endif // OS_UNIX
80 
81 extern bool g_GameRestarted;
82 
83 void kill_mainloop();
84 
85 // to avoid redundant and/or recursive resizing, we save the new
86 // size after VIDEORESIZE messages and only update the video mode
87 // once per frame.
88 // these values are the latest resize message, and reset to 0 once we've
89 // updated the video mode
90 static int g_ResizedW;
91 static int g_ResizedH;
92 
93 // main app message handler
95 {
96  switch(ev->ev.type)
97  {
98 #if SDL_VERSION_ATLEAST(2, 0, 0)
99  case SDL_WINDOWEVENT:
100  switch(ev->ev.window.event)
101  {
102  case SDL_WINDOWEVENT_ENTER:
103  RenderCursor(true);
104  break;
105  case SDL_WINDOWEVENT_LEAVE:
106  RenderCursor(false);
107  break;
108  case SDL_WINDOWEVENT_RESIZED:
109  g_ResizedW = ev->ev.window.data1;
110  g_ResizedH = ev->ev.window.data2;
111  break;
112  }
113  break;
114 #else
115  case SDL_ACTIVEEVENT:
116  if (ev->ev.active.state & SDL_APPMOUSEFOCUS)
117  {
118  // Tell renderer not to render cursor if mouse focus is lost
119  // this restores system cursor, until/if focus is regained
120  if (!ev->ev.active.gain)
121  RenderCursor(false);
122  else
123  RenderCursor(true);
124  }
125  break;
126 
127  case SDL_VIDEORESIZE:
128  g_ResizedW = ev->ev.resize.w;
129  g_ResizedH = ev->ev.resize.h;
130  break;
131 #endif
132 
133  case SDL_QUIT:
134  kill_mainloop();
135  break;
136 
137  case SDL_HOTKEYDOWN:
138  std::string hotkey = static_cast<const char*>(ev->ev.user.data1);
139  if (hotkey == "exit")
140  {
141  kill_mainloop();
142  return IN_HANDLED;
143  }
144  else if (hotkey == "screenshot")
145  {
146  WriteScreenshot(L".png");
147  return IN_HANDLED;
148  }
149  else if (hotkey == "bigscreenshot")
150  {
151  WriteBigScreenshot(L".bmp", 10);
152  return IN_HANDLED;
153  }
154  else if (hotkey == "togglefullscreen")
155  {
156 #if !OS_MACOSX
157  // TODO: Fix fullscreen toggling on OS X, see http://trac.wildfiregames.com/ticket/741
159 #else
160  LOGWARNING(L"Toggling fullscreen and resizing are disabled on OS X due to a known bug. Please use the config file to change display settings.");
161 #endif
162  return IN_HANDLED;
163  }
164  else if (hotkey == "profile2.enable")
165  {
168  return IN_HANDLED;
169  }
170  break;
171  }
172 
173  return IN_PASS;
174 }
175 
176 
177 // dispatch all pending events to the various receivers.
178 static void PumpEvents()
179 {
180  PROFILE3("dispatch events");
181 
182  SDL_Event_ ev;
183  while (SDL_PollEvent(&ev.ev))
184  {
185  PROFILE2("event");
186  if (g_GUI)
187  {
188  std::string data = g_GUI->GetScriptInterface().StringifyJSON(
190  PROFILE2_ATTR("%s", data.c_str());
191  }
192  in_dispatch_event(&ev);
193  }
194 
196 }
197 
198 
199 // return indication of whether archive is currently being built; this is
200 // used to prevent reloading during that time (see call site).
202 {
203 ONCE(g_GUI->SendEventToAll("archivebuildercomplete"));
204 return false;
205 #if 0
206  int ret = vfs_opt_auto_build("../logs/trace.txt", "mods/official/official%02d.zip", "mods/official/mini%02d.zip");
207  if(ret == INFO::ALL_COMPLETE)
208  {
209  // nothing to do; will return false below
210  }
211  else if(ret < 0)
212  DEBUG_DISPLAY_ERROR(L"Archive build failed");
213  else if(ret == INFO::OK)
214  g_GUI.SendEventToAll("archivebuildercomplete");
215  // in progress
216  else
217  {
218  int percent = (int)ret;
219  g_ScriptingHost.SetGlobal("g_ArchiveBuilderProgress", INT_TO_JSVAL(percent));
220  g_GUI.SendEventToAll("archivebuilderprogress");
221  return true;
222  }
223 
224  return false;
225 #endif
226 }
227 
228 
229 static int ProgressiveLoad()
230 {
231  PROFILE3("progressive load");
232 
233  wchar_t description[100];
234  int progress_percent;
235  try
236  {
237  Status ret = LDR_ProgressiveLoad(10e-3, description, ARRAY_SIZE(description), &progress_percent);
238  switch(ret)
239  {
240  // no load active => no-op (skip code below)
241  case INFO::OK:
242  return 0;
243  // current task didn't complete. we only care about this insofar as the
244  // load process is therefore not yet finished.
245  case ERR::TIMED_OUT:
246  break;
247  // just finished loading
248  case INFO::ALL_COMPLETE:
250  wcscpy_s(description, ARRAY_SIZE(description), L"Game is starting..");
251  // LDR_ProgressiveLoad returns L""; set to valid text to
252  // avoid problems in converting to JSString
253  break;
254  // error!
255  default:
257  // can't do this above due to legit ERR::TIMED_OUT
258  break;
259  }
260  }
262  {
263  // Map loading failed
264 
265  // Call script function to do the actual work
266  // (delete game data, switch GUI page, show error, etc.)
267  CancelLoad(CStr(e.what()).FromUTF8());
268  }
269 
270  GUI_DisplayLoadProgress(progress_percent, description);
271  return 0;
272 }
273 
274 
276 {
277  PROFILE3("renderer incremental load");
278 
279  const double maxTime = 0.1f;
280 
281  double startTime = timer_Time();
282  bool more;
283  do {
284  more = g_Renderer.GetTextureManager().MakeProgress();
285  }
286  while (more && timer_Time() - startTime < maxTime);
287 }
288 
289 
290 static bool quit = false; // break out of main loop
291 
292 static void Frame()
293 {
295  PROFILE2("frame");
298 
299  ogl_WarnIfError();
300 
301  // get elapsed time
302  const double time = timer_Time();
303  g_frequencyFilter->Update(time);
304  // .. old method - "exact" but contains jumps
305 #if 0
306  static double last_time;
307  const double time = timer_Time();
308  const float TimeSinceLastFrame = (float)(time-last_time);
309  last_time = time;
310  ONCE(return); // first call: set last_time and return
311 
312  // .. new method - filtered and more smooth, but errors may accumulate
313 #else
314  const float realTimeSinceLastFrame = 1.0 / g_frequencyFilter->SmoothedFrequency();
315 #endif
316  ENSURE(realTimeSinceLastFrame > 0.0f);
317 
318  // decide if update/render is necessary
319  bool need_render = !g_app_minimized;
320  bool need_update = true;
321 
322  // If we are not running a multiplayer game, disable updates when the game is
323  // minimized or out of focus and relinquish the CPU a bit, in order to make
324  // debugging easier.
326  {
327  PROFILE3("non-focus delay");
328  need_update = false;
329  // don't use SDL_WaitEvent: don't want the main loop to freeze until app focus is restored
330  SDL_Delay(10);
331  }
332 
333  // TODO: throttling: limit update and render frequency to the minimum.
334  // this is mostly relevant for "inactive" state, so that other windows
335  // get enough CPU time, but it's always nice for power+thermal management.
336 
337  bool is_building_archive = ProgressiveBuildArchive();
338 
339  // this scans for changed files/directories and reloads them, thus
340  // allowing hotloading (changes are immediately assimilated in-game).
341  // must not be done during archive building because it changes the
342  // archive file each iteration, but keeps it locked; reloading
343  // would trigger a warning because the file can't be opened.
344  if(!is_building_archive)
346 
347  ProgressiveLoad();
348 
350 
351  PumpEvents();
352 
353  // if the user quit by closing the window, the GL context will be broken and
354  // may crash when we call Render() on some drivers, so leave this loop
355  // before rendering
356  if (quit)
357  return;
358 
359  // respond to pumped resize events
360  if (g_ResizedW || g_ResizedH)
361  {
363  g_ResizedW = g_ResizedH = 0;
364  }
365 
366  if (g_NetClient)
367  g_NetClient->Poll();
368 
369  ogl_WarnIfError();
370 
371  g_GUI->TickObjects();
372 
373  ogl_WarnIfError();
374 
375  if (g_Game && g_Game->IsGameStarted() && need_update)
376  {
377  g_Game->Update(realTimeSinceLastFrame);
378 
379  g_Game->GetView()->Update(float(realTimeSinceLastFrame));
380  }
381 
382  // Immediately flush any messages produced by simulation code
383  if (g_NetClient)
384  g_NetClient->Flush();
385 
387 
388  g_Console->Update(realTimeSinceLastFrame);
389 
390  ogl_WarnIfError();
391  if(need_render)
392  {
393  Render();
394 
395  PROFILE3("swap buffers");
396 #if SDL_VERSION_ATLEAST(2, 0, 0)
397  SDL_GL_SwapWindow(g_VideoMode.GetWindow());
398 #else
400 #endif
401  }
402  ogl_WarnIfError();
403 
404  g_Profiler.Frame();
405 
406  g_GameRestarted = false;
407 }
408 
409 
410 static void MainControllerInit()
411 {
412  // add additional input handlers only needed by this controller:
413 
414  // must be registered after gui_handler. Should mayhap even be last.
416 }
417 
418 
419 
421 {
422 }
423 
424 
425 // stop the main loop and trigger orderly shutdown. called from several
426 // places: the event handler (SDL_QUIT and hotkey) and JS exitProgram.
428 {
429  quit = true;
430 }
431 
432 
433 static bool restart_in_atlas = false;
434 // called by game code to indicate main() should restart in Atlas mode
435 // instead of terminating
437 {
438  quit = true;
439  restart_in_atlas = true;
440 }
441 
442 // moved into a helper function to ensure args is destroyed before
443 // exit(), which may result in a memory leak.
444 static void RunGameOrAtlas(int argc, const char* argv[])
445 {
446  CmdLineArgs args(argc, argv);
447 
448  // We need to initialise libxml2 in the main thread before
449  // any thread uses it. So initialise it here before we
450  // might run Atlas.
452 
453  // run Atlas (if requested via args)
454  bool ran_atlas = ATLAS_RunIfOnCmdLine(args, false);
455  // Atlas handles the whole init/shutdown/etc sequence by itself;
456  // when we get here, it has exited and we're done.
457  if(ran_atlas)
458  return;
459 
460  // run non-visual simulation replay if requested
461  if (args.Has("replay"))
462  {
463  // TODO: Support mods
464  Paths paths(args);
465  g_VFS = CreateVfs(20 * MiB);
466  g_VFS->Mount(L"cache/", paths.Cache(), VFS_MOUNT_ARCHIVABLE);
467  g_VFS->Mount(L"", paths.RData()/"mods"/"public", VFS_MOUNT_MUST_EXIST);
468 
469  {
470  CReplayPlayer replay;
471  replay.Load(args.Get("replay"));
472  replay.Replay();
473  }
474 
475  g_VFS.reset();
476 
478  return;
479  }
480 
481  // run in archive-building mode if requested
482  if (args.Has("archivebuild"))
483  {
484  Paths paths(args);
485 
486  OsPath mod(args.Get("archivebuild"));
487  OsPath zip;
488  if (args.Has("archivebuild-output"))
489  zip = args.Get("archivebuild-output");
490  else
491  zip = mod.Filename().ChangeExtension(L".zip");
492 
493  CArchiveBuilder builder(mod, paths.Cache());
494  builder.Build(zip, args.Has("archivebuild-compress"));
495 
497  return;
498  }
499 
500  const double res = timer_Resolution();
502 
503  // run the game
504  Init(args, 0);
505  InitGraphics(args, 0);
507  while(!quit)
508  Frame();
509  Shutdown(0);
510  ScriptingHost::FinalShutdown(); // this can't go in Shutdown() because that could be called multiple times per process, so stick it here instead
512 
513  if (restart_in_atlas)
514  {
515  ATLAS_RunIfOnCmdLine(args, true);
516  return;
517  }
518 
519  // Shut down libxml2 (done here to match the Startup call)
521 }
522 
523 #if OS_ANDROID
524 // In Android we compile the engine as a shared library, not an executable,
525 // so rename main() to a different symbol that the wrapper library can load
526 #undef main
527 #define main pyrogenesis_main
528 extern "C" __attribute__((visibility ("default"))) int main(int argc, char* argv[]);
529 #endif
530 
531 extern "C" int main(int argc, char* argv[])
532 {
533 #if OS_UNIX
534  // Don't allow people to run the game with root permissions,
535  // because bad things can happen, check before we do anything
536  if (geteuid() == 0)
537  {
538  std::cerr << "********************************************************\n"
539  << "WARNING: Attempted to run the game with root permission!\n"
540  << "This is not allowed because it can alter home directory \n"
541  << "permissions and opens your system to vulnerabilities. \n"
542  << "(You received this message because you were either \n"
543  <<" logged in as root or used e.g. the 'sudo' command.) \n"
544  << "********************************************************\n\n";
545  return EXIT_FAILURE;
546  }
547 #endif // OS_UNIX
548 
549  EarlyInit(); // must come at beginning of main
550 
551  RunGameOrAtlas(argc, const_cast<const char**>(argv));
552 
553  // Shut down profiler initialised by EarlyInit
555 
556  return EXIT_SUCCESS;
557 }
int SDL_PollEvent(SDL_Event *ev)
Definition: wsdl.cpp:1343
void InitGraphics(const CmdLineArgs &args, int flags)
Definition: GameSetup.cpp:935
void Update()
Must be called frequently (preferably every frame), to update some internal reconnection timers...
Definition: UserReport.cpp:610
Packages a mod&#39;s files into a distributable archive.
CStr Get(const char *name) const
Get the value of the named parameter.
Definition: CmdLineArgs.cpp:71
static int g_ResizedW
Definition: main.cpp:90
CUserReporter g_UserReporter
Definition: UserReport.cpp:73
CNetClient * g_NetClient
Global network client for the standard game.
Definition: NetClient.cpp:37
static int ProgressiveLoad()
Definition: main.cpp:229
static void FinalShutdown()
const Status OK
Definition: status.h:386
void SDL_Delay(Uint32 ms)
Definition: wsdl.cpp:1457
void in_dispatch_event(const SDL_Event_ *ev)
Definition: input.cpp:55
Definition: wsdl.h:294
void RecordFrameStart()
Call in main thread at the start of a frame.
Definition: Profiler2.h:304
void GUI_DisplayLoadProgress(int percent, const wchar_t *pending_task)
Definition: GameSetup.cpp:183
static Status Init()
Definition: h_mgr.cpp:744
bool ToggleFullscreen()
Switch between fullscreen and windowed mode.
Definition: VideoMode.cpp:424
const OsPath & RData() const
Returns directory for read-only data installed with the game.
Definition: Paths.h:43
const Status TIMED_OUT
Definition: status.h:411
static void Shutdown()
Definition: h_mgr.cpp:762
void Replay()
Definition: Replay.cpp:122
static bool quit
Definition: main.cpp:290
static int g_ResizedH
Definition: main.cpp:91
bool ATLAS_RunIfOnCmdLine(const CmdLineArgs &args, bool force)
Definition: Atlas.cpp:73
static void RendererIncrementalLoad()
Definition: main.cpp:275
void in_add_handler(InHandler handler)
Definition: input.cpp:39
std::string StringifyJSON(jsval obj, bool indent=true)
Stringify to a JSON string, UTF-8 encoded.
void EnableHTTP()
Call in main thread to enable the HTTP server.
Definition: Profiler2.cpp:157
static void MainControllerInit()
Definition: main.cpp:410
void WriteScreenshot(const VfsPath &extension)
Definition: Util.cpp:199
void SDL_GL_SwapBuffers()
Definition: wsdl.cpp:478
CGUIManager * g_GUI
Definition: GUIManager.cpp:32
const Status ALL_COMPLETE
Definition: status.h:400
#define ARRAY_SIZE(name)
int wcscpy_s(wchar_t *dst, size_t max_dst_chars, const wchar_t *src)
void kill_mainloop()
Definition: main.cpp:427
#define g_Renderer
Definition: Renderer.h:61
Hotkey system.
#define LOGWARNING
Definition: CLogger.h:34
return ERR::VFS_DIR_NOT_FOUND if the given real path doesn&#39;t exist.
Definition: vfs.h:60
void Load(const std::string &path)
Definition: Replay.cpp:114
void Flush()
Flush any queued outgoing network messages.
Definition: NetClient.cpp:155
SDL_Event ev
Definition: libsdl.h:56
CVideoMode g_VideoMode
Definition: VideoMode.cpp:42
bool ResizeWindow(int w, int h)
Resize the SDL window and associated graphics stuff to the new size.
Definition: VideoMode.cpp:338
#define WARN_RETURN_STATUS_IF_ERR(expression)
Definition: status.h:287
#define ENSURE(expr)
ensure the expression &lt;expr&gt; evaluates to non-zero.
Definition: debug.h:282
static bool ProgressiveBuildArchive()
Definition: main.cpp:201
#define PROFILE2(region)
Starts timing from now until the end of the current scope.
Definition: Profiler2.h:446
static bool restart_in_atlas
Definition: main.cpp:433
#define g_ScriptingHost
PIVFS CreateVfs(size_t cacheSize)
create an instance of a Virtual File System.
Definition: vfs.cpp:321
void IncrementFrameNumber()
Definition: Profiler2.h:367
Uint8 type
Definition: wsdl.h:302
#define g_Profiler
Definition: Profile.h:147
CTouchInput g_TouchInput
Definition: TouchInput.cpp:291
Status ReloadChangedFiles()
poll for directory change notifications and reload all affected files.
Definition: Filesystem.cpp:70
CConsole * g_Console
Definition: CConsole.cpp:46
SDL_Window * GetWindow()
Definition: VideoMode.cpp:506
bool Update(const double deltaRealTime, bool doInterpolate=true)
Periodic heartbeat that controls the process.
Definition: Game.cpp:272
CProfiler2 g_Profiler2
Definition: Profiler2.cpp:35
SDL_ActiveEvent active
Definition: wsdl.h:303
int vfs_opt_auto_build(const char *trace_filename, const char *archive_fn_fmt, const char *mini_archive_fn_fmt, bool force_build=false)
bool Has(const char *name) const
Test whether the given name was specified, as either -name or -name=value
Definition: CmdLineArgs.cpp:66
void Update(const float deltaRealTime)
Updates all the view information (i.e.
Definition: GameView.cpp:672
Definition: path.h:75
static void PumpEvents()
Definition: main.cpp:178
New profiler (complementing the older CProfileManager)
bool g_app_has_focus
Definition: Globals.cpp:27
InReaction
Definition: input.h:34
void Build(const OsPath &archive, bool compress)
Do all the processing and packing of files into the archive.
#define ONCE(ONCE_code__)
execute the code passed as a parameter only the first time this is reached.
Definition: input.h:40
Replay log replayer.
Definition: Replay.h:84
virtual const char * what() const
Definition: Errors.cpp:453
static const size_t MiB
Definition: alignment.h:72
const OsPath & Cache() const
Returns cache directory.
Definition: Paths.h:77
static jsval ToJSVal(JSContext *cx, T const &val)
Convert a C++ type to a jsval.
anything mounted from here should be included when building archives.
Definition: vfs.h:54
void TickObjects()
See CGUI::TickObjects; applies to all loaded pages.
Definition: GUIManager.cpp:261
bool g_GameRestarted
Definition: MiniMap.cpp:46
CGame * g_Game
Globally accessible pointer to the CGame object.
Definition: Game.cpp:56
i64 Status
Error handling system.
Definition: status.h:171
static void Terminate()
Call once when shutting down the program, to unload libxml2.
Definition: Xeromyces.cpp:57
const int SDL_HOTKEYDOWN
Definition: Hotkey.h:41
void Render()
Definition: GameSetup.cpp:192
double timer_Time()
Definition: timer.cpp:98
void RenderCursor(bool RenderingState)
enable/disable rendering of the cursor - this does not hide cursor, but reverts to OS style ...
Definition: GameSetup.cpp:1066
void Poll()
Poll the connection for messages from the server and process them, and send any queued messages...
Definition: NetClient.cpp:149
PIFrequencyFilter g_frequencyFilter
Definition: Globals.cpp:37
void CancelLoad(const CStrW &message)
Definition: GameSetup.cpp:1326
bool g_PauseOnFocusLoss
Definition: Config.cpp:37
ScriptInterface & GetScriptInterface()
Definition: GUIManager.h:52
static void RunGameOrAtlas(int argc, const char *argv[])
Definition: main.cpp:444
void Update(const float deltaRealTime)
Definition: CConsole.cpp:162
#define PROFILE2_ATTR
Associates a string (with printf-style formatting) with the current region or event.
Definition: Profiler2.h:461
CGameView * GetView()
Get the pointer to the game view object.
Definition: Game.h:128
static void MainControllerShutdown()
Definition: main.cpp:420
Wrapper class for OS paths used by the game.
Definition: Paths.h:27
void Shutdown()
Call in main thread to shut everything down.
Definition: Profiler2.cpp:186
#define PROFILE3(name)
Definition: Profile.h:201
double timer_Resolution()
Definition: timer.cpp:145
void EnableGPU()
Call in main thread to enable the GPU profiling support, after OpenGL has been initialised.
Definition: Profiler2.cpp:174
PIFrequencyFilter CreateFrequencyFilter(double resolution, double expectedFrequency)
Status LDR_ProgressiveLoad(double time_budget, wchar_t *description, size_t max_chars, int *progress_percent)
Definition: Loader.cpp:193
void EarlyInit()
initialize global modules that are be needed before Init.
Definition: GameSetup.cpp:827
bool IsGameStarted() const
Get m_GameStarted.
Definition: Game.h:110
Network client/server sessions.
#define DEBUG_DISPLAY_ERROR(description)
Definition: debug.h:197
static void Frame()
Definition: main.cpp:292
static InReaction MainInputHandler(const SDL_Event_ *ev)
Definition: main.cpp:94
bool g_app_minimized
Definition: Globals.cpp:26
void Frame()
Should be called once per frame to perform updates.
Definition: TouchInput.cpp:163
void restart_mainloop_in_atlas()
Definition: main.cpp:436
void ogl_WarnIfError()
raise a warning (break into the debugger) if an OpenGL error is pending.
Definition: ogl.cpp:398
static void Startup()
Call once when initialising the program, to load libxml2.
Definition: Xeromyces.cpp:49
SDL_UserEvent user
Definition: wsdl.h:312
PSRETURN ReallyStartGame()
Game initialization has been completed.
Definition: Game.cpp:198
PIVFS g_VFS
Definition: Filesystem.cpp:30
int main(int argc, char *argv[])
Definition: main.cpp:531
void WriteBigScreenshot(const VfsPath &extension, int tiles)
Definition: Util.cpp:252
JSContext * GetContext() const
void SendEventToAll(const CStr &eventName)
See CGUI::SendEventToAll; applies to the currently active page.
Definition: GUIManager.cpp:256
int GetFrameNumber()
Definition: Profiler2.h:362
SDL_ResizeEvent resize
Definition: wsdl.h:309
void * data1
Definition: wsdl.h:282