Browse Source

Engine: New WindowPositionX/Y init params. Sets initial window position prior to SetMode that creates the window.

Jonne Nauha 11 years ago
parent
commit
66913cf103
2 changed files with 6 additions and 1 deletions
  1. 2 0
      Docs/Reference.dox
  2. 4 1
      Source/Engine/Engine/Engine.cpp

+ 2 - 0
Docs/Reference.dox

@@ -138,6 +138,8 @@ The full list of supported parameters, their datatypes and default values:
 - WindowTitle (string) %Window title. Default "Urho3D".
 - WindowTitle (string) %Window title. Default "Urho3D".
 - WindowWidth (int) %Window horizontal dimension. Default 0 (use desktop resolution, or 1024 in windowed mode.)
 - WindowWidth (int) %Window horizontal dimension. Default 0 (use desktop resolution, or 1024 in windowed mode.)
 - WindowHeight (int) %Window vertical dimension. Default 0 (use desktop resolution, or 768 in windowed mode.)
 - WindowHeight (int) %Window vertical dimension. Default 0 (use desktop resolution, or 768 in windowed mode.)
+- WindowPositionX (int) %Window horizontal position. Default center to screen.
+- WindowPositionY (int) %Window vertical position. Default center to screen.
 - WindowResizable (bool) Whether window is resizable. Default false.
 - WindowResizable (bool) Whether window is resizable. Default false.
 - FullScreen (bool) Whether to create a full-screen window. Default true.
 - FullScreen (bool) Whether to create a full-screen window. Default true.
 - Borderless (bool) Whether to create the window as borderless. Default false.
 - Borderless (bool) Whether to create the window as borderless. Default false.

+ 4 - 1
Source/Engine/Engine/Engine.cpp

@@ -333,7 +333,10 @@ bool Engine::Initialize(const VariantMap& parameters)
         graphics->SetWindowIcon(cache->GetResource<Image>(GetParameter(parameters, "WindowIcon", String::EMPTY).GetString()));
         graphics->SetWindowIcon(cache->GetResource<Image>(GetParameter(parameters, "WindowIcon", String::EMPTY).GetString()));
         graphics->SetFlushGPU(GetParameter(parameters, "FlushGPU", false).GetBool());
         graphics->SetFlushGPU(GetParameter(parameters, "FlushGPU", false).GetBool());
         graphics->SetOrientations(GetParameter(parameters, "Orientations", "LandscapeLeft LandscapeRight").GetString());
         graphics->SetOrientations(GetParameter(parameters, "Orientations", "LandscapeLeft LandscapeRight").GetString());
-        
+
+        if (HasParameter(parameters, "WindowPositionX") && HasParameter(parameters, "WindowPositionY"))
+            graphics->SetWindowPosition(GetParameter(parameters, "WindowPositionX").GetInt(), GetParameter(parameters, "WindowPositionY").GetInt());
+
         if (!graphics->SetMode(
         if (!graphics->SetMode(
             GetParameter(parameters, "WindowWidth", 0).GetInt(),
             GetParameter(parameters, "WindowWidth", 0).GetInt(),
             GetParameter(parameters, "WindowHeight", 0).GetInt(),
             GetParameter(parameters, "WindowHeight", 0).GetInt(),