Checking for Window move/resize with SDL?
Moderator: Coders of Rage
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Checking for Window move/resize with SDL?
I haven't really gone out and researched, but I was wondering if anybody knew (off the top of their head) if SDL provided a way to check if the window was being moved, resized, or anything else that would pause game logic (and thus fuck up any delta-time based calculations).
Re: Checking for Window move/resize with SDL?
I looked earlier in "Focus on SDL," but I didn't find where it really talks about it.
Lazy Foo has this: Resizable Windows and Window Events
Lazy Foo has this: Resizable Windows and Window Events
Re: Checking for Window move/resize with SDL?
VIDEORESIZE event for resizes and I think, not entirely sure, but I think that VIDEOEXPOSE event will take care of moving the window.
As far as I know, a VIDEOEXPOSE event is called when something modifies the screen outside of the game/app... so I think that it would work.
Here's the event structures if you need them:
Hope that helps =D.
As far as I know, a VIDEOEXPOSE event is called when something modifies the screen outside of the game/app... so I think that it would work.
Here's the event structures if you need them:
Code: Select all
//VIDEOEXPOSE
typedef struct{
Uint8 type
} SDL_ExposeEvent;
//VIDEORESIZE
typedef struct{
Uint8 type;
int w, h;
} SDL_ResizeEvent;
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Checking for Window move/resize with SDL?
If you try to resize the actual screen surface in SDL on Windows, you will have to reinitialize your entire OpenGL system. If your goal is to just detect it, then disregard this.http://sdl.beuc.net/sdl.wiki/SDL_SetVideoMode wrote:Also note that, in Windows, setting the video mode resets the current OpenGL context. You must execute again the OpenGL initialization code (set the clear color or the shade model, or reload textures, for example) after calling SDL_SetVideoMode. In Linux, however, it works fine, and the initialization code only needs to be executed after the first call to SDL_SetVideoMode (although there is no harm in executing the initialization code after each call to SDL_SetVideoMode, for example for a multiplatform application).
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: Checking for Window move/resize with SDL?
I'm sure it has something to do with an SDL_Event...
- TheBuzzSaw
- Chaos Rift Junior
- Posts: 310
- Joined: Wed Dec 02, 2009 3:55 pm
- Current Project: Paroxysm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Contact:
Re: Checking for Window move/resize with SDL?
If your event.type == SDL_VIDEORESIZE, the window has been resized.
I'm not sure if there is a way to see if the window is moving, but you might be able to form a workaround using SDL_APPINPUTFOCUS.
I'm not sure if there is a way to see if the window is moving, but you might be able to form a workaround using SDL_APPINPUTFOCUS.