Browse Source

Switched windows size values from hard coded to use a common set of variables

David Wimsey 11 years ago
parent
commit
5112e97d90
1 changed files with 8 additions and 5 deletions
  1. 8 5
      Samples/luainvaders/src/main.cpp

+ 8 - 5
Samples/luainvaders/src/main.cpp

@@ -68,16 +68,19 @@ int main(int, char**)
 #define APP_PATH "../../Samples/luainvaders/"
 #endif
 
-	#ifdef ROCKET_PLATFORM_WIN32
+#ifdef ROCKET_PLATFORM_WIN32
 	DoAllocConsole();
-	#endif
+#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(APP_PATH) ||
-		!Shell::OpenWindow("Rocket Invaders from Mars (Lua Powered)", shell_renderer, 1024, 768, false))
+		!Shell::OpenWindow("Rocket Invaders from Mars (Lua Powered)", shell_renderer, window_width, window_height, false))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -85,7 +88,7 @@ int main(int, char**)
 
 	// Rocket initialisation.
 	Rocket::Core::SetRenderInterface(&opengl_renderer);
-	opengl_renderer.SetViewport(1024,768);
+	opengl_renderer.SetViewport(window_width, window_height);
 
 	ShellSystemInterface system_interface;
 	Rocket::Core::SetSystemInterface(&system_interface);
@@ -99,7 +102,7 @@ int main(int, char**)
 	Rocket::Controls::Lua::RegisterTypes(Rocket::Core::Lua::Interpreter::GetLuaState());
 
 	// 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();