SDL_Init(SDL_VIDEO)
mustbe made on the main thread (same thing forSDL_Shutdown
?)SDL_PumpEvents
andSDL_PollEvent
must be made on the thread that didSDL_Init(SDL_VIDEO)
- We want to show a splash screen as soon as the game starts and continue pumping events while the game starts (if we do not pump events, some window managers will believe the program froze and make a popup appear).
- Same thing, when the map loads we want to continue pumping events
- Functions used outside of
sdl_input.cpp
:IN_Frame
IN_Init
IN_Shutdown
In_Restart_f
It seems the main file that will change will be sdl_input.cpp
, its role is to fill the event queue Q that is consumed in Com_Frame
. The input thread will instead of filling directly Q, put events in a shared mutexed queue S whose content is dequeued in Com_Frame
to go in Q. However IN_Frame and potentially other functions will need to be synchronous. SDL supports inserting custom events in the queue, we can use that to insert functions pointers that will be ran on the input thread.
- Put the mouse coordinates in a global variable so that the renderer can sample it just before it starts rendering and shift the frustum by the right amount? (what about 2d things that follow 3d things?)
- Make it handle the network as well?