diff --git a/Source/Engine/Engine/Engine.cpp b/Source/Engine/Engine/Engine.cpp
index 709997eac..979a2547b 100644
--- a/Source/Engine/Engine/Engine.cpp
+++ b/Source/Engine/Engine/Engine.cpp
@@ -413,24 +413,6 @@ bool Engine::HasGameViewportFocus()
#endif
}
-Vector2 Engine::ScreenToGameViewport(const Vector2& screenPos)
-{
-#if USE_EDITOR
- return Editor::Managed->ScreenToGameViewport(screenPos);
-#else
- return MainWindow ? MainWindow->ScreenToClient(screenPos) : Vector2::Minimum;
-#endif
-}
-
-Vector2 Engine::GameViewportToScreen(const Vector2& viewportPos)
-{
-#if USE_EDITOR
- return Editor::Managed->GameViewportToScreen(viewportPos);
-#else
- return MainWindow ? MainWindow->ClientToScreen(viewportPos) : Vector2::Minimum;
-#endif
-}
-
void Engine::OnPause()
{
LOG(Info, "App paused");
diff --git a/Source/Engine/Engine/Engine.h b/Source/Engine/Engine/Engine.h
index 22aeac9f0..13f3e1fe8 100644
--- a/Source/Engine/Engine/Engine.h
+++ b/Source/Engine/Engine/Engine.h
@@ -153,20 +153,6 @@ public:
/// True if game viewport is focused, otherwise false.
static bool HasGameViewportFocus();
- ///
- /// Converts the screen-space position to the game viewport position.
- ///
- /// The screen-space position.
- /// The game viewport position.
- static Vector2 ScreenToGameViewport(const Vector2& screenPos);
-
- ///
- /// Converts the game viewport position to the screen-space position.
- ///
- /// The game viewport position.
- /// The screen-space position.
- static Vector2 GameViewportToScreen(const Vector2& viewportPos);
-
private:
static void OnPause();
diff --git a/Source/Engine/Engine/Screen.cpp b/Source/Engine/Engine/Screen.cpp
index 999dc28cb..402e5e312 100644
--- a/Source/Engine/Engine/Screen.cpp
+++ b/Source/Engine/Engine/Screen.cpp
@@ -66,6 +66,24 @@ void Screen::SetSize(const Vector2& value)
Size = value;
}
+Vector2 Screen::ScreenToGameViewport(const Vector2& screenPos)
+{
+#if USE_EDITOR
+ return Editor::Managed->ScreenToGameViewport(screenPos);
+#else
+ return MainWindow ? MainWindow->ScreenToClient(screenPos) : Vector2::Minimum;
+#endif
+}
+
+Vector2 Screen::GameViewportToScreen(const Vector2& viewportPos)
+{
+#if USE_EDITOR
+ return Editor::Managed->GameViewportToScreen(viewportPos);
+#else
+ return MainWindow ? MainWindow->ClientToScreen(viewportPos) : Vector2::Minimum;
+#endif
+}
+
bool Screen::GetCursorVisible()
{
#if USE_EDITOR
diff --git a/Source/Engine/Engine/Screen.h b/Source/Engine/Engine/Screen.h
index 88a44da43..4fa39a324 100644
--- a/Source/Engine/Engine/Screen.h
+++ b/Source/Engine/Engine/Screen.h
@@ -33,6 +33,20 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screen);
/// The value
API_PROPERTY() static Vector2 GetSize();
+ ///
+ /// Converts the screen-space position to the game viewport position.
+ ///
+ /// The screen-space position.
+ /// The game viewport position.
+ API_FUNCTION() static Vector2 ScreenToGameViewport(const Vector2& screenPos);
+
+ ///
+ /// Converts the game viewport position to the screen-space position.
+ ///
+ /// The game viewport position.
+ /// The screen-space position.
+ API_FUNCTION() static Vector2 GameViewportToScreen(const Vector2& viewportPos);
+
///
/// Sets the window size.
///
diff --git a/Source/Engine/Input/Input.cpp b/Source/Engine/Input/Input.cpp
index 485d5a891..d7796691b 100644
--- a/Source/Engine/Input/Input.cpp
+++ b/Source/Engine/Input/Input.cpp
@@ -339,14 +339,14 @@ bool Input::GetKeyUp(const KeyboardKeys key)
Vector2 Input::GetMousePosition()
{
- return Mouse ? Engine::ScreenToGameViewport(Mouse->GetPosition()) : Vector2::Minimum;
+ return Mouse ? Screen::ScreenToGameViewport(Mouse->GetPosition()) : Vector2::Minimum;
}
void Input::SetMousePosition(const Vector2& position)
{
if (Mouse && Engine::HasGameViewportFocus())
{
- const auto pos = Engine::GameViewportToScreen(position);
+ const auto pos = Screen::GameViewportToScreen(position);
if (pos > Vector2::Minimum)
Mouse->SetMousePosition(pos);
}