Browse Source

Fixed platform differences and switched windows size values from hard coded to use a common set of variables

David Wimsey 11 years ago
parent
commit
54d01a9dcb
1 changed files with 23 additions and 3 deletions
  1. 23 3
      Samples/invaders/src/main.cpp

+ 23 - 3
Samples/invaders/src/main.cpp

@@ -62,11 +62,31 @@ int APIENTRY WinMain(HINSTANCE ROCKET_UNUSED_PARAMETER(instance_handle), HINSTAN
 int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv))
 int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv))
 #endif
 #endif
 {
 {
+#ifdef ROCKET_PLATFORM_WIN32
+	ROCKET_UNUSED(instance_handle);
+	ROCKET_UNUSED(previous_instance_handle);
+	ROCKET_UNUSED(command_line);
+	ROCKET_UNUSED(command_show);
+#else
+	ROCKET_UNUSED(argc);
+	ROCKET_UNUSED(argv);
+#endif
+
+#ifdef ROCKET_PLATFORM_LINUX
+#define APP_PATH "../Samples/invaders/"
+#else
+#define APP_PATH "../../Samples/invaders/"
+#endif
+
+#ifdef ROCKET_PLATFORM_WIN32
+	DoAllocConsole();
+#endif
+
 	ShellRenderInterfaceOpenGL opengl_renderer;
 	ShellRenderInterfaceOpenGL opengl_renderer;
 	shell_renderer = &opengl_renderer;
 	shell_renderer = &opengl_renderer;
 
 
 	// Generic OS initialisation, creates a window and attaches OpenGL.
 	// Generic OS initialisation, creates a window and attaches OpenGL.
-	if (!Shell::Initialise("../Samples/invaders/") ||
+	if (!Shell::Initialise(APP_PATH) ||
 		!Shell::OpenWindow("Rocket Invaders from Mars", shell_renderer, 1024, 768, false))
 		!Shell::OpenWindow("Rocket Invaders from Mars", shell_renderer, 1024, 768, false))
 	{
 	{
 		Shell::Shutdown();
 		Shell::Shutdown();
@@ -134,7 +154,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	if (EventManager::LoadWindow("background") &&
 	if (EventManager::LoadWindow("background") &&
 		EventManager::LoadWindow("main_menu"))
 		EventManager::LoadWindow("main_menu"))
 		Shell::EventLoop(GameLoop);
 		Shell::EventLoop(GameLoop);
-		
+
 	// Shut down the game singletons.
 	// Shut down the game singletons.
 	HighScores::Shutdown();
 	HighScores::Shutdown();
 
 
@@ -147,6 +167,6 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 
 	Shell::CloseWindow();
 	Shell::CloseWindow();
 	Shell::Shutdown();
 	Shell::Shutdown();
-	
+
 	return 0;
 	return 0;
 }
 }