summaryrefslogtreecommitdiffstats
path: root/src/app/main.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-03-24 00:03:37 +0100
committerPiotr Dziwinski <piotrdz@gmail.com>2013-03-24 12:00:12 +0100
commit195d6cded05f7ef5bde695ee047b341a0265eab3 (patch)
treeaf6ffa3622ae9bf7f2f5f065e269e86a019af854 /src/app/main.cpp
parentc211b001d2a4c9b36034a812650f1a2ac693ee54 (diff)
downloadcolobot-195d6cded05f7ef5bde695ee047b341a0265eab3.tar.gz
colobot-195d6cded05f7ef5bde695ee047b341a0265eab3.tar.bz2
colobot-195d6cded05f7ef5bde695ee047b341a0265eab3.zip
Fixed timer functions on win32
* changed win32 implementation to QueryPerformaceTimer system function * refactored system utils code * proper tests for time utils and update event creation in application * should fix issue #134
Diffstat (limited to 'src/app/main.cpp')
-rw-r--r--src/app/main.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 0622370..edb5828 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -76,40 +76,46 @@ extern "C"
int SDL_MAIN_FUNC(int argc, char *argv[])
{
- CLogger logger; // Create the logger
+ CLogger logger; // single istance of logger
- InitializeRestext(); // Initialize translation strings
+ InitializeRestext(); // init static translation strings
+
+ CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils
+ systemUtils->Init();
logger.Info("Colobot starting\n");
- CApplication app; // single instance of the application
+ CApplication* app = new CApplication(); // single instance of the application
- ParseArgsStatus status = app.ParseArguments(argc, argv);
+ ParseArgsStatus status = app->ParseArguments(argc, argv);
if (status == PARSE_ARGS_FAIL)
{
- SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", "Invalid commandline arguments!\n");
- return app.GetExitCode();
+ systemUtils->SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", "Invalid commandline arguments!\n");
+ return app->GetExitCode();
}
else if (status == PARSE_ARGS_HELP)
{
- return app.GetExitCode();
+ return app->GetExitCode();
}
int code = 0;
- if (! app.Create())
+ if (! app->Create())
{
- app.Destroy(); // ensure a clean exit
- code = app.GetExitCode();
- if ( code != 0 && !app.GetErrorMessage().empty() )
+ app->Destroy(); // ensure a clean exit
+ code = app->GetExitCode();
+ if ( code != 0 && !app->GetErrorMessage().empty() )
{
- SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", app.GetErrorMessage());
+ systemUtils->SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", app->GetErrorMessage());
}
logger.Info("Didn't run main loop. Exiting with code %d\n", code);
return code;
}
- code = app.Run();
+ code = app->Run();
+
+ delete app;
+ delete systemUtils;
logger.Info("Exiting with code %d\n", code);
return code;