Browse Source

Some fixes

rsredsq 10 years ago
parent
commit
24f9eedf96

+ 1 - 1
Script/AtomicEditor/ui/Shortcuts.ts

@@ -30,7 +30,7 @@ class Shortcuts extends Atomic.ScriptObject {
         } else {
         } else {
             var playerWindow = Preferences.getInstance().playerWindow;
             var playerWindow = Preferences.getInstance().playerWindow;
             if (playerWindow) {
             if (playerWindow) {
-                if ((playerWindow.monitor + 1) > Atomic.graphics.getMonitorsNumber()) {
+                if ((playerWindow.monitor + 1) > Atomic.graphics.getNumMonitors()) {
                     //will use default settings if monitor is not available
                     //will use default settings if monitor is not available
                     var args = "--resizable";
                     var args = "--resizable";
                     Atomic.editorMode.playProject(args, debug);
                     Atomic.editorMode.playProject(args, debug);

+ 11 - 8
Source/AtomicEditor/Application/AEEditorCommon.cpp

@@ -177,10 +177,10 @@ bool AEEditorCommon::CreateDefaultPreferences(String& path, JSONValue& prefs)
     root["recentProjects"] = JSONArray();
     root["recentProjects"] = JSONArray();
 
 
     JSONValue editorWindow;
     JSONValue editorWindow;
-    GetDefaultWindowPreferences(editorWindow);
+    GetDefaultWindowPreferences(editorWindow, true);
 
 
     JSONValue playerWindow;
     JSONValue playerWindow;
-    GetDefaultWindowPreferences(playerWindow);
+    GetDefaultWindowPreferences(playerWindow, false);
 
 
     root["editorWindow"] = editorWindow;
     root["editorWindow"] = editorWindow;
     root["playerWindow"] = playerWindow;
     root["playerWindow"] = playerWindow;
@@ -231,21 +231,24 @@ void AEEditorCommon::ValidateWindow()
         maxResolution += monitorResolution;
         maxResolution += monitorResolution;
     }
     }
 
 
-    if (windowPosition.x_ >= maxResolution.x_ || windowPosition.y_ >= maxResolution.y_ || windowPosition.x_ < 0 || windowPosition.y_ < 0)
+    if (windowPosition.x_ >= maxResolution.x_ || windowPosition.y_ >= maxResolution.y_ )
     {
     {
         JSONValue prefs;
         JSONValue prefs;
 
 
         if (!LoadPreferences(prefs))
         if (!LoadPreferences(prefs))
             return;
             return;
 
 
+        bool editor = context_->GetEditorContext();
+
         JSONValue window;
         JSONValue window;
-        GetDefaultWindowPreferences(window);
+        GetDefaultWindowPreferences(window, editor);
 
 
-        prefs[context_->GetEditorContext() ? "editorWindow" : "playerWindow"] = window;
+        prefs[editor ? "editorWindow" : "playerWindow"] = window;
 
 
+        //Setting the mode to 0 width/height will use engine defaults for window size and layout
         graphics->SetMode(0, 0);
         graphics->SetMode(0, 0);
         graphics->CenterWindow();
         graphics->CenterWindow();
-        if (context_->GetEditorContext())
+        if (editor)
         {
         {
             graphics->Maximize();
             graphics->Maximize();
         }
         }
@@ -254,14 +257,14 @@ void AEEditorCommon::ValidateWindow()
     }
     }
 }
 }
 
 
-void AEEditorCommon::GetDefaultWindowPreferences(JSONValue& windowPrefs)
+void AEEditorCommon::GetDefaultWindowPreferences(JSONValue& windowPrefs, bool maximized)
 {
 {
     windowPrefs["x"] = 0;
     windowPrefs["x"] = 0;
     windowPrefs["y"] = 0;
     windowPrefs["y"] = 0;
     windowPrefs["width"] = 0;
     windowPrefs["width"] = 0;
     windowPrefs["height"] = 0;
     windowPrefs["height"] = 0;
     windowPrefs["monitor"] = 0;
     windowPrefs["monitor"] = 0;
-    windowPrefs["maximized"] = context_->GetEditorContext() ? true : false;
+    windowPrefs["maximized"] = maximized ? true : false;
 }
 }
 
 
 String AEEditorCommon::GetPreferencesPath()
 String AEEditorCommon::GetPreferencesPath()

+ 1 - 1
Source/AtomicEditor/Application/AEEditorCommon.h

@@ -44,7 +44,7 @@ protected:
     SharedPtr<JSVM> vm_;
     SharedPtr<JSVM> vm_;
 
 
 private:
 private:
-    void GetDefaultWindowPreferences(JSONValue& windowPrefs);
+    void GetDefaultWindowPreferences(JSONValue& windowPrefs, bool maximized);
     String GetPreferencesPath();
     String GetPreferencesPath();
     bool LoadPreferences(JSONValue& prefs);
     bool LoadPreferences(JSONValue& prefs);
     bool SavePreferences(JSONValue& prefs);
     bool SavePreferences(JSONValue& prefs);