core: simplify event iterator

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-08-25 16:51:16 -07:00
parent 8b8489b3e2
commit 09d39fb694
13 changed files with 46 additions and 74 deletions

View file

@ -71,8 +71,7 @@ fn init(app: *Mod, core: *mach.Core.Mod) !void {
}
fn tick(core: *mach.Core.Mod, app: *Mod) !void {
var iter = core.state().pollEvents();
while (iter.next()) |event| {
while (core.state().nextEvent()) |event| {
switch (event) {
.close => core.schedule(.exit), // Tell mach.Core to exit the app
else => {},

View file

@ -71,8 +71,7 @@ fn init(app: *Mod, core: *mach.Core.Mod) !void {
}
fn tick(core: *mach.Core.Mod, app: *Mod) !void {
var iter = core.state().pollEvents();
while (iter.next()) |event| {
while (core.state().nextEvent()) |event| {
switch (event) {
.close => core.schedule(.exit), // Tell mach.Core to exit the app
else => {},