You've already forked aurora
mirror of
https://github.com/CraftyBoss/aurora.git
synced 2026-07-14 05:07:24 -07:00
Cleanly shutdown aurora::input by telling all registered controllers to stop their rumble motors (#132)
This commit is contained in:
@@ -201,6 +201,7 @@ void shutdown() noexcept {
|
||||
gfx::shutdown();
|
||||
webgpu::shutdown();
|
||||
#endif
|
||||
input::shutdown();
|
||||
window::shutdown();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user