Archived

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

swiych

Force no emulation?

Recommended Posts

swiych    122
I'm new to SDL and I'm very impressed with the fact that it's portable and its elegance and simplicity compared to WIN32. I used the example program from the SDL site ( 2-8. SDL and OpenGL ). From what I've read and observed while running this example, SDL can emulate whatever screen size you give it so setting a width of 102 and a height of 768 works. I want this program to only use a valid hardware resolution and the minimum color depth must be 16 bit. So I modified the code slightly. It seems to work and when I enter arbitrary widths and heights it fails. Is this a fullproof method? I've only tested it on Win2K Pro. width = 1024; height = 768; bpp = info->vfmt->BitsPerPixel; cout << "Color depth = " << bpp << " bit"; // not neccessary just outputs the color depth to stdout.txt if ( bpp <16) { cerr << "Desktop color depth must be at least 16 bit ( High Color )"; quit_tutorial( 1 ); } bpp=SDL_VideoModeOK(1024, 768, 32, SDL_FULLSCREEN); // no emulation if resolution is unsupported if(!bpp) { cerr << "Mode not available.\n"; quit_tutorial ( 1 ); }

Share this post


Link to post
Share on other sites
obj63    122
yeah that should be fine the way you have it. If your code is compiled with ANSI standards it can be ported to any OS''s compiler so if you want it to be 100% full proof this is the only way to do it. You also must have the correct libraries installed on that OS as well.

For your question though the exe should work on all windows OS 95 and up.

Share this post


Link to post
Share on other sites