浏览代码

Input fixes

Josh Engebretson 10 年之前
父节点
当前提交
b2e2b22314

+ 13 - 0
Source/Atomic/Input/Input.cpp

@@ -424,6 +424,19 @@ void Input::Update()
             }
             }
         }
         }
     }
     }
+
+#ifndef EMSCRIPTEN
+   if (mouseMode_ == MM_RELATIVE)
+   {
+       IntVector2 mousePosition = GetMousePosition();
+       IntVector2 center(graphics_->GetWidth() / 2, graphics_->GetHeight() / 2);
+       if (mousePosition != center)
+       {
+           SetMousePosition(center);
+           lastMousePosition_ = center;
+       }
+   }
+   #endif
 }
 }
 
 
 void Input::SetMouseVisible(bool enable, bool suppressEvent)
 void Input::SetMouseVisible(bool enable, bool suppressEvent)

+ 7 - 0
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneView3D.cpp

@@ -142,7 +142,14 @@ void SceneView3D::MoveCamera(float timeStep)
         yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
         yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
         pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
         pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
         pitch_ = Clamp(pitch_, -90.0f, 90.0f);
         pitch_ = Clamp(pitch_, -90.0f, 90.0f);
+        input->SetMouseMode(MM_RELATIVE);
     }
     }
+    else
+    {
+        if (input->GetMouseMode() != MM_ABSOLUTE)
+            input->SetMouseMode(MM_ABSOLUTE);
+    }
+
 
 
     // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
     // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
     cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
     cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));

+ 2 - 0
Source/AtomicEditor/Source/UI/Modal/UICreateProject.cpp

@@ -62,6 +62,8 @@ UICreateProject::UICreateProject(Context* context, const String &templateFolder,
 
 
 #if defined(ATOMIC_PLATFORM_OSX)
 #if defined(ATOMIC_PLATFORM_OSX)
     userDocuments += "Documents/AtomicProjects";
     userDocuments += "Documents/AtomicProjects";
+#else
+    userDocuments += "AtomicProjects";
 #endif
 #endif
 
 
     projectPathField_->SetText(userDocuments.CString());
     projectPathField_->SetText(userDocuments.CString());