Sign in to follow this  

SDL window on middle of the screen

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, Is it possible to let the window you get from SDL_SetVideoMode() start at the middle of the screen instead of just at some random place? I mean want to have a small window, with no frames in the middle of the screen. But it will just go to the top right corner of the left bottom of the screen etc. I hope someone knows a solution. Greetings, Rob

Share this post


Link to post
Share on other sites
if you want a multiplatform solution, you can't. If you want a windows-only solution then you can have a look at SDL_GetWMInfo function.


#include <SDL/SDL_syswm.h> // you must include this, as it's not
// included in SDL.h

int main(int argc,char *argv[])
{
SDL_SysWMInfo wminfo;
HWND hwnd;
//SDL initialization, main window creation, etc
//...
SDL_VERSION(&wminfo.version);
SDL_GetWMInfo(&wminfo);
hwnd=wminfo.window;
//do whatever you want with the window
}



with the HWND of the main window, you can use Win32 API functions to do whatever you want with the window.

PS: This question has been asked before, you can found the post here

Share this post


Link to post
Share on other sites

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this