On pg. 107, there’s a prompting to remove some code from tick
to leave it a “simple stub”:
impl GameState for State {
fn tick(&mut self, ctx: &mut BTerm) {
ctx.set_active_console(0);
ctx.cls();
ctx.set_active_console(1);
ctx.cls();
}
}
That is simple enough, it’s true. But by the page 112 rolls around, there is a new implementation.
impl GameState for State {
fn tick(&mut self, ctx: &mut BTerm) {
ctx.cls();
self.resources.insert(ctx.key);
self.systems.execute(&mut self.ecs, &mut self.resources);
}
}
Since the user hasn’t been asked to run in the interim, it would seem that the simple stub could be even simpler.
impl GameState for State {
fn tick(&mut self, ctx: &mut BTerm) {
ctx.cls();
}
}
This makes the pg. 112 addition additive only. In this reader’s experience, I’ve worked a lot with ctx.cls();
at this point, but only had one touch point with the active console idea, which I’m now asked to replace without that same comfort level. If the idea is only to have a simple stub, perhaps it can be simpler!
Thanks!