[windows] Support SetPosition

This commit is contained in:
Lea Anthony
2021-06-21 19:21:25 +10:00
parent 2fc2d63e2d
commit 46ad4f4d18

View File

@@ -714,17 +714,31 @@ void SetColour(struct Application* app, int red, int green, int blue, int alpha)
}
void SetSize(struct Application* app, int width, int height) {
// TBD
if( app->maxWidth > 0 && width > app->maxWidth ) {
width = app->maxWidth;
}
if ( app->maxHeight > 0 && height > app->maxHeight ) {
height = app->maxHeight;
}
SetWindowPos(app->window, nullptr, 0, 0, width, height, SWP_NOMOVE);
}
void setPosition(struct Application* app, int x, int y) {
// TBD
HMONITOR currentMonitor = MonitorFromWindow(app->window, MONITOR_DEFAULTTONEAREST);
MONITORINFO info = {0};
info.cbSize = sizeof(info);
GetMonitorInfoA(currentMonitor, &info);
RECT workRect = info.rcWork;
LONG newX = workRect.left + x;
LONG newY = workRect.top + y;
SetWindowPos(app->window, HWND_TOP, newX, newY, 0, 0, SWP_NOSIZE);
}
void SetPosition(struct Application* app, int x, int y) {
// ON_MAIN_THREAD(
// setPosition(app, x, y);
// );
ON_MAIN_THREAD(
setPosition(app, x, y);
);
}
void Quit(struct Application* app) {
@@ -792,9 +806,6 @@ void UnFullscreen(struct Application* app) {
);
}
void ToggleFullscreen(struct Application* app) {
}
void DisableFrame(struct Application* app) {
app->frame = 0;
}