cage
cage copied to clipboard
Android App life Cicle
where in the sample codes should I handle app specific events like
SDL_APP_WILLENTERBACKGROUND?
Currently, Cage lacks support for this. In fact, it directly polls for events in the main loop: https://github.com/rlofc/cage/blob/master/src/cage.c#L216 only to handle SDL_QUIT. Not cool and should be fixed.
I see two options: (a) You can own SDL_PollEvent() in your game updating callback and handle any SDL event you want or (b) Cage will internally capture SDL events. It will then export game_loop_ex, taking in another argument with a (long) set of optional event callbacks.
I'm leaning towards option (a).
Yes, I thougth I was missing something. I saw that only SDL_QUIT was handled on cage.c, but I could be missing something. Anyway, option (a) is a good think, because it keeps cage as a thin layer above SDL2.
Done, see: https://github.com/rlofc/cage/commit/e71d8652135c3ac8aeb4731342b045f2258166b7
Reopening since this is breaking in Android when app is moving to the background (screen is not refreshing and stays blank). I need to experiment with the SDL event pipeline more before I can safely say this is done.