Hi all !
I have a little problem on using SDL as a library for an windowed
Application on X-Server with KDE as WM:
When i catch the window resize event :*
*case SDL_VIDEORESIZE : {
SDL_Rect Pos; /// Needed to call the SwitchGraphicMode function/
/// * here ?/
Pos.x = 0;
Pos.y = 0;
Pos.w = event.resize.w;
Pos.h = event.resize.h;
SwitchGraphicsMode (Pos, 32);
return;
}
I call the function SwitchGraphicsMode, which looks like this :
*
*void SwitchGraphicsMode (SDL_Rect Pos, Uint32 cmode) {
Uint32 SFormat;
SFormat = SDL_SWSURFACE | SDL_ANYFORMAT;
if (Format.isResizable)
SFormat = SFormat | SDL_RESIZABLE;
if (!(Format.isWindowed))
SFormat = SFormat | SDL_FULLSCREEN;
if (!(screen == NULL))
SDL_FreeSurface(screen);
screen = SDL_SetVideoMode (Pos.w, Pos.h, cmode, SFormat);
if (screen == NULL)
printf (“Couldn’t switch to Graphics-Mode %i x %i x %i : %s\n”,
Pos.w, Pos.h, cmode, SDL_GetError() );
}
So what happens when i e.g. maximize the window, the window is maximized
(to more than the Absolute Resolution of 1024x768) and when i restore it
it is first resized to some other resolution, before it is resized to
the former resolution. This makes the Resizing look pretty weird.
While testing this, nothing is drawn to the screen, so all I do is
resize the SDL_Surface.
Would it make sense, to enter a while-Loop at // * here ?, to check if
the Window-Resize-Event is over, before resizing the SDL_Surface ? But
then i wouldn’t be able to see the new surface during the resizing-action.
Thanx for your help,
S. G?nther