Does anybody know how to control the position of the SDL window under
Windows? I need to position it (center it on the computer screen). Then
I want the user to be able to drag it around.
The dragging part I think I can do, once I know how to position it. And
I think I have a handle to the window, but how do you move it? How do
you get Windows display resolution? Here’s how far I’ve gotten on it:
// Center the window
if (!fullscreen)
{
SDL_SysWMinfo myinfo;
Display *d;
Screen *defscr;
SDL_VERSION(&winInfo.version);
if (SDL_GetWMInfo(&winInfo))
{
printf("moving...\n");
if(info.subsystem == SDL_SYSWM_X11) {
d =
myinfo.info.x11.display;
myinfo.info.x11.lock_func();
defscr =
DefaultScreenOfDisplay(d);
XMoveWindow(d,
winInfo.info.x11.wmwindow,
(defscr->width - width) / 2,
(defscr->height - height) / 2);
myinfo.info.x11.unlock_func();
} else {
// Question: Is there any way to
test for Windows?
// Question: How do you get the
display resolution with Windows?
HWND window = winInfo.window;
// Here’s where I want to move the
window. How do you do it??
}
}
}