[SDL] Re: Loosing control of SDL window

Patrik Opacic opacic at swipnet.se
Wed Nov 26 03:45:00 PST 2003


On Tue, 25 Nov 2003 17:45:22 -0800, Sam Lantinga <slouken at devolution.com> 
wrote:

>> I've managed to solve the problem. What I did was calling SDL_Init(0) 
>> assuming the event handling subsystems would be initialized. However it 
>> was'nt so I have to call SDL_Init() with SDL_INITVIDEO. This is not a 
>> good solution for me because the video subsystem might not be used at 
>> all. So my question now is if there is a way to initialize event 
>> handling without initializing the video subsystem. Perhaps by calling 
>> internal SDL functions? Can it be done in a way so that it does'nt 
>> create problems when later calling SDL_InitSubSystem(SDL_INITVIDEO)?
>
> Wait, how were you getting an SDL window without using SDL_INIT_VIDEO?
>
> See ya,
> 	-Sam Lantinga, Software Engineer, Blizzard Entertainment
>

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?





More information about the SDL mailing list