-
Notifications
You must be signed in to change notification settings - Fork 127
Description
I would like to be able to set up a terminal, then later run one iteration of the update loop at a time, from a loop under my own control, rather than having to surrender control to main_loop and only get control back in my code during tick.
Naively imagined, this might involve moving the top part of main_loop into a initialization function, then the function inside el.run (the event handlers, including the one that calls tock) into a separate function. Then main_loop for hal/native would look something like this:
pub fn main_loop<GS: GameState>(mut bterm: BTerm, mut gamestate: GS) -> BResult<()> {
let el: EventLoop<()> = init_loop(bterm, gamestate);
el.run(one_tick(bterm, gamestate));
}and roughly equivalent changes in the other implementations of main_loop.
I expect it would actually be a bit more complex than this, but I hope this illustrates the idea. My goal would be to call init_loop myself, then later call one_tick once per tick in my own game loop.