I’ve been trying without success to change to a fullscreen video mode
MATCHING the current screen resolution. Where can I get this
information through SDL? I know it stores it somewhere because it
remembers what resolution to return to after you quit.
Any way to access it?
There are some functions like GetVideoSurface which seem to make
sense, but you get a null until the video mode is set and then you are
getting SDL’s new window res not the screen res. Thanks, in advance.
Aaron
Hi Aaron.
I have this code for test what resolution have my monitor:
--------------------- code -----------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include “SDL.h”
int main()
{
SDL_Surface *pantalla;
SDL_Rect **modes;
int i;
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr, “Can’t open SDL: %s\n”, SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
if ((pantalla = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE)) == NULL)
{
fprintf(stderr, “Can’t create window: %s\n”, SDL_GetError());
exit(2);
}
/* Get available fullscreen/hardware modes */
modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_SWSURFACE);
/* Check is there are any modes available */
if (modes == (SDL_Rect **)0)
{
printf(“No modes available! \n”);
exit(-1);
}
/* Check if or resolution is restricted */
if (modes == (SDL_Rect *) - 1)
{
printf(“All resolutions available. \n”);
}
else
{
/ Print valid modes */
printf(“Available Modes \n”);
for (i = 0; modes[i]; ++i)
printf(" %d x %d\n", modes[i]->w, modes[i]->h);
}
SDL_UpdateRect(pantalla, 0, 0, 0, 0);
exit(0);
}
--------------------- code -----------------------
The matter is the function SDL_ListModes() that
can back to you the resolution.
I hope this can be useful for you and others.
Regards.
Jose.
http://www.lordofunix.org
Registered BSD User 51101.
Registered Linux User #213309.
Memories… You are talking about memories.
Rick Deckard. Blade Runner.----------------------------------
Tu correo gratuito 10 MB en http://www.geomundos.com
Tambi?n acceso a Internet, chat, titulares… ?Pru?balo!
Nuevo: Las mejores ofertas en http://compras.geomundos.com