Bläddra i källkod

Merge branch 'master' of https://github.com/lloydw/libRocket into transform

Markus Schöngart 11 år sedan
förälder
incheckning
76d823087f

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

@@ -61,12 +61,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/customlog/"
+#else
+#define APP_PATH "../../Samples/basic/customlog/"
+#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/customlog/") ||
-		!Shell::OpenWindow("Custom File Handler Sample", shell_renderer, 1024, 768, true))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Custom File Handler Sample", shell_renderer, window_width, window_height, true))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -74,7 +87,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// Rocket initialisation.
 	Rocket::Core::SetRenderInterface(&opengl_renderer);
-	opengl_renderer.SetViewport(1024,768);
+	opengl_renderer.SetViewport(window_width, window_height);
 
 
 	// Initialise our system interface to write the log messages to file.
@@ -84,7 +97,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();

+ 2 - 10
Samples/basic/directx/src/main.cpp

@@ -31,6 +31,8 @@
 #include <Shell.h>
 #include "RenderInterfaceDirectX.h"
 
+#include <windows.h>
+
 static Rocket::Core::Context* context = NULL;
 
 ShellRenderInterfaceExtensions *shell_renderer;
@@ -44,22 +46,12 @@ void GameLoop()
 	shell_renderer->PresentRenderBuffer();
 }
 
-#if defined ROCKET_PLATFORM_WIN32
-#include <windows.h>
 int APIENTRY WinMain(HINSTANCE ROCKET_UNUSED_PARAMETER(instance_handle), HINSTANCE ROCKET_UNUSED_PARAMETER(previous_instance_handle), char* ROCKET_UNUSED_PARAMETER(command_line), int ROCKET_UNUSED_PARAMETER(command_show))
-#else
-int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv))
-#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
 
 	int window_width = 1024;
 	int window_height = 768;

+ 1 - 1
Samples/basic/directx10/src/main.cpp

@@ -53,7 +53,7 @@ int APIENTRY WinMain(HINSTANCE ROCKET_UNUSED_PARAMETER(instance_handle), HINSTAN
 	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();

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

@@ -61,12 +61,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/drag/"
+#else
+#define APP_PATH "../../Samples/basic/drag/"
+#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/drag/") ||
-		!Shell::OpenWindow("Drag Sample", shell_renderer, 1024, 768, true))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Drag Sample", shell_renderer, window_width, window_height, true))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -74,7 +87,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// 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);
@@ -82,7 +95,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();

+ 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();

+ 4 - 4
Samples/basic/ogre3d/src/main.cpp

@@ -50,11 +50,11 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	}
 	catch (Exception& e)
 	{
-		#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
 	        MessageBox(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
-		#else
-			fprintf(stderr, "An exception has occurred: %s\n", e.getFullDescription().c_str());
-		#endif
+#else
+		fprintf(stderr, "An exception has occurred: %s\n", e.getFullDescription().c_str());
+#endif
 	}
 
 	return 0;

+ 45 - 30
Samples/basic/sdl2/src/main.cpp

@@ -39,33 +39,50 @@
 
 int main(int argc, char **argv)
 {
-    SDL_Init( SDL_INIT_VIDEO );
-    SDL_Window * screen = SDL_CreateWindow("LibRocket SDL2 test", 20, 20, 640, 480, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
-    SDL_GLContext glcontext = SDL_GL_CreateContext(screen);
-    int oglIdx = -1;
-    int nRD = SDL_GetNumRenderDrivers();
-    for(int i=0; i<nRD; i++)
-    {
-        SDL_RendererInfo info;
-        if(!SDL_GetRenderDriverInfo(i, &info))
-        {
-            if(!strcmp(info.name, "opengl"))
-            {
-                oglIdx = i;
-            }
-        }
-    }
-    SDL_Renderer * renderer = SDL_CreateRenderer(screen, oglIdx, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
-
-    GLenum err = glewInit();
-
-    if(err != GLEW_OK)
-        fprintf(stderr, "GLEW ERROR: %s\n", glewGetErrorString(err));
-
-    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-    glMatrixMode(GL_PROJECTION|GL_MODELVIEW);
-    glLoadIdentity();
-    glOrtho(0, 640, 480, 0, 0, 1);
+#ifdef ROCKET_PLATFORM_LINUX
+#define APP_PATH "../Samples/basic/sdl2/"
+#else
+#ifdef ROCKET_PLATFORM_MACOSX
+#define APP_PATH "../../../../../Samples/basic/sdl2/"
+#else
+#define APP_PATH "../../Samples/basic/sdl2/"
+#endif
+#endif
+
+#ifdef ROCKET_PLATFORM_WIN32
+        DoAllocConsole();
+#endif
+
+        int window_width = 1024;
+        int window_height = 768;
+
+    SDL_Init( SDL_INIT_VIDEO );
+    SDL_Window * screen = SDL_CreateWindow("LibRocket SDL2 test", 20, 20, window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
+    SDL_GLContext glcontext = SDL_GL_CreateContext(screen);
+    int oglIdx = -1;
+    int nRD = SDL_GetNumRenderDrivers();
+    for(int i=0; i<nRD; i++)
+    {
+        SDL_RendererInfo info;
+        if(!SDL_GetRenderDriverInfo(i, &info))
+        {
+            if(!strcmp(info.name, "opengl"))
+            {
+                oglIdx = i;
+            }
+        }
+    }
+    SDL_Renderer * renderer = SDL_CreateRenderer(screen, oglIdx, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
+
+    GLenum err = glewInit();
+
+    if(err != GLEW_OK)
+        fprintf(stderr, "GLEW ERROR: %s\n", glewGetErrorString(err));
+
+    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+    glMatrixMode(GL_PROJECTION|GL_MODELVIEW);
+    glLoadIdentity();
+    glOrtho(0, window_width, window_height, 0, 0, 1);
  
 	RocketSDL2Renderer Renderer(renderer, screen);
 	RocketSDL2SystemInterface SystemInterface;
@@ -84,7 +101,7 @@ int main(int argc, char **argv)
 	Rocket::Core::FontDatabase::LoadFontFace("Delicious-Roman.otf");
 
 	Rocket::Core::Context *Context = Rocket::Core::CreateContext("default",
-		Rocket::Core::Vector2i(640, 480));
+		Rocket::Core::Vector2i(window_width, window_height));
 
 	Rocket::Debugger::Initialise(Context);
 
@@ -124,7 +141,6 @@ int main(int argc, char **argv)
                 case SDL_MOUSEMOTION:
                     Context->ProcessMouseMove(event.motion.x, event.motion.y, SystemInterface.GetKeyModifiers());
                     break;
-                
                 case SDL_MOUSEBUTTONDOWN:
                     Context->ProcessMouseButtonDown(SystemInterface.TranslateMouseButton(event.button.button), SystemInterface.GetKeyModifiers());
                     break;
@@ -144,7 +160,6 @@ int main(int argc, char **argv)
                     break;
             }
         }
-        
 		Context->Update();
 	}
 

+ 8 - 1
Samples/basic/sfml/src/main.cpp

@@ -35,7 +35,14 @@
 
 int main(int argc, char **argv)
 {
-	sf::RenderWindow MyWindow(sf::VideoMode(800, 600), "libRocket with SFML");
+#ifdef ROCKET_PLATFORM_WIN32
+        DoAllocConsole();
+#endif
+
+        int window_width = 1024;
+        int window_height = 768;
+
+	sf::RenderWindow MyWindow(sf::VideoMode(window_width, window_height), "libRocket with SFML");
 
 	RocketSFMLRenderer Renderer;
 	RocketSFMLSystemInterface SystemInterface;

+ 8 - 1
Samples/basic/sfml2/src/main.cpp

@@ -45,7 +45,14 @@
 
 int main(int argc, char **argv)
 {
-	sf::RenderWindow MyWindow(sf::VideoMode(800, 600), "libRocket with SFML2", sf::Style::Close);
+#ifdef ROCKET_PLATFORM_WIN32
+        DoAllocConsole();
+#endif
+
+        int window_width = 1024;
+        int window_height = 768;
+
+	sf::RenderWindow MyWindow(sf::VideoMode(window_width, window_height), "libRocket with SFML2", sf::Style::Close);
 	MyWindow.setVerticalSyncEnabled(true);
 
 #ifdef ENABLE_GLEW

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

@@ -63,19 +63,32 @@ 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/treeview/"
+#else
+#define APP_PATH "../../Samples/basic/treeview/"
+#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/treeview/") ||
-		!Shell::OpenWindow("Tree View Sample", shell_renderer, 1024, 768, true))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Tree View Sample", shell_renderer, window_width, window_height, true))
 	{
 		Shell::Shutdown();
 		return -1;
 	}
 
 	// Rocket initialisation.
-	opengl_renderer.SetViewport(1024,768);
+	opengl_renderer.SetViewport(window_width, window_height);
 	Rocket::Core::SetRenderInterface(&opengl_renderer);
 
 	ShellSystemInterface system_interface;
@@ -84,7 +97,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();

+ 29 - 6
Samples/invaders/src/main.cpp

@@ -62,12 +62,35 @@ int APIENTRY WinMain(HINSTANCE ROCKET_UNUSED_PARAMETER(instance_handle), HINSTAN
 int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv))
 #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
+
+	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/invaders/") ||
-		!Shell::OpenWindow("Rocket Invaders from Mars", shell_renderer, 1024, 768, false))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Rocket Invaders from Mars", shell_renderer, window_width, window_height, false))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -75,7 +98,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// 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);
@@ -85,7 +108,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	Rocket::Controls::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();
@@ -134,7 +157,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	if (EventManager::LoadWindow("background") &&
 		EventManager::LoadWindow("main_menu"))
 		Shell::EventLoop(GameLoop);
-		
+
 	// Shut down the game singletons.
 	HighScores::Shutdown();
 
@@ -147,6 +170,6 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	Shell::CloseWindow();
 	Shell::Shutdown();
-	
+
 	return 0;
 }

