diff --git a/src/Engine/Window/Window.cpp b/src/Engine/Window/Window.cpp index edac7f9..21c93d4 100644 --- a/src/Engine/Window/Window.cpp +++ b/src/Engine/Window/Window.cpp @@ -63,6 +63,12 @@ namespace DREAM { m_windowY = y; } + void Window::centerWindow() { + int x = (GetMonitorWidth(getMonitorIndex()) / 2) - (getWindowWidth() / 2); + int y = (GetMonitorHeight(getMonitorIndex()) / 2) - (getWindowHeight() / 2); + setPosition(x, y); + } + int Window::getWidth() { return GetScreenWidth(); } @@ -87,6 +93,14 @@ namespace DREAM { return m_resizable; } + int Window::getWindowWidth() { + return GetScreenWidth(); + } + + int Window::getWindowHeight() { + return GetScreenHeight(); + } + int Window::getMonitorIndex() { return GetCurrentMonitor(); } diff --git a/src/Engine/Window/Window.hpp b/src/Engine/Window/Window.hpp index 035b701..6a6950b 100644 --- a/src/Engine/Window/Window.hpp +++ b/src/Engine/Window/Window.hpp @@ -24,6 +24,7 @@ namespace DREAM { void setTitle(const std::string& title); void setPosition(int x, int y); + void centerWindow(); int getWidth(); int getHeight(); @@ -33,6 +34,9 @@ namespace DREAM { bool isVSyncEnabled(); bool isResizable(); + int getWindowWidth(); + int getWindowHeight(); + int getMonitorIndex(); int getMonitorRefreshRate(); int getMonitorWidth();