Archived

This topic is now archived and is closed to further replies.

Get screen dimension with SDL?

This topic is 4981 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

I would like to get the current width, height and bits-per-pixel of the system at the moment the application is run via SDL. Is there a way? (This would be prior to me calling SetVideoMode()). The reason I want this? I want to display a splash screen that is sized as a percentage of the existing desktop prior to setting the display mode myself. Thanks, /jeff
[ CodeDread ]

Share this post


Link to post
Share on other sites
prior to setting the display mode (with SDL), i think you should use the native API calls (i mean, if you are in windows, use the windows API, for BeOS use the BeOS API, and so on). i can''t think of anything else right now.
if you are using windows, look in msdn (or just google) for the functions to retrieve the screen width and height.
hope it helps.

Share this post


Link to post
Share on other sites
In Windows you can use the GetSystemMetrics() function to get the size of the screen. SM_CXSCREEN and SM_CYSCREEN are the flags you should use. It will return the screen size in pixels.

Share this post


Link to post
Share on other sites
Right. What I was hoping was that there is an SDL way of doing it (i.e. platform-independent). I can enumerate the display modes after initing SDL, I just can''t find out the current display mode. Kinda silly if you ask me.

Regards,
Jeff


[ CodeDread ]

Share this post


Link to post
Share on other sites
Yeah, would be handy if there was something like that in SDL.

Why don''t you work out platform specific versions and submit the code to SDL to improve it for all? Shouldn''t be too hard, and it''d be handy.

Share this post


Link to post
Share on other sites