Added centerWindow() function.
This commit is contained in:
@@ -63,6 +63,12 @@ namespace DREAM {
|
|||||||
m_windowY = y;
|
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() {
|
int Window::getWidth() {
|
||||||
return GetScreenWidth();
|
return GetScreenWidth();
|
||||||
}
|
}
|
||||||
@@ -87,6 +93,14 @@ namespace DREAM {
|
|||||||
return m_resizable;
|
return m_resizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Window::getWindowWidth() {
|
||||||
|
return GetScreenWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Window::getWindowHeight() {
|
||||||
|
return GetScreenHeight();
|
||||||
|
}
|
||||||
|
|
||||||
int Window::getMonitorIndex() {
|
int Window::getMonitorIndex() {
|
||||||
return GetCurrentMonitor();
|
return GetCurrentMonitor();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace DREAM {
|
|||||||
|
|
||||||
void setTitle(const std::string& title);
|
void setTitle(const std::string& title);
|
||||||
void setPosition(int x, int y);
|
void setPosition(int x, int y);
|
||||||
|
void centerWindow();
|
||||||
|
|
||||||
int getWidth();
|
int getWidth();
|
||||||
int getHeight();
|
int getHeight();
|
||||||
@@ -33,6 +34,9 @@ namespace DREAM {
|
|||||||
bool isVSyncEnabled();
|
bool isVSyncEnabled();
|
||||||
bool isResizable();
|
bool isResizable();
|
||||||
|
|
||||||
|
int getWindowWidth();
|
||||||
|
int getWindowHeight();
|
||||||
|
|
||||||
int getMonitorIndex();
|
int getMonitorIndex();
|
||||||
int getMonitorRefreshRate();
|
int getMonitorRefreshRate();
|
||||||
int getMonitorWidth();
|
int getMonitorWidth();
|
||||||
|
|||||||
Reference in New Issue
Block a user