feat: add firstpersoncontroller

This commit is contained in:
2026-09-05 01:11:44 +02:00
parent c9fb6e991a
commit e8a56405df
11 changed files with 251 additions and 20 deletions
+8 -8
View File
@@ -131,6 +131,12 @@ void App::run()
imguiPass.handleEvent(event);
const bool mouseEvent =
event.type == SDL_MOUSEBUTTONDOWN ||
event.type == SDL_MOUSEBUTTONUP ||
event.type == SDL_MOUSEMOTION ||
event.type == SDL_MOUSEWHEEL;
if (event.type == SDL_QUIT)
{
isRunning = false;
@@ -149,19 +155,13 @@ void App::run()
}
}
const bool mouseEvent =
event.type == SDL_MOUSEBUTTONDOWN ||
event.type == SDL_MOUSEBUTTONUP ||
event.type == SDL_MOUSEMOTION ||
event.type == SDL_MOUSEWHEEL;
const bool keyboardEvent =
event.type == SDL_KEYDOWN ||
event.type == SDL_KEYUP ||
event.type == SDL_TEXTINPUT;
const bool capturedByImgui =
(mouseEvent && imguiPass.wantsMouse()) ||
(mouseEvent && !InputManager::GetInstance().IsMouseCaptured() && imguiPass.wantsMouse()) ||
(keyboardEvent && imguiPass.wantsKeyboard());
if (!capturedByImgui)
@@ -176,7 +176,7 @@ void App::run()
}
}
if (!isRunning) break;
if (!isRunning) break;
// Consume SDL events before updating the base camera so held and
// newly pressed inputs are applied in the same frame.