Jump to content
  • Advertisement
Sign in to follow this  

SDL window on middle of the screen

This topic is 4900 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
//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
Nah I was searching for a multiplatform solution.
In that case I'll just make it full-screen.

Thnks for your help!


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!