Cleanly shutdown aurora::input by telling all registered controllers to stop their rumble motors (#132)

This commit is contained in:
Phillip Stephens
2026-04-21 19:22:28 -07:00
committed by GitHub
parent 26da4c6bb0
commit dedf11fdeb
3 changed files with 13 additions and 0 deletions
+1
View File
@@ -201,6 +201,7 @@ void shutdown() noexcept {
gfx::shutdown();
webgpu::shutdown();
#endif
input::shutdown();
window::shutdown();
}
+10
View File
@@ -156,4 +156,14 @@ void get_mouse_scroll(float* scrollX, float* scrollY) noexcept {
*scrollY = g_MouseStatus.scrollY;
}
void shutdown() noexcept {
// Upon shutdown we want to ensure all controllers are in a default state, so force all rumble supporting controllers
// to shut off their rumble motors.
for (const auto& controller : g_GameControllers) {
if (!controller.second.m_hasRumble) {
continue;
}
controller_rumble(controller.first, 0, 0, 0);
}
}
} // namespace aurora::input
+2
View File
@@ -56,4 +56,6 @@ extern absl::flat_hash_map<Uint32, GameController> g_GameControllers;
void set_mouse_scroll(float scrollX, float scrollY) noexcept;
void get_mouse_scroll(float* scrollX, float* scrollY) noexcept;
void shutdown() noexcept;
} // namespace aurora::input