package demonchime import rl "vendor:raylib" KeybindInput :: union { rl.KeyboardKey, rl.MouseButton, } Keybind :: struct { input: KeybindInput, pressed: bool, just_pressed: bool, } actions: struct { move_left: Keybind, move_right: Keybind, jump: Keybind, } init_keybinds :: proc() { actions.move_left.input = .A actions.move_right.input = .D actions.jump.input = .SPACE } is_keybind_down :: proc(keybind: Keybind) -> bool { switch val in keybind.input { case rl.KeyboardKey: return rl.IsKeyDown(val) case rl.MouseButton: return rl.IsMouseButtonDown(val) } assert(false) return false } is_keybind_just_down :: proc(keybind: Keybind) -> bool { switch val in keybind.input { case rl.KeyboardKey: return rl.IsKeyPressed(val) case rl.MouseButton: return rl.IsMouseButtonPressed(val) } assert(false) return false }