Does SDL know size of SDL_FULLSCREEN?

Posts: 321
Joined: 2004.10
Post: #1
My program is creating a full screen, but my rendering is still just doing the 1000x1000. Is there a way that I can query SDL so that it will tell me the size of
its full screen? Or am I just suppose to know ahead of time what sizes to use?

height = 1000;
width = 1000;

drawContext = SDL_SetVideoMode(height, width, 0, flags);
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
SDL has a mechanism for listing video modes, which you should be using to choose your window size. I'm sure it also has a mechanism for retrieving the current window size. You should read the documentation!

[edit]I found specific answers within the first 20 seconds of looking at the documentation page[/edit]
Quote this message in a reply
Posts: 72
Joined: 2006.10
Post: #3
You can use SDL_VideoInfo() wich, if called before SDL_SetVideoMode(), returns info about the desktop video mode.

const SDL_VideoInfo * lInfo = SDL_GetVideoInfo(void);

height = lInfo->current_w ;
width =  lInfo->current_h ;

Wich would set a context in the current resolution. There must be a more elegant way to do this, but my SDL memories are a bit foggy.
Quote this message in a reply
Posts: 320
Joined: 2003.06
Post: #4
I think sohta answered your question, but the mechanism OSC was talking about is probably SDL_ListModes and my implementation looks like this:

    if(modes == (SDL_Rect **)0)
        printf("No fullscreen display modes available!\n");
        for(int i=0; modes[i]; ++i)
            DisplayMode displayMode;
            displayMode.width = modes[i]->w;
            displayMode.height = modes[i]->h;

Chopper, iSight Screensavers, DuckDuckDuck:
Quote this message in a reply
Post Reply