aboutsummaryrefslogtreecommitdiff
path: root/src/input.odin
diff options
context:
space:
mode:
authoriamcheeseman <[hidden email]>2026-02-03 22:25:00 -0500
committeriamcheeseman <[hidden email]>2026-02-03 22:25:00 -0500
commit3d1d31538d30a7f161f9f2b6d5e075ec69d3b860 (patch)
tree8b0deceb38c288dbef361bb4f77bb681b5566525 /src/input.odin
parent1c605da3ff8dc4295d2f9a85f5b7c8891ca84464 (diff)
ditch raylib (icky, and for loser BEGINNERS)
Diffstat (limited to 'src/input.odin')
-rw-r--r--src/input.odin72
1 files changed, 15 insertions, 57 deletions
diff --git a/src/input.odin b/src/input.odin
index 8326564..ee90fcd 100644
--- a/src/input.odin
+++ b/src/input.odin
@@ -1,67 +1,25 @@
package demonchime
-import rl "vendor:raylib"
-
-KeyboardInput :: union {
- rl.KeyboardKey,
- rl.MouseButton,
-}
-
-ControllerInput :: union {
-}
-
-Keybind :: struct {
- input: KeyboardInput,
- pressed: bool,
- just_pressed: bool,
-}
+import fw "fw"
actions: struct {
- move_left: Keybind,
- move_right: Keybind,
- jump: Keybind,
- dash: Keybind,
- shoot: Keybind,
- toggle_debug_mode: Keybind,
+ move_left: fw.Keybind,
+ move_right: fw.Keybind,
+ jump: fw.Keybind,
+ dash: fw.Keybind,
+ shoot: fw.Keybind,
+ toggle_debug_mode: fw.Keybind,
+ toggle_fullscreen: fw.Keybind,
+ exit: fw.Keybind,
}
init_keybinds :: proc() {
actions.move_left.input = .A
actions.move_right.input = .D
- actions.jump.input = .SPACE
- actions.dash.input = .LEFT_SHIFT
- actions.shoot.input = rl.MouseButton.LEFT
- actions.toggle_debug_mode.input = .GRAVE
-}
-
-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
-}
-
-get_mouse_pos :: proc() -> (mouse_pos: Vec2) {
- mouse_pos = Vec2{f32(rl.GetMouseX()), f32(rl.GetMouseY())}
- mouse_pos /= Vec2{f32(rl.GetScreenWidth()), f32(rl.GetScreenHeight())}
- mouse_pos *= SCREEN_SIZE
- mouse_pos += state.camera.target
- return
+ actions.jump.input = .Space
+ actions.dash.input = .Left_Shift
+ actions.shoot.input = fw.Mouse_Button.Left
+ actions.toggle_debug_mode.input = .T
+ actions.toggle_fullscreen.input = .F11
+ actions.exit.input = .Escape
}