13public sealed class EngineInputSystems
15 internal EngineInputSystems() { }
17 private IGamepadManager<IGamepadAdapter>? _gamepadManager =
null;
18 private long _lastGamepadConnectionUpdateTick;
19 private long _lastGamepadPollTick;
32 get => _gamepadManager;
35 _gamepadManager = value;
39 _lastGamepadConnectionUpdateTick = 0;
40 _lastGamepadPollTick = 0;
47 value.UpdateConnections();
50 long tick = HighResTimer.GetCurrentTick();
51 _lastGamepadConnectionUpdateTick = tick;
52 _lastGamepadPollTick = tick;
65 ArgumentNullException.ThrowIfNull(configuration);
67 var manager = _gamepadManager;
71 if (IsGamepadRefreshDue(
73 _lastGamepadConnectionUpdateTick,
76 manager.UpdateConnections();
78 _lastGamepadConnectionUpdateTick = tick;
81 if (IsGamepadRefreshDue(
87 _lastGamepadPollTick = tick;
91 private static bool IsGamepadRefreshDue(
long tick,
long lastTick,
double frequencyHz)
93 if (frequencyHz <= 0d)
96 long intervalTicks = Math.Max(
98 (
long)(HighResTimer.TicksPerSecond / frequencyHz));
100 return tick - lastTick >= intervalTicks;
Settings used by the engine when cycling.
double GamepadPollFrequencyHz
Gets or sets how often the engine refreshes the state of already-connected gamepads.
double GamepadConnectionUpdateFrequencyHz
Gets or sets how often the engine checks for gamepad connection and disconnection changes.