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
b004424eb4
1 changed files with 17 additions and 4 deletions
  1. 17 4
      Samples/basic/loaddocument/src/main.cpp

+ 17 - 4
Samples/basic/loaddocument/src/main.cpp

@@ -60,12 +60,25 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	ROCKET_UNUSED(argv);
 #endif
 
+#ifdef ROCKET_PLATFORM_LINUX
+#define APP_PATH "../Samples/basic/loaddocument/"
+#else
+#define APP_PATH "../../Samples/basic/loaddocument/"
+#endif
+
+#ifdef ROCKET_PLATFORM_WIN32
+        DoAllocConsole();
+#endif
+
+        int window_width = 1024;
+        int window_height = 768;
+
 	ShellRenderInterfaceOpenGL opengl_renderer;
 	shell_renderer = &opengl_renderer;
 
 	// Generic OS initialisation, creates a window and attaches OpenGL.
-	if (!Shell::Initialise("../Samples/basic/loaddocument/") ||
-		!Shell::OpenWindow("Load Document Sample", shell_renderer, 1024, 768, true))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Load Document Sample", shell_renderer, window_width, window_height, true))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -73,7 +86,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// Rocket initialisation.
 	Rocket::Core::SetRenderInterface(&opengl_renderer);
-	shell_renderer->SetViewport(1024,768);
+	shell_renderer->SetViewport(window_width, window_height);
 
 	ShellSystemInterface system_interface;
 	Rocket::Core::SetSystemInterface(&system_interface);
@@ -81,7 +94,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	Rocket::Core::Initialise();
 
 	// Create the main Rocket context and set it on the shell's input layer.
-	context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(1024, 768));
+	context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(window_width, window_height));
 	if (context == NULL)
 	{
 		Rocket::Core::Shutdown();