+ 16 - 15
Samples/luainvaders/src/main.cpp

@@ -62,24 +62,25 @@ int APIENTRY WinMain(HINSTANCE, HINSTANCE, char*, int)
 int main(int, char**)
 #endif
 {
-	#ifdef ROCKET_PLATFORM_MACOSX
-	#define APP_PATH "../"
-	#define ROCKET_PATH "../../bin/"
-	#else
-	#define APP_PATH "../Samples/luainvaders/"
-	#define ROCKET_PATH "."
-	#endif
-
-	#ifdef ROCKET_PLATFORM_WIN32
+#ifdef ROCKET_PLATFORM_LINUX
+#define APP_PATH "../Samples/luainvaders/"
+#else
+#define APP_PATH "../../Samples/luainvaders/"
+#endif
+
+#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("../Samples/luainvaders/") ||
-		!Shell::OpenWindow("Rocket Invaders from Mars (Lua Powered)", shell_renderer, 1024, 768, false))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Rocket Invaders from Mars (Lua Powered)", shell_renderer, window_width, window_height, false))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -87,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);
@@ -101,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();
@@ -130,7 +131,7 @@ int main(int, char**)
 
 	// Fire off the startup script.
     LuaInterface::Initialise(Rocket::Core::Lua::Interpreter::GetLuaState()); //the tables/functions defined in the samples
-    Rocket::Core::Lua::Interpreter::LoadFile(Rocket::Core::String(APP_PATH).Append("lua/start.lua"));
+    Rocket::Core::Lua::Interpreter::LoadFile(Rocket::Core::String("lua/start.lua"));
 
 	Shell::EventLoop(GameLoop);	
 

+ 18 - 14
Samples/pyinvaders/src/main.cpp

@@ -71,24 +71,28 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	ROCKET_UNUSED(argv);
 #endif
 
