-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputs.odin
30 lines (24 loc) · 1.33 KB
/
inputs.odin
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
package main
import rl "vendor:raylib"
HandleInputs :: proc(translation, rotation: ^Vector3, scale: ^f32, renderMode: ^i8, renderModesCount: i8, deltaTime: f32) {
step: f32 = (rl.IsKeyDown(rl.KeyboardKey.LEFT_SHIFT) ? 0.25 : 1) * deltaTime
if rl.IsKeyDown(rl.KeyboardKey.W) do translation.z += step
if rl.IsKeyDown(rl.KeyboardKey.S) do translation.z -= step
if rl.IsKeyDown(rl.KeyboardKey.A) do translation.x -= step
if rl.IsKeyDown(rl.KeyboardKey.D) do translation.x += step
if rl.IsKeyDown(rl.KeyboardKey.Q) do translation.y += step
if rl.IsKeyDown(rl.KeyboardKey.E) do translation.y -= step
if rl.IsKeyDown(rl.KeyboardKey.I) do rotation.x += step
if rl.IsKeyDown(rl.KeyboardKey.K) do rotation.x -= step
if rl.IsKeyDown(rl.KeyboardKey.J) do rotation.y -= step
if rl.IsKeyDown(rl.KeyboardKey.L) do rotation.y += step
if rl.IsKeyDown(rl.KeyboardKey.U) do rotation.z += step
if rl.IsKeyDown(rl.KeyboardKey.O) do rotation.z -= step
if rl.IsKeyDown(rl.KeyboardKey.KP_ADD) do scale^ += step
if rl.IsKeyDown(rl.KeyboardKey.KP_SUBTRACT) do scale^ -= step
if rl.IsKeyPressed(rl.KeyboardKey.LEFT) {
renderMode^ = (renderMode^ + renderModesCount - 1) % renderModesCount
} else if rl.IsKeyPressed(rl.KeyboardKey.RIGHT) {
renderMode^ = (renderMode^ + 1) % renderModesCount
}
}