Add mouse input option for the third-person camera (#1011)

* Untie existing mouse logic from gyro

* A bit more mouse cleanup before I start building off it

* Rebase and last bit of cleanup

* Fix rebase mistake, don't apply invertFirstPerson to gyro or mouse input

* Remove the deprecated ImGui toast system

* Add Mouse Camera option in preparation for its use

* WIP, add mouse controls for the third-person camera

* Various helpText revisions

* Enable free camera on horseback

* Untie mouse camera and free camera options
Either being enabled now allows the underlying freecam logic to run

* Allow simultaneous C-stick and mouse input

* Combine mouse sensitivities for both aim and camera

* Add option for inverting mouse Y

* Refactor cursor visibility handling

* Tighten aim capture condition and constrain cursor to window region

* Tidying my trash

* Last bit of housekeeping so I'm satisfied

* Don't write code while sleep deprived

* Fix my sloppy merge and a few helpText updates

* Disable control stick aim when mouse aim is active

* Use same conditions for cursor grabbing as for capture
This commit is contained in:
Irastris
2026-06-02 01:37:53 -04:00
committed by GitHub
parent b531936a1f
commit bd9b81f700
20 changed files with 349 additions and 238 deletions
+7
View File
@@ -55,6 +55,7 @@
#include "dusk/frame_interpolation.h"
#include "dusk/game_clock.h"
#include "dusk/gyro.h"
#include "dusk/mouse.h"
#include "dusk/imgui/ImGuiConsole.hpp"
#include "dusk/imgui/ImGuiEngine.hpp"
#include "dusk/iso_validate.hpp"
@@ -168,6 +169,7 @@ bool launchUILoop() {
while (event != nullptr && event->type != AURORA_NONE) {
switch (event->type) {
case AURORA_SDL_EVENT:
dusk::mouse::handle_event(event->sdl);
dusk::ui::handle_event(event->sdl);
dusk::g_imguiConsole.HandleSDLEvent(event->sdl);
break;
@@ -246,12 +248,15 @@ void main01(void) {
goto eventsDone;
case AURORA_PAUSED:
dusk::audio::SetPaused(true);
dusk::mouse::onFocusLost();
break;
case AURORA_UNPAUSED:
dusk::audio::SetPaused(false);
dusk::game_clock::reset_frame_timer();
dusk::mouse::onFocusGained();
break;
case AURORA_SDL_EVENT:
dusk::mouse::handle_event(event->sdl);
dusk::ui::handle_event(event->sdl);
dusk::g_imguiConsole.HandleSDLEvent(event->sdl);
break;
@@ -288,6 +293,7 @@ void main01(void) {
for (int sim_tick = 0; sim_tick < pacing.sim_ticks_to_run; ++sim_tick) {
dusk::frame_interp::begin_sim_tick();
mDoCPd_c::read();
dusk::mouse::read();
dusk::gyro::read(pacing.sim_pace);
fapGm_Execute();
mDoAud_Execute();
@@ -310,6 +316,7 @@ void main01(void) {
// Game Inputs
mDoCPd_c::read();
dusk::mouse::read();
dusk::gyro::read(pacing.presentation_dt_seconds);
// EXECUTE GAME LOGIC & RENDER