Browse Source

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

David Wimsey 11 years ago
parent
commit
4d67030195
1 changed files with 10 additions and 5 deletions
  1. 10 5
      Samples/pyinvaders/src/main.cpp

+ 10 - 5
Samples/pyinvaders/src/main.cpp

@@ -80,15 +80,20 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	#endif
 	#endif
 
 
 	#ifdef ROCKET_PLATFORM_WIN32
 	#ifdef ROCKET_PLATFORM_WIN32
+#ifdef ROCKET_PLATFORM_WIN32
 	DoAllocConsole();
 	DoAllocConsole();
-	#endif
+#endif
+
+	int window_width = 1024;
+	int window_height = 768;
 
 
 	ShellRenderInterfaceOpenGL opengl_renderer;
 	ShellRenderInterfaceOpenGL opengl_renderer;
 	shell_renderer = &opengl_renderer;
 	shell_renderer = &opengl_renderer;
 
 
+	// @TODO switch to using variable for window sizes
 	// Generic OS initialisation, creates a window and attaches OpenGL.
 	// Generic OS initialisation, creates a window and attaches OpenGL.
-	if (!Shell::Initialise("../Samples/pyinvaders/") ||
-		!Shell::OpenWindow("Rocket Invaders from Mars (Python Powered)", shell_renderer, 1024, 768, false))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Rocket Invaders from Mars (Python Powered)", shell_renderer, window_width, window_height, false))
 	{
 	{
 		Shell::Shutdown();
 		Shell::Shutdown();
 		return -1;
 		return -1;
@@ -96,7 +101,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 
 	// Rocket initialisation.
 	// Rocket initialisation.
 	Rocket::Core::SetRenderInterface(&opengl_renderer);
 	Rocket::Core::SetRenderInterface(&opengl_renderer);
-	opengl_renderer.SetViewport(1024,768);
+	opengl_renderer.SetViewport(window_width, window_height);
 
 
 	ShellSystemInterface system_interface;
 	ShellSystemInterface system_interface;
 	Rocket::Core::SetSystemInterface(&system_interface);
 	Rocket::Core::SetSystemInterface(&system_interface);
@@ -109,7 +114,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	PythonInterface::Initialise((Shell::GetExecutablePath() + (APP_PATH "python") + PATH_SEPARATOR + Shell::GetExecutablePath() + ROCKET_PATH).CString());
 	PythonInterface::Initialise((Shell::GetExecutablePath() + (APP_PATH "python") + PATH_SEPARATOR + Shell::GetExecutablePath() + ROCKET_PATH).CString());
 
 
 	// Create the main Rocket context and set it on the shell's input layer.
 	// 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)
 	if (context == NULL)
 	{
 	{
 		Rocket::Core::Shutdown();
 		Rocket::Core::Shutdown();