Get screen dimension with SDL?

Started by
4 comments, last by rypyr 20 years ago
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 ]
Advertisement
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.
-----------------------------------------------------------Web Comic
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.
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 ]
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.
[size="1"]
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 ]

This topic is closed to new replies.

Advertisement