Sign in to follow this  
siliconsurfer

The Ideal Resolution for Windows and Linux (SDL)

Recommended Posts

Just wondering if anyone knows the idea resolution to run 2D games in, on full screen. I was told that Linux and Windows have differnt resolutions? Is this correct? Does SDL offer any functions for easily changing resolutions, without destroying the sprites?

Share this post


Link to post
Share on other sites
A "resolution" is just a measurement of the number of pixels the monitor is currently displaying. The two limiting factors are your graphics card (not a big deal these days most cards support crazy high resolutions), and your monitor. Most CRT Monitors either max at 1280x1024 or 1600x1200 (highend ones obviously go higher but not many people have highend CRTs). LCD monitors (17'' and up anyway) almost all run in 1280x1024.

As regards to how this effects Windows and Linux the answer is not at all really. Its all handled by your graphics driver. So for most configurations of a PC you can get the same resolutions on both OS's.

As for you second question. SDL provides a way to change from fullscreen to windowed mode on the fly in Linux but not Windows. That said I've never used it and the function definiton has it marked as experimental I believe. I don't know of anyway to tell SDL to change resolutions on the fly, however it is open source so you could probably fix that if you are adventurous.

Share this post


Link to post
Share on other sites
Quote:
I was told that Linux and Windows have differnt resolutions? Is this correct?


Not necessary; every game can use it's own resolution regardless whether it was written in C++, Delphi, Cobol, or it's target platform is Linux, Windows, Beos or is it supposed to run in fullscreen or windowed, also it's resolution is independent of monitor physical resolution.

Quote:
Does SDL offer any functions for easily changing resolutions, without destroying the sprites?


?? AFAIK sprites (that is: SDL_Surfaces) are not invalidiated when you call SDL_QuitSybsystem(SDL_VIDEO) and then SDL_InitSubsystem(SDL_Video) with new SDL_SetVideoMode settings.

Share this post


Link to post
Share on other sites
"SDL_Surfaces are not invalidiated when you call SDL_QuitSybsystem(SDL_VIDEO) and then SDL_InitSubsystem(SDL_Video) with new SDL_SetVideoMode settings."

If this is the case then switching resolutions is rather trivial... it'd be interesting to know actually. Surface can be stored in video memory though (and I believe most sprites are for speed) and if surfaces arent released when you call quitsubsystem, when are they released? (Other then explicit calls to SDL_FreeSurface)


EDIT: Did a quick test and it worked fine with my one test sprite. Heres the code.


// change to a different resolution ingame
SDL_QuitSubSystem(SDL_INIT_VIDEO);
Uint32 Flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN;
SDL_InitSubSystem(SDL_INIT_VIDEO);
pScreen = SDL_SetVideoMode(1024, 768, 32, Flags);


No idea what this would do in windowed mode.. ill test that too I guess.

EDIT #2: Yep window mode resolution changes work just as smoothly... real slick.

EDIT #3: Actually it seems the only thing you really need is the SDL_SetVideoMode call... the only downside to not reinitializing the video is that in windowed mode the window doesnt recenter itself when you just call setvideomode by itself. It does however autocenter if you reinit video mode first.

[Edited by - Illumini on December 3, 2004 5:29:26 AM]

Share this post


Link to post
Share on other sites
Well that's interesting, I wasn't sure that's possible, but after Illumini's last post I've tried doing sth similiar in SDL and it didn't worked :-/ Though I will be trying...

Share this post


Link to post
Share on other sites

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