|
group2 0.1.0
CSE 125 Group 2
|
Client-only input sampling for mouse look and movement keys. More...
#include "config/InputBindings.hpp"#include "config/UserSettings.hpp"#include "ecs/components/Controllable.hpp"#include "ecs/components/EmoteCatalog.hpp"#include "ecs/components/InputSnapshot.hpp"#include "ecs/components/LocalPlayer.hpp"#include "ecs/components/RespawnTimer.hpp"#include "ecs/registry/Registry.hpp"#include <SDL3/SDL.h>#include <algorithm>#include <cmath>#include <glm/geometric.hpp>#include <glm/trigonometric.hpp>#include <glm/vec2.hpp>Go to the source code of this file.
Classes | |
| struct | systems::JoystickAxis |
| Gamepad axis mapping configuration for look and move axes, used to support stick swapping in user settings. More... | |
Namespaces | |
| namespace | systems |
| Client-only input sampling system — split into two halves so mouse look can run every iterate() (smooth camera at any FPS) while movement keys run once per physics tick group (server-consistent). | |
| namespace | systems::gamepad |
Functions | |
| JoystickAxis | systems::getLookJoystickAxes (bool swapSticks) |
| Return the SDL axes used for camera look, honoring the stick-swap setting. | |
| JoystickAxis | systems::getMoveJoystickAxes (bool swapSticks) |
| Return the SDL axes used for movement, honoring the stick-swap setting. | |
| bool | systems::gamepadConnected (SDL_Gamepad *gamepad) |
| True when a gamepad handle is non-null and still connected. | |
| bool | systems::consumePendingGrenadeThrow () |
| Consume and clear the queued grenade throw request. | |
| bool | systems::consumePendingGrenadeCycleNext () |
| Consume and clear the queued "cycle to next grenade" request. | |
| bool | systems::consumePendingGrenadeCyclePrev () |
| Consume and clear the queued "cycle to previous grenade" request. | |
| bool | systems::consumePendingGamepadWeaponSwap () |
| Consume and clear the latched tap-Y gamepad weapon swap request. | |
| int | systems::consumePendingEmote () |
| Consume and clear the latched emote-play request (-1 = none). | |
| bool | systems::consumePendingAbilitySelectLeft () |
| Consume and clear the queued left ability-choice request. | |
| bool | systems::consumePendingAbilitySelectRight () |
| Consume and clear the queued right ability-choice request. | |
| void | systems::emoteWheelApplyPointing (float dx, float dy, bool accumulate) |
| Resolve emoteWheelSelection from a pointing input. | |
| void | systems::runEmoteWheelKey (const InputBindings &bindings) |
| Track the Emote binding (keyboard/mouse) to open/close the wheel. | |
| void | systems::runMouseLook (Registry ®istry, float mouseSensitivity, bool gravityFlipped=false) |
| Sample mouse delta and accumulate into yaw / pitch. | |
| void | systems::runMovementKeys (Registry ®istry, const InputBindings &bindings, bool gravityFlipped=false) |
| Sample keyboard state into the movement flags. | |
| void | systems::runDeadInput (Registry ®istry, const InputBindings &bindings) |
| Sample skip-respawn input while the local player is dead. | |
| void | systems::runWeaponKeys (Registry ®istry, const InputBindings &bindings) |
| Sample keyboard state into the weapon flags. | |
| void | systems::runInputSample (Registry ®istry, const InputBindings &bindings, float mouseSensitivity=user_settings::kDefaultMouseSensitivity) |
| Legacy combined sampler — calls both runMouseLook and runMovementKeys. | |
| float | systems::gamepad::normaliseAxis (Sint16 raw, float deadzone=k_stickDeadzone) |
| Convert SDL's int16 axis value to a deadzoned float in [-1, 1]. | |
| void | systems::runGamepadLook (Registry ®istry, SDL_Gamepad *gamepad, float pitchSensitivity, float yawSensitivity, float deadzone, float dt, bool gravityFlipped=false, bool swapSticks=false) |
| Sample the right stick into yaw / pitch. | |
| void | systems::runGamepadEmoteWheel (SDL_Gamepad *gamepad, const InputBindings &bindings, bool swapSticks=false) |
| Track the Emote binding (controller) to open/close the wheel and pick a sector from the right stick. | |
| void | systems::runGamepadMovement (Registry ®istry, SDL_Gamepad *gamepad, const InputBindings &bindings, float deadzone, bool gravityFlipped=false, bool swapSticks=false) |
| Sample gamepad buttons / left stick into the movement flags. | |
| void | systems::runGamepadWeapon (Registry ®istry, SDL_Gamepad *gamepad, const InputBindings &bindings) |
| Sample gamepad buttons / right trigger into the weapon flags. | |
| void | systems::runGamepadDeadInput (Registry ®istry, SDL_Gamepad *gamepad, const InputBindings &bindings) |
| Sample controller skip-respawn input while the local player is dead. | |
Variables | |
| bool | systems::prevKillSelfKey = false |
| Tracks previous-frame key state for edge detection. | |
| bool | systems::prevGrenadeCycleKey = false |
| Previous-frame CycleGrenade (H) / ThrowGrenade (G) key state for edge detection (keyboard/mouse). | |
| bool | systems::prevGrenadeThrowKey = false |
| bool | systems::prevGamepadGrenadeCycleKey = false |
| Gamepad equivalents: CycleGrenade (D-pad Left) / ThrowGrenade (B). | |
| bool | systems::prevGamepadGrenadeThrowKey = false |
| bool | systems::pendingGrenadeThrow = false |
| Latched throw request, consumed once per frame by the game loop. | |
| bool | systems::pendingGrenadeCycleNext = false |
| Latched cycle next/prev requests, consumed once per frame by the game loop. | |
| bool | systems::pendingGrenadeCyclePrev = false |
| bool | systems::prevAbilitySelectLeft = false |
| Tracks previous-frame Alt+LMB state for ability choice edge detection. | |
| bool | systems::prevAbilitySelectRight = false |
| Tracks previous-frame Alt+RMB state for ability choice edge detection. | |
| bool | systems::pendingAbilitySelectLeft = false |
| Latched ability choice requests, consumed once per sent input batch. | |
| bool | systems::pendingAbilitySelectRight = false |
| bool | systems::prevGamepadAbilitySelectLeft = false |
| Tracks previous-frame gamepad left ability-select chord for edge detection. | |
| bool | systems::prevGamepadAbilitySelectRight = false |
| Tracks previous-frame gamepad right ability-select chord for edge detection. | |
| bool | systems::prevGamepadPickupKey = false |
| Gamepad Y (Pickup binding) tap-vs-hold state: tap swaps weapon, hold picks up. | |
| Uint64 | systems::gamepadPickupDownMs = 0 |
| SDL_GetTicks at the Y press, for hold-duration timing. | |
| bool | systems::gamepadPickupHoldFired = false |
| Set once the press crossed the hold threshold (suppresses tap-swap). | |
| bool | systems::pendingGamepadWeaponSwap = false |
| Latched tap-Y weapon swap, consumed once per frame by the game loop. | |
| float | systems::gamepadLookAccel = 0.0f |
| COD-style look acceleration progress in [0, 1]; ramps while the look stick is held near full deflection and resets when it eases off. | |
| bool | systems::emoteWheelOpen = false |
| True while the emote wheel is open (Emote binding held on any device). | |
| int | systems::emoteWheelSelection = -1 |
| Currently highlighted emote sector while the wheel is open, or -1 (none). | |
| float | systems::emoteWheelDirX = 0.0f |
| Accumulated pointing direction used to resolve the highlighted sector. | |
| float | systems::emoteWheelDirY = 0.0f |
| int | systems::pendingEmoteRequest = -1 |
| Latched emote to play on wheel release; consumed once by the game loop. | |
| bool | systems::prevEmoteKey = false |
| Previous-frame Emote-binding state for open/close edge detection. | |
| bool | systems::prevGamepadEmoteKey = false |
| constexpr float | systems::gamepad::k_stickDeadzone = 0.15f |
| Stick deadzone as a fraction of full deflection. | |
| constexpr float | systems::gamepad::k_triggerThreshold = 0.5f |
| Trigger threshold for treating an analog trigger as "pressed". | |
Client-only input sampling for mouse look and movement keys.