Hi folks,
could anybody be so kind as to tell me how to run a SDL program in
FULLSCREEN MODE. I mean, putting such an option at compile time you
know.
Thanks
Olli
Hi folks,
could anybody be so kind as to tell me how to run a SDL program in
FULLSCREEN MODE. I mean, putting such an option at compile time you
know.
Thanks
Olli
Pass SDL_FULLSCREEN as one of the flags to SDL_SetVideoMode. i.e to set a
640x480x16bpp display:
SDL_Surface *screen;
/* Might want to check to see if this is a valid mode for your hardware
first… */
screen = SDL_SetVideoMode ( 640, 480, 16, SDL_SWSURFACE | SDL_FULLSCREEN );
If you wanted to determine full screen/windowed operation at compile time,
use a #define macro something like APP_FULLSCREEN. Your code would look
like:
SDL_Surface *screen;
/* If the APP_FULLSCREEN is defined, then make the window full screen,
otherwise use normal windowed operation /
#ifdef APP_FULLSCREEN
screen = SDL_SetVideoMode ( 640, 480, 16, SDL_SWSURFACE |
SDL_FULLSCREEN);
#else
screen = SDL_SetVideoMode ( 640, 480, 16, SDL_SWSURFACE );
#endif / APP_FULLSCREEN
Then, when you compile your app with gcc, pass a parameter -DAPP_FULLSCREEN
to compile with the full screen code, otherwise it will compile with the
normal “windowed” code. Or, you can have a #define APP_FULLSCREEN in a
header file, but defining it on the gcc command line (in this case) looks a
bit cleaner.
'Course, probably an easier way, but this works
A more versatile way of full screen/windowed operation would be to use a
command line parameter to switch between the two. That way no recompilation
is neccessary
cheers,
Dave “PenguinDude” Archbold
davea at radiks.netOn Monday, February 21, 2000 9:00 AM, Oliver van Porten [SMTP:OvanPorten at gmx.net] wrote:
Hi folks,
could anybody be so kind as to tell me how to run a SDL program in
FULLSCREEN MODE. I mean, putting such an option at compile time you
know.
To select fullscreen you pass the SDL_FULLSCREEN-flag to SDL_SetVideoMode,
like so:
screenpointer = SDL_SetVideoMode(640, 480, 8, someotherflags | SDL_FULLSCREEN);
If you want to make the decision at compile-time (you can also choose it at
run-time, with a command-line-parameter for example) you just have two
SDL_SetVideoModes, one with SDL_FULLSCREEN the other without and choose
between them with #ifdef:
#ifdef MYFULLSCREEN
s = SDL_SetVideoMode(640, 480, 8, SDL_FULLSCREEN);
#else
s = SDL_SetVideoMode(640, 480, 8, 0);
#endif
In the case that you did not write the program in question yourself then
perhaps it does not support fullscreen, then there is of course no option
to select it. Your would have to change it yourself to include the
SDL_FULLSCREEN flag.
All the best,
robOn Mon, Feb 21, 2000 at 03:59:36PM +0100, Oliver van Porten wrote:
Hi folks,
could anybody be so kind as to tell me how to run a SDL program in
FULLSCREEN MODE. I mean, putting such an option at compile time you
know.