[SDL] Loosing control of SDL window
slouken at devolution.com
Wed Nov 26 07:56:01 PST 2003
> What I have is a couple of singletons for handling video, keyboard, mouse
> etc. The SDL window is created only if the video singleton is instanced
> (the constructor of the video singleton calls
> SDL_InitSubSystem(SDL_INIT_VIDEO), SDL_SetVideoMode() and
> SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE), among other things).
> SDL_Init(0) is always called at the beginning of the program and
> SDL_EventState() is then used to disable all events. I guess this is
> causing the problem because the SDL event handling is'nt initialized yet.
> So I wonder if there is a way of only initializing the event handling
> without initializing the video subsystem.. SDL_Init(SDL_INIT_EVENTTHREAD)
> does'nt seem to do anything and it's not portable anyway. Is it a large
> overhead of calling SDL_Init(SDL_INIT_VIDEO) even if the video subsystem
> is'nt used?
Ah, I see. Since you can only get keyboard and mouse input from a window
created by SDL, the event subsystem is only initialized when the video
subsystem is. However, we can certainly initialize the core event queue
separately if it makes sense to do so...
-Sam Lantinga, Software Engineer, Blizzard Entertainment
More information about the SDL