From 195d6cded05f7ef5bde695ee047b341a0265eab3 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 24 Mar 2013 00:03:37 +0100 Subject: 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 --- src/app/main.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/app/main.cpp') 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; -- cgit v1.2.3-1-g7c22