allow camera movement with the keyboard

This commit is contained in:
2024-08-22 17:08:28 +10:00
parent 83fc86d2a5
commit 39d46da7f7
5 changed files with 231 additions and 40 deletions

View File

@ -69,6 +69,7 @@ public class Application {
}
private func beginHandleEvents() {
Keyboard.instance.newFrame()
GameController.instance.newFrame()
}
@ -82,10 +83,14 @@ public class Application {
case SDLK_ESCAPE:
return .exitSuccess
default:
break
Keyboard.instance.keyDownEvent(scan: event.key.scancode, repeat: event.key.repeat != 0)
}
return .running
case SDL_EVENT_KEY_UP:
Keyboard.instance.keyUpEvent(scan: event.key.scancode)
return .running
case SDL_EVENT_GAMEPAD_ADDED:
if SDL_IsGamepad(event.gdevice.which) != SDL_FALSE {
GameController.instance.connectedEvent(id: event.gdevice.which)