aboutsummaryrefslogtreecommitdiff
path: root/src/input.odin
blob: 0cd2c9183da1a741600ca06d5c8fdf2ff41793e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package demonchime

import fw "fw"

actions: struct {
  move_left: fw.Keybind,
  move_right: fw.Keybind,

  aim_left: fw.Keybind,
  aim_right: fw.Keybind,
  aim_up: fw.Keybind,
  aim_down: 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.aim_left.input = .A
  actions.aim_right.input = .D
  actions.aim_up.input = .W
  actions.aim_down.input = .S
  actions.jump.input = .Space
  actions.dash.input = .Left_Shift
  actions.shoot.input = .J
  actions.toggle_debug_mode.input = .T
  actions.toggle_fullscreen.input = .F11
  actions.exit.input = .Escape
}

update_keybinds :: proc() {
  fw.update_keybind(&actions.move_left)
  fw.update_keybind(&actions.move_right)
  fw.update_keybind(&actions.aim_left)
  fw.update_keybind(&actions.aim_right)
  fw.update_keybind(&actions.aim_up)
  fw.update_keybind(&actions.aim_down)
  fw.update_keybind(&actions.jump)
  fw.update_keybind(&actions.dash)
  fw.update_keybind(&actions.shoot)
  fw.update_keybind(&actions.toggle_debug_mode)
  fw.update_keybind(&actions.toggle_fullscreen)
  fw.update_keybind(&actions.exit)
}