diff --git a/osu.Framework.Android/Input/AndroidJoystickHandler.cs b/osu.Framework.Android/Input/AndroidJoystickHandler.cs index c8375f0460..af7b63ddb4 100644 --- a/osu.Framework.Android/Input/AndroidJoystickHandler.cs +++ b/osu.Framework.Android/Input/AndroidJoystickHandler.cs @@ -15,6 +15,8 @@ namespace osu.Framework.Android.Input { public class AndroidJoystickHandler : AndroidInputHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + public BindableFloat DeadzoneThreshold { get; } = new BindableFloat(0.1f) { MinValue = 0, @@ -223,6 +225,7 @@ private void enqueueInput(IInput input) { PendingInputs.Enqueue(input); FrameStatistics.Increment(StatisticsCounterType.JoystickEvents); + statistic_total_events.Value++; } } } diff --git a/osu.Framework.Android/Input/AndroidKeyboardHandler.cs b/osu.Framework.Android/Input/AndroidKeyboardHandler.cs index 163bbe8cd9..9eebefdb24 100644 --- a/osu.Framework.Android/Input/AndroidKeyboardHandler.cs +++ b/osu.Framework.Android/Input/AndroidKeyboardHandler.cs @@ -13,6 +13,8 @@ namespace osu.Framework.Android.Input { public class AndroidKeyboardHandler : AndroidInputHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + protected override IEnumerable HandledEventSources => new[] { InputSourceType.Keyboard, @@ -209,6 +211,7 @@ private void enqueueInput(IInput input) { PendingInputs.Enqueue(input); FrameStatistics.Increment(StatisticsCounterType.KeyEvents); + statistic_total_events.Value++; } } } diff --git a/osu.Framework.Android/Input/AndroidMouseHandler.cs b/osu.Framework.Android/Input/AndroidMouseHandler.cs index 0eaf7e1b4b..1bd454357a 100644 --- a/osu.Framework.Android/Input/AndroidMouseHandler.cs +++ b/osu.Framework.Android/Input/AndroidMouseHandler.cs @@ -20,6 +20,8 @@ namespace osu.Framework.Android.Input /// public class AndroidMouseHandler : AndroidInputHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + /// /// Whether relative mode should be preferred when the window has focus, the cursor is contained and the OS cursor is not visible. /// @@ -308,6 +310,7 @@ private void enqueueInput(IInput input) { PendingInputs.Enqueue(input); FrameStatistics.Increment(StatisticsCounterType.MouseEvents); + statistic_total_events.Value++; } } } diff --git a/osu.Framework.Android/Input/AndroidTouchHandler.cs b/osu.Framework.Android/Input/AndroidTouchHandler.cs index d7aaf32b56..15eb6631d2 100644 --- a/osu.Framework.Android/Input/AndroidTouchHandler.cs +++ b/osu.Framework.Android/Input/AndroidTouchHandler.cs @@ -14,6 +14,9 @@ namespace osu.Framework.Android.Input { public class AndroidTouchHandler : AndroidInputHandler { + private static readonly GlobalStatistic statistic_touch_events = GlobalStatistics.Get(StatisticGroupFor(), "Touch events"); + private static readonly GlobalStatistic statistic_hover_events = GlobalStatistics.Get(StatisticGroupFor(), "Hover events"); + public override bool IsActive => true; protected override IEnumerable HandledEventSources => new[] { InputSourceType.BluetoothStylus, InputSourceType.Stylus, InputSourceType.Touchscreen }; @@ -87,14 +90,20 @@ protected override bool OnHover(MotionEvent hoverEvent) void apply(MotionEvent e, int historyPosition) { if (tryGetEventPosition(e, historyPosition, 0, out var position)) + { enqueueInput(new MousePositionAbsoluteInput { Position = position }); + statistic_hover_events.Value++; + } } } private void applyTouchInput(MotionEvent touchEvent, int historyPosition, int pointerIndex) { if (tryGetEventTouch(touchEvent, historyPosition, pointerIndex, out var touch)) + { enqueueInput(new TouchInput(touch, touchEvent.ActionMasked.IsTouchDownAction())); + statistic_touch_events.Value++; + } } private bool tryGetEventTouch(MotionEvent motionEvent, int historyPosition, int pointerIndex, out Touch touch) diff --git a/osu.Framework/Input/Handlers/Joystick/JoystickHandler.cs b/osu.Framework/Input/Handlers/Joystick/JoystickHandler.cs index 75fdfe08ec..997475bfa1 100644 --- a/osu.Framework/Input/Handlers/Joystick/JoystickHandler.cs +++ b/osu.Framework/Input/Handlers/Joystick/JoystickHandler.cs @@ -11,6 +11,8 @@ namespace osu.Framework.Input.Handlers.Joystick { public class JoystickHandler : InputHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + public BindableFloat DeadzoneThreshold { get; } = new BindableFloat(0.1f) { MinValue = 0, @@ -53,6 +55,7 @@ private void enqueueJoystickEvent(IInput evt) { PendingInputs.Enqueue(evt); FrameStatistics.Increment(StatisticsCounterType.JoystickEvents); + statistic_total_events.Value++; } private void enqueueJoystickButtonDown(JoystickButton button) => enqueueJoystickEvent(new JoystickButtonInput(button, true)); diff --git a/osu.Framework/Input/Handlers/Keyboard/KeyboardHandler.cs b/osu.Framework/Input/Handlers/Keyboard/KeyboardHandler.cs index 44eafeda59..169cc4543c 100644 --- a/osu.Framework/Input/Handlers/Keyboard/KeyboardHandler.cs +++ b/osu.Framework/Input/Handlers/Keyboard/KeyboardHandler.cs @@ -10,6 +10,8 @@ namespace osu.Framework.Input.Handlers.Keyboard { public class KeyboardHandler : InputHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + public override string Description => "Keyboard"; public override bool IsActive => true; @@ -43,6 +45,7 @@ private void enqueueInput(IInput input) { PendingInputs.Enqueue(input); FrameStatistics.Increment(StatisticsCounterType.KeyEvents); + statistic_total_events.Value++; } private void handleKeyDown(TKKey key) => enqueueInput(new KeyboardKeyInput(key, true)); diff --git a/osu.Framework/Input/Handlers/Midi/MidiHandler.cs b/osu.Framework/Input/Handlers/Midi/MidiHandler.cs index ac850e6cdf..9518062514 100644 --- a/osu.Framework/Input/Handlers/Midi/MidiHandler.cs +++ b/osu.Framework/Input/Handlers/Midi/MidiHandler.cs @@ -21,6 +21,8 @@ namespace osu.Framework.Input.Handlers.Midi { public class MidiHandler : InputHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + public override string Description => "MIDI"; public override bool IsActive => inGoodState; @@ -251,12 +253,14 @@ void noteOn() { PendingInputs.Enqueue(new MidiKeyInput((MidiKey)key, velocity, true)); FrameStatistics.Increment(StatisticsCounterType.MidiEvents); + statistic_total_events.Value++; } void noteOff() { PendingInputs.Enqueue(new MidiKeyInput((MidiKey)key, 0, false)); FrameStatistics.Increment(StatisticsCounterType.MidiEvents); + statistic_total_events.Value++; } } } diff --git a/osu.Framework/Input/Handlers/Mouse/MouseHandler.cs b/osu.Framework/Input/Handlers/Mouse/MouseHandler.cs index 1de0a31c74..9b2c6bff5d 100644 --- a/osu.Framework/Input/Handlers/Mouse/MouseHandler.cs +++ b/osu.Framework/Input/Handlers/Mouse/MouseHandler.cs @@ -20,6 +20,8 @@ namespace osu.Framework.Input.Handlers.Mouse /// public class MouseHandler : InputHandler, IHasCursorSensitivity, INeedsMousePositionFeedback { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + /// /// Whether relative mode should be preferred when the window has focus, the cursor is contained and the OS cursor is not visible. /// @@ -219,6 +221,7 @@ private void enqueueInput(IInput input) { PendingInputs.Enqueue(input); FrameStatistics.Increment(StatisticsCounterType.MouseEvents); + statistic_total_events.Value++; } private void transferLastPositionToHostCursor() diff --git a/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs b/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs index ff73859cf3..2f3b442139 100644 --- a/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs +++ b/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs @@ -20,6 +20,8 @@ namespace osu.Framework.Input.Handlers.Tablet { public class OpenTabletDriverHandler : InputHandler, IAbsolutePointer, IRelativePointer, IPressureHandler, ITabletHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + private TabletDriver? tabletDriver; private InputDeviceTree? device; @@ -203,6 +205,7 @@ private void enqueueInput(IInput input) { PendingInputs.Enqueue(input); FrameStatistics.Increment(StatisticsCounterType.TabletEvents); + statistic_total_events.Value++; } } } diff --git a/osu.Framework/Input/Handlers/Touch/TouchHandler.cs b/osu.Framework/Input/Handlers/Touch/TouchHandler.cs index 138010aac1..7d19eda1c9 100644 --- a/osu.Framework/Input/Handlers/Touch/TouchHandler.cs +++ b/osu.Framework/Input/Handlers/Touch/TouchHandler.cs @@ -9,6 +9,8 @@ namespace osu.Framework.Input.Handlers.Touch { public class TouchHandler : InputHandler { + private static readonly GlobalStatistic statistic_total_events = GlobalStatistics.Get(StatisticGroupFor(), "Total events"); + public override bool IsActive => true; public override bool Initialize(GameHost host) @@ -50,6 +52,7 @@ private void enqueueTouch(Input.Touch touch, bool activate) { PendingInputs.Enqueue(new TouchInput(touch, activate)); FrameStatistics.Increment(StatisticsCounterType.TouchEvents); + statistic_total_events.Value++; } } }