aboutsummaryrefslogtreecommitdiff
path: root/src/input.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.odin')
-rw-r--r--src/input.odin9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/input.odin b/src/input.odin
index 475be92..0b1d56e 100644
--- a/src/input.odin
+++ b/src/input.odin
@@ -18,6 +18,7 @@ actions: struct {
move_right: Keybind,
jump: Keybind,
dash: Keybind,
+ shoot: Keybind,
}
init_keybinds :: proc() {
@@ -25,6 +26,7 @@ init_keybinds :: proc() {
actions.move_right.input = .D
actions.jump.input = .SPACE
actions.dash.input = .LEFT_SHIFT
+ actions.shoot.input = rl.MouseButton.LEFT
}
is_keybind_down :: proc(keybind: Keybind) -> bool {
@@ -50,3 +52,10 @@ is_keybind_just_down :: proc(keybind: Keybind) -> bool {
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
+ return
+}