Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
c9fe252019
|
@ -53,8 +53,8 @@ fn getTab(self: *Self) MenuTab {
|
|||
}
|
||||
|
||||
pub fn tick(self: *Self) State {
|
||||
const sel = self.getSel();
|
||||
const tab = self.getTab();
|
||||
//const sel = self.getSel();
|
||||
//const tab = self.getTab();
|
||||
var key_state = SDL.getKeyboardState();
|
||||
|
||||
for (self.action_list) |*action| {
|
||||
|
@ -72,11 +72,11 @@ pub fn tick(self: *Self) State {
|
|||
action.*.call(self);
|
||||
}
|
||||
}
|
||||
std.debug.print(
|
||||
\\Tab: {s}
|
||||
\\Selection: {s}
|
||||
\\
|
||||
, .{ tab.name, sel.name });
|
||||
//std.debug.print(
|
||||
//\\Tab: {s}
|
||||
//\\Selection: {s}
|
||||
//\\
|
||||
//, .{ tab.name, sel.name });
|
||||
return self.state;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ pub fn main() !void {
|
|||
try SDL.image.init(.{ .jpg = true });
|
||||
|
||||
mainLoop: while (true) {
|
||||
const start = SDL.getTicks64();
|
||||
|
||||
while (SDL.pollEvent()) |ev| {
|
||||
switch (ev) {
|
||||
.quit => break :mainLoop,
|
||||
|
@ -26,17 +28,15 @@ pub fn main() !void {
|
|||
}
|
||||
}
|
||||
|
||||
const start = SDL.getTicks64();
|
||||
|
||||
current_state = switch (current_state) {
|
||||
.main_menu => main_menu.tick(),
|
||||
.game => game.tick(),
|
||||
};
|
||||
|
||||
|
||||
renderer.render();
|
||||
|
||||
const delay = SDL.getTicks64() - start;
|
||||
|
||||
std.debug.print("{} ms\n", .{delay});
|
||||
if (delay < 16) {
|
||||
SDL.delay(16 - @intCast(u32, delay));
|
||||
|
|
Loading…
Reference in New Issue