Archived

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

rypyr

Get screen dimension with SDL?

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
I''d be able to do the DirectDraw version only...but perhaps I will. I already sent the same question to the SDL mailing list...

Regards,
Jeff


[ CodeDread ]

Share this post


Link to post
Share on other sites