input debugger
This commit is contained in:
parent
1175088712
commit
20e0c1b3ee
|
|
@ -31,7 +31,7 @@ pub fn convertEvent(event: *const sdl3.Event) ?IOEvent {
|
|||
.key = .{
|
||||
.key = scan,
|
||||
.scancode = scan,
|
||||
.action = if (event.key.down) .keyDown else .keyUp,
|
||||
.action = if (event.button.down) .keyDown else .keyUp,
|
||||
.mods = 0,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,3 +96,4 @@ const std = @import("std");
|
|||
const backlog = @import("Backlog");
|
||||
const core = backlog.core;
|
||||
const rend = backlog.rend;
|
||||
const ig = backlog.imgui.api;
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
pub const FpCamera = @import("FpCamera.zig");
|
||||
|
||||
pub const inputDebugger = @import("inputDebugger.zig");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
allocator: std.mem.Allocator,
|
||||
|
||||
fn log(comptime fmt: []const u8, args: anytype) void {
|
||||
core.engine_log("[InputDebugger] " ++ fmt, args);
|
||||
}
|
||||
|
||||
fn debugShowKeys(binding: anytype) void {
|
||||
ig.textFmt("{s} ({s}) keysDown count: {d}", .{ binding.data.name.utf8(), @typeName(@TypeOf(binding)), binding.data.keysDown.count() }) catch return;
|
||||
}
|
||||
|
||||
pub fn tick() void {
|
||||
const stack = core.inputs.getInputStack();
|
||||
if (ig.begin("input stack", null, .{})) {
|
||||
for (stack.active.bindingStack.items) |binding| {
|
||||
switch (binding) {
|
||||
.action => |b| {
|
||||
debugShowKeys(b);
|
||||
},
|
||||
.axis1d => |b| {
|
||||
debugShowKeys(b);
|
||||
},
|
||||
.axis2d => |b| {
|
||||
debugShowKeys(b);
|
||||
},
|
||||
}
|
||||
}
|
||||
ig.end();
|
||||
}
|
||||
}
|
||||
|
||||
const std = @import("std");
|
||||
const backlog = @import("Backlog");
|
||||
const core = backlog.core;
|
||||
const rend = backlog.rend;
|
||||
const ig = backlog.imgui.api;
|
||||
|
|
@ -292,6 +292,7 @@ pub fn getMouseMovement(self: *@This()) core.Vector2f {
|
|||
pub fn tick(self: *@This(), dt: f64) void {
|
||||
const fdt: f32 = @floatCast(dt);
|
||||
|
||||
extras.inputDebugger.tick();
|
||||
self.videoplayer.tick(dt);
|
||||
self.doomplayer.tick(dt);
|
||||
self.fpcamera.tick(dt);
|
||||
|
|
@ -354,7 +355,8 @@ pub fn main() anyerror!void {
|
|||
|
||||
const DoomPlayer = @import("doomplayer");
|
||||
const VideoPlayer = @import("videoplayer");
|
||||
const FpCamera = @import("gameExtras").FpCamera;
|
||||
const extras = @import("gameExtras");
|
||||
const FpCamera = extras.FpCamera;
|
||||
const std = @import("std");
|
||||
const backlog = @import("Backlog");
|
||||
const assets = backlog.assets;
|
||||
|
|
|
|||
Loading…
Reference in New Issue