Added centerWindow() function.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user