File: Main.cpp

package info (click to toggle)
caveexpress 2.4%2Bgit20160609-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,824 kB
  • sloc: cpp: 66,239; ansic: 1,135; sh: 471; xml: 186; python: 74; makefile: 20
file content (37 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "mainloop/SDLMainLoop.h"
#include "common/ConfigManager.h"
#include "common/Log.h"
#include "common/Application.h"
#include "common/System.h"
#include "game/GameRegistry.h"
#include <SDL.h>
#include <SDL_main.h>
#include "game.h"

extern "C" int main (int argc, char *argv[])
{
	Application& app = Singleton<Application>::getInstance();
	const GamePtr& game = Singleton<GameRegistry>::getInstance().getGame();
	app.setOrganisation("caveproductions");
#if defined(__IPHONEOS__) || defined(__ANDROID__)
	app.setPackageName(GUI_IDENTIFIER);
#else
	app.setPackageName(APPNAME);
#endif
	app.setName(game->getName());
	app.setVersion(VERSION);

	getSystem().init();
	const std::string workingDir = getSystem().getCurrentWorkingDir();
	Log::info(LOG_MAIN, "current working dir: %s", workingDir.c_str());

	{
		Log::info(LOG_MAIN, "Entering mainloop");
		SDLMainLoop sdlBackend;
		sdlBackend.mainLoop(argc, argv);
		Log::info(LOG_MAIN, "Leaving mainloop");
	}

	Log::info(LOG_MAIN, "quit");
	return EXIT_SUCCESS;
}