-	#ifdef ROCKET_PLATFORM_MACOSX
-	#define APP_PATH "../"
-	#define ROCKET_PATH "../../bin/"
-	#else
-	#define APP_PATH "../Samples/pyinvaders/"
-	#define ROCKET_PATH "."
-	#endif
-
-	#ifdef ROCKET_PLATFORM_WIN32
+// @TODO Make these lookup at runtime rather than using hard coded paths
+#ifdef ROCKET_PLATFORM_LINUX
+#define APP_PATH "../Samples/pyinvaders/"
+#else
+#define APP_PATH "../../Samples/pyinvaders/"
+#define ROCKET_PATH "."
+#endif
+
+#ifdef ROCKET_PLATFORM_WIN32
 	DoAllocConsole();
-	#endif
+#endif
+
+	int window_width = 1024;
+	int window_height = 768;
 
 	ShellRenderInterfaceOpenGL opengl_renderer;
 	shell_renderer = &opengl_renderer;
 
+	// @TODO switch to using variable for window sizes
 	// 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();
 		return -1;
@@ -96,7 +100,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// 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);
@@ -109,7 +113,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());
 
 	// 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();

+ 3 - 1
Samples/shell/src/win32/ShellRenderInterfaceExtensionsOpenGL_Win32.cpp

@@ -124,7 +124,9 @@ bool ShellRenderInterfaceOpenGL::AttachToNative(void *nativeWindow)
 
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
-	glOrtho(0, 1024, 768, 0, -1, 1);
+	RECT crect;
+	GetClientRect(this->window_handle, &crect)
+	glOrtho(0, (crect.right - crect.left), (crect.bottom - crect.top), 0, -1, 1);
 
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();

+ 11 - 1
Samples/tutorial/datagrid/src/main.cpp

@@ -47,11 +47,21 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	ROCKET_UNUSED(argv);
 #endif
 
+#ifdef ROCKET_PLATFORM_LINUX
+#define APP_PATH "../Samples/tutorial/datagrid/"
+#else
+#define APP_PATH "../../Samples/tutorial/datagrid/"
+#endif
+
+#ifdef ROCKET_PLATFORM_WIN32
+        DoAllocConsole();
+#endif
+
 	ShellRenderInterfaceOpenGL opengl_renderer;
 	shell_renderer = &opengl_renderer;
 
 	// Generic OS initialisation, creates a window and attaches OpenGL.
-	if (!Shell::Initialise("../Samples/tutorial/datagrid/") ||
+	if (!Shell::Initialise(APP_PATH) ||
 		!Shell::OpenWindow("Datagrid Tutorial", shell_renderer, 1024, 768, true))
 	{
 		Shell::Shutdown();

+ 17 - 4
Samples/tutorial/datagrid_tree/src/main.cpp

@@ -48,12 +48,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/tutorial/datagrid_tree/"
+#else
+#define APP_PATH "../../Samples/tutorial/datagrid_tree/"
+#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/tutorial/datagrid_tree/") ||
-		!Shell::OpenWindow("Datagrid Tree Tutorial", shell_renderer, 1024, 768, true))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Datagrid Tree Tutorial", shell_renderer, window_width, window_height, true))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -61,7 +74,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// 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);
@@ -70,7 +83,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 	Rocket::Controls::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();

+ 17 - 4
Samples/tutorial/template/src/main.cpp

@@ -44,12 +44,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/tutorial/template/"
+#else
+#define APP_PATH "../../Samples/tutorial/template/"
+#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/tutorial/template/") ||
-		!Shell::OpenWindow("Template Tutorial", shell_renderer, 1024, 768, true))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Template Tutorial", shell_renderer, window_width, window_height, true))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -57,7 +70,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// 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);
@@ -65,7 +78,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();

+ 17 - 4
Samples/tutorial/tutorial_drag/src/main.cpp

@@ -45,12 +45,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/tutorial/tutorial_drag/"
+#else
+#define APP_PATH "../../Samples/tutorial/tutorial_drag/"
+#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/tutorial/tutorial_drag/") ||
-		!Shell::OpenWindow("Drag Tutorial", shell_renderer, 1024, 768, true))
+	if (!Shell::Initialise(APP_PATH) ||
+		!Shell::OpenWindow("Drag Tutorial", shell_renderer, window_width, window_height, true))
 	{
 		Shell::Shutdown();
 		return -1;
@@ -58,7 +71,7 @@ int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)
 
 	// 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);
@@ -66,7 +79,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();