annotate semiconginev2/input.nim @ 1254:b0f4c8ccd49a

did: stuff to test gltf importer
author sam <sam@basx.dev>
date Sat, 27 Jul 2024 20:47:54 +0700
parents 56781cc0fc7c
children bfb75c934f4e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1199
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
1 type
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
2 Input = object
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
3 keyIsDown: set[Key]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
4 keyWasPressed: set[Key]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
5 keyWasReleased: set[Key]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
6 mouseIsDown: set[MouseButton]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
7 mouseWasPressed: set[MouseButton]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
8 mouseWasReleased: set[MouseButton]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
9 mousePosition: Vec2f
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
10 mouseMove: Vec2f
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
11 mouseWheel: float32
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
12 windowWasResized: bool = true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
13 windowIsMinimized: bool = false
1254
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
14 lockMouse: bool = false
1199
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
15
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
16 # warning, shit is not thread safe
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
17 var input: Input
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
18
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
19 proc UpdateInputs*(): bool =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
20 # reset input states
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
21 input.keyWasPressed = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
22 input.keyWasReleased = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
23 input.mouseWasPressed = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
24 input.mouseWasReleased = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
25 input.mouseWheel = 0
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
26 input.mouseMove = NewVec2f()
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
27 input.windowWasResized = false
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
28
1254
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
29 if input.lockMouse:
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
30 SetMousePosition(vulkan.window, x=int(vulkan.swapchain.width div 2), y=int(vulkan.swapchain.height div 2))
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
31
1199
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
32 var killed = false
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
33 for event in vulkan.window.PendingEvents():
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
34 case event.eventType:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
35 of Quit:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
36 killed = true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
37 of ResizedWindow:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
38 input.windowWasResized = true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
39 of KeyPressed:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
40 input.keyWasPressed.incl event.key
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
41 input.keyIsDown.incl event.key
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
42 of KeyReleased:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
43 input.keyWasReleased.incl event.key
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
44 input.keyIsDown.excl event.key
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
45 of MousePressed:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
46 input.mouseWasPressed.incl event.button
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
47 input.mouseIsDown.incl event.button
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
48 of MouseReleased:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
49 input.mouseWasReleased.incl event.button
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
50 input.mouseIsDown.excl event.button
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
51 of MouseMoved:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
52 let newPos = NewVec2(float32(event.x), float32(event.y))
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
53 input.mouseMove = newPos - input.mousePosition
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
54 input.mousePosition = newPos
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
55 of MouseWheel:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
56 input.mouseWheel = event.amount
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
57 of MinimizedWindow:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
58 input.windowIsMinimized = true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
59 of RestoredWindow:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
60 input.windowIsMinimized = false
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
61
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
62 return not killed
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
63
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
64 proc KeyIsDown*(key: Key): bool = key in input.keyIsDown
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
65 proc KeyWasPressed*(key: Key): bool = key in input.keyWasPressed
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
66 proc KeyWasPressed*(): bool = input.keyWasPressed.len > 0
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
67 proc KeyWasReleased*(key: Key): bool = key in input.keyWasReleased
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
68 proc MouseIsDown*(button: MouseButton): bool = button in input.mouseIsDown
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
69 proc MouseWasPressed*(): bool = input.mouseWasPressed.len > 0
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
70 proc MouseWasPressed*(button: MouseButton): bool = button in input.mouseWasPressed
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
71 proc MousePressedButtons*(): set[MouseButton] = input.mouseWasPressed
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
72 proc MouseWasReleased*(): bool = input.mouseWasReleased.len > 0
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
73 proc MouseWasReleased*(button: MouseButton): bool = button in input.mouseWasReleased
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
74 proc MouseReleasedButtons*(): set[MouseButton] = input.mouseWasReleased
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
75 proc MousePosition*(): Vec2f = input.mousePosition
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
76 proc MousePositionNormalized*(size: (int, int)): Vec2f =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
77 result.x = (input.mousePosition.x / float32(size[0])) * 2.0 - 1.0
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
78 result.y = (input.mousePosition.y / float32(size[1])) * 2.0 - 1.0
1254
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
79 proc MouseMove*(): Vec2f = input.mouseMove
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
80 proc MouseWheel*(): float32 = input.mouseWheel
1199
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
81 proc WindowWasResized*(): auto = input.windowWasResized
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
82 proc WindowIsMinimized*(): auto = input.windowIsMinimized
1254
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
83 proc LockMouse*(value: bool) = input.lockMouse = value
b0f4c8ccd49a did: stuff to test gltf importer
sam <sam@basx.dev>
parents: 1218
diff changeset
84
1199
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
85
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
86 # actions as a slight abstraction over raw input
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
87
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
88 type
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
89 ActionMap = object
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
90 keyActions: Table[string, set[Key]]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
91 mouseActions: Table[string, set[MouseButton]]
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
92
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
93 # warning, shit is not thread safe
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
94 var actionMap: ActionMap
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
95
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
96 proc MapAction*[T: enum](action: T, key: Key) =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
97 if not actionMap.keyActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
98 actionMap.keyActions[$action] = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
99 actionMap.keyActions[$action].incl key
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
100
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
101 proc MapAction*[T: enum](action: T, button: MouseButton) =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
102 if not actionMap.mouseActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
103 actionMap.mouseActions[$action] = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
104 actionMap.mouseActions[$action].incl button
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
105
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
106 proc MapAction*[T: enum](action: T, keys: openArray[Key|MouseButton]) =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
107 for key in keys:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
108 MapAction(action, key)
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
109
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
110 proc UnmapAction*[T: enum](action: T, key: Key) =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
111 if actionMap.keyActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
112 actionMap.keyActions[$action].excl(key)
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
113
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
114 proc UnmapAction*[T: enum](action: T, button: MouseButton) =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
115 if actionMap.mouseActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
116 actionMap.mouseActions[$action].excl(button)
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
117
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
118 proc UnmapAction*[T: enum](action: T) =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
119 if actionMap.keyActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
120 actionMap.keyActions[$action] = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
121 if actionMap.mouseActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
122 actionMap.mouseActions[$action] = {}
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
123
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
124 proc SaveCurrentActionMapping*() =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
125 for name, keys in actionMap.keyActions.pairs:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
126 SystemStorage.Store(name, keys, table = "input_mapping_key")
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
127 for name, buttons in actionMap.mouseActions.pairs:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
128 SystemStorage.Store(name, buttons, table = "input_mapping_mouse")
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
129
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
130 proc LoadActionMapping*[T]() =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
131 reset(actionMap)
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
132 for name in SystemStorage.List(table = "input_mapping_key"):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
133 let action = parseEnum[T](name)
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
134 let keys = SystemStorage.Load(name, set[Key](), table = "input_mapping_key")
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
135 for key in keys:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
136 MapAction(action, key)
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
137
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
138 proc ActionDown*[T](action: T): bool =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
139 if actionMap.keyActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
140 for key in actionMap.keyActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
141 if key in input.keyIsDown:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
142 return true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
143 return false
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
144 if actionMap.mouseActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
145 for button in actionMap.mouseActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
146 if button in input.mouseIsDown:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
147 return true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
148 return false
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
149
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
150 proc ActionPressed*[T](action: T): bool =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
151 if actionMap.keyActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
152 for key in actionMap.keyActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
153 if key in input.keyWasPressed:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
154 return true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
155 elif actionMap.mouseActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
156 for button in actionMap.mouseActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
157 if button in input.mouseWasPressed:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
158 return true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
159
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
160 proc ActionReleased*[T](action: T): bool =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
161 if actionMap.keyActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
162 for key in actionMap.keyActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
163 if key in input.keyWasReleased:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
164 return true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
165 elif actionMap.mouseActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
166 for button in actionMap.mouseActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
167 if button in input.mouseWasReleased:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
168 return true
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
169
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
170 proc ActionValue*[T](action: T): float32 =
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
171 if actionMap.keyActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
172 for key in actionMap.keyActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
173 if key in input.keyIsDown:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
174 return 1
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
175 elif actionMap.mouseActions.contains($action):
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
176 for button in actionMap.mouseActions[$action]:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
177 if button in input.mouseIsDown:
ba1af13233ee add: working main-renderloop
sam <sam@basx.dev>
parents:
diff changeset
178 return 1