Maximum width and height

Is there any way to get SDL to tell you the maximum width and height
that you can make a window? I want to know the width and height to
pass to SDL_SetVideoMode() when I start an app or go to fullscreen
mode with SDL_WM_ToggleFullScreen().

  • Terry

Hello !

Is there any way to get SDL to tell you the maximum width and height
that you can make a window? I want to know the width and height to
pass to SDL_SetVideoMode() when I start an app or go to fullscreen
mode with SDL_WM_ToggleFullScreen().

Use SDL_SetVideoMode with Width=0 and Height=0.

Look at this :

http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fSetVideoMode

CU

Hi again,
Thanks for the reply Torsten. Unfortunately I’m still having trouble.
I’m using SDL 1.2.11. If I pass 0 for both width and height to
SDL_SetVideoMode() I use my full display resolution the first time.
But if I resize the display to something smaller and then try to go to
fullscreen again, I end up with the smaller display size. In other
words:

surface = SDL_SetVideoMode(0, 0, 32, SDL_OPENGL | SDL_RESIZABLE |
SDL_FULLSCREEN);

surface->w is 1280
surface->h is 1024

surface = SDL_SetVideoMode(800, 600, 32, SDL_OPENGL | SDL_RESIZABLE);

surface->w is 800
surface->h is 600

surface = SDL_SetVideoMode(0, 0, 32, SDL_OPENGL | SDL_RESIZABLE |
SDL_FULLSCREEN);

surface->w is 800
surface->h is 600

SDL_GetVideoInfo() reports the same numbers as my SDL_Surface. Any
other suggestions? I suppose I could start my app in fullscreen mode
and save the original dimensions for later use, but I would prefer to
start it in a smaller window.

  • Terry> Message: 5

Date: Sun, 28 Oct 2007 00:00:22 +0200
From: “Torsten Giebl”
Subject: Re: [SDL] maximum width and height
To: “A list for developers using the SDL library. (includes
SDL-announce)”
Message-ID:

Content-Type: text/plain; charset=ISO-8859-1

Hello !

Is there any way to get SDL to tell you the maximum width and height
that you can make a window? I want to know the width and height to
pass to SDL_SetVideoMode() when I start an app or go to fullscreen
mode with SDL_WM_ToggleFullScreen().

Use SDL_SetVideoMode with Width=0 and Height=0.

Look at this :

http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fSetVideoMode

CU

SDL_GetVideoInfo() reports the same numbers as my SDL_Surface. Any
other suggestions? I suppose I could start my app in fullscreen mode
and save the original dimensions for later use, but I would prefer to
start it in a smaller window.

How about using SDL_ListModes with SDL_FULLSCREEN in the flags?Am Sunday, dem 28. Oct 2007 schrieb Terry Welsh:


AKFoerster

Hello !

Thanks for the reply Torsten. Unfortunately I’m still having trouble.
I’m using SDL 1.2.11.

Please use SDL 1.2.12 if possible.

CU

Hi,
1.2.12 behaves the same as 1.2.11. SDL_ListModes seems to do the
trick. I’ll use that for now:

int fullX = 0;
int fullY = 0;
SDL_Rect **modes;
modes = SDL_ListModes(NULL, SDL_FULLSCREEN /| SDL_HWSURFACE/);
if(modes != (SDL_Rect **)0 && modes != (SDL_Rect **)-1){
// zeros should work, but don’t
fullX = modes[0]->w;
fullY = modes[0]->h;
}–
Terry Welsh - mogumbo ‘at’ gmail.com
www.reallyslick.com | www.mogumbo.com

Message: 4
Date: Mon, 29 Oct 2007 07:40:38 +0100
From: list at akfoerster.de
Subject: Re: [SDL] maximum width and height
To: “A list for developers using the SDL library. (includes
SDL-announce)”
Message-ID: <20071029064038.GA3383 at castrophe.akfoerster.de>
Content-Type: text/plain; charset=us-ascii

Am Sunday, dem 28. Oct 2007 schrieb Terry Welsh:

SDL_GetVideoInfo() reports the same numbers as my SDL_Surface. Any
other suggestions? I suppose I could start my app in fullscreen mode
and save the original dimensions for later use, but I would prefer to
start it in a smaller window.

How about using SDL_ListModes with SDL_FULLSCREEN in the flags?


AKFoerster

If you’re going to do that, do it with the caveat in mind that the
largest fullscreen resolution is not always the best. (For example,
while my CRT supports up to 2048x1280, at 60Hz I don’t necessarily
want anything going that high.)
-:sigma.SBOn 10/30/07, Terry Welsh wrote:

fullX = modes[0]->w;
fullY = modes[0]->h;

Hi SB,
Well, the fullscreen resolution I get this way is 1280x1024 because
that’s what my display is running at when I start my app. My CRT can
also run at a much higher resolution, but it isn’t detected by this
method. Is that what you were worried about?

Eventually I’ll want the user to be able to change between different
fullscreen resolutions, but just switching between windowed and
fullscreen right now is very nice for development.–
Terry Welsh - mogumbo ‘at’ gmail.com
www.reallyslick.com | www.mogumbo.com

Message: 1
Date: Wed, 31 Oct 2007 04:37:05 +0000
From: “Solra Bizna”
Subject: Re: [SDL] maximum width and height
To: “A list for developers using the SDL library. (includes
SDL-announce)”
Message-ID:

Content-Type: text/plain; charset=UTF-8

On 10/30/07, Terry Welsh <@Terry_Welsh> wrote:

fullX = modes[0]->w;
fullY = modes[0]->h;
If you’re going to do that, do it with the caveat in mind that the
largest fullscreen resolution is not always the best. (For example,
while my CRT supports up to 2048x1280, at 60Hz I don’t necessarily
want anything going that high.)
-:sigma.SB

Well, the fullscreen resolution I get this way is 1280x1024 because
that’s what my display is running at when I start my app. My CRT can
also run at a much higher resolution, but it isn’t detected by this
method. Is that what you were worried about?
Yeah, but that behavior seems a little weird to me. ListModes is
supposed to return the list of possible modes, sorted largest to
smallest. Maybe 1280x1024 is the largest your card can support at your
bit depth?
Eventually I’ll want the user to be able to change between different
fullscreen resolutions, but just switching between windowed and
fullscreen right now is very nice for development.
Anything goes if it’s for “development” purposes, just remember to fix
it later. :wink:

It’s worth noting that GetVideoInfo will return the current "real"
video mode if you call it before a SetVideoMode.
-:sigma.SBOn 10/31/07, Terry Welsh wrote: