cage icon indicating copy to clipboard operation
cage copied to clipboard

Android App life Cicle

Open dmalves opened this issue 9 years ago • 4 comments

where in the sample codes should I handle app specific events like

SDL_APP_WILLENTERBACKGROUND?

dmalves avatar Jan 12 '16 05:01 dmalves

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).

rlofc avatar Jan 13 '16 00:01 rlofc

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.

dmalves avatar Jan 13 '16 15:01 dmalves

Done, see: https://github.com/rlofc/cage/commit/e71d8652135c3ac8aeb4731342b045f2258166b7

rlofc avatar Jan 20 '16 09:01 rlofc

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.

rlofc avatar Feb 07 '16 20:02 rlofc