summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquarrel07 <178681861+quarrel07@users.noreply.github.com>2026-09-16 08:03:49 -0700
committerGitHub <noreply@github.com>2026-09-16 09:03:49 -0600
commit2b3ddb4a579887d7ab41c56445691b9411996399 (patch)
treef3f6b11615e4c8ad98eedb546382bc56b2216f35
parent3429b23a9484e411c28ac4f69d44ef1a4afa0ba5 (diff)
Freecam: accept keyboard and mouse input on the Metal backend (#749)HEADmain
The keyboard and mouse paths were gated on FAST3D_SDL_OPENGL only, so freecam controls did nothing under Metal, which is the default backend on macOS.
-rw-r--r--src/enhancements/freecam/freecam.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/enhancements/freecam/freecam.cpp b/src/enhancements/freecam/freecam.cpp
index 39386bddd..922d17649 100644
--- a/src/enhancements/freecam/freecam.cpp
+++ b/src/enhancements/freecam/freecam.cpp
@@ -188,7 +188,8 @@ bool FreecamKeyDown(int virtualKey) {
static bool prevKeyState[256] = { false }; // Store previous key states
bool isDownNow = false;
- if (wnd->GetWindowBackend() == Fast::WindowBackend::FAST3D_SDL_OPENGL) {
+ if (wnd->GetWindowBackend() == Fast::WindowBackend::FAST3D_SDL_OPENGL ||
+ wnd->GetWindowBackend() == Fast::WindowBackend::FAST3D_SDL_METAL) {
// Use SDL to check key states
const uint8_t* keystate = SDL_GetKeyboardState(NULL);
isDownNow = keystate[virtualKey] != 0;
@@ -308,7 +309,8 @@ void freecam_keyboard_manager(Camera* camera, Vec3f forwardVector) {
// Keyboard/mouse OpenGL/SDL
}
#endif
- else if (wnd->GetWindowBackend() == Fast::WindowBackend::FAST3D_SDL_OPENGL) {
+ else if (wnd->GetWindowBackend() == Fast::WindowBackend::FAST3D_SDL_OPENGL ||
+ wnd->GetWindowBackend() == Fast::WindowBackend::FAST3D_SDL_METAL) {
const uint8_t* keystate = SDL_GetKeyboardState(NULL);
if (FreecamKeyDown(SDL_SCANCODE_F)) {
fTargetPlayer = !fTargetPlayer;