You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/proposals/Proposal - Multi-Backend Input.md
+19-16Lines changed: 19 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,12 +179,12 @@ All handler methods are called in the order that the state changes happened in t
179
179
The `IInputHandler` passed into `Update` may implement multiple other handler interfaces (as defined below), and if the actor implements an extra interface (such as `IMouseInputHandler` defined below) that would allow the backend to forward more events to the handler, the backend must do so via type checking. That is, if `handler` is an instance of `IMouseInputHandler`, any mouse events are delivered to that actor. But if `handler` does not implement `IMouseInputHandler`, no mouse events will be delivered. All events, including those that were not delivered due to the actor not implementing a necessary interface, must be discarded at the end of the `Update` call.
180
180
181
181
Note that during the `Update` call, a backend must only update the device's state in the order that the events are delivered. For example when `IInputBackend.Update` is called:
182
-
1. The backend has a queued "mouse down" event.
183
-
2. The backend updates the `State` of the relevant `IMouse` for that button press.
184
-
3. The backend calls `HandleButtonChanged` with `IsDown` set to `true` on the `IMouseInputHandler` (if applicable).
185
-
4. The backend has a queued "mouse up" event.
186
-
5. The backend updates the `State` of the relevant `IMouse` for that button release.
187
-
6. The backend calls `HandleButtonChanged` with `IsDown` set to `true` on the `IMouseInputHandler` (if applicable).
182
+
1. The backend has a queued "pointer down" event for a mouse, for example.
183
+
2. The backend updates the `State` of the relevant `IPointer` for that button press.
184
+
3. The backend calls `HandleButtonChanged` with `IsDown` set to `true` on the `IPointerInputHandler` (if applicable).
185
+
4. The backend has a queued "pointer up" event on that mouse.
186
+
5. The backend updates the `State` of the relevant `IPointer` for that button release.
187
+
6. The backend calls `HandleButtonChanged` with `IsDown` set to `false` on the `IPointerInputHandler` (if applicable).
188
188
189
189
This allows the actor to work with the whole device state with the device state being representative of the time that the original event occurred.
190
190
@@ -289,7 +289,7 @@ public readonly record struct GamepadTriggerMoveEvent(IGamepad Gamepad, long Tim
289
289
290
290
`Timestamp` shall be the `Stopwatch.GetTimestamp()` at which the event was raised. This allows the user to get the
291
291
precise time of the event's occurrence, which is not otherwise possible given the requirement for state changes to be
292
-
enacted only upon a call to `Update`.
292
+
enacted only upon a call to `Update`.
293
293
294
294
This is the part of this proposal that incorporates the ideas in Enhanced Input Events, and is why this proposal supersedes that one.
295
295
@@ -416,10 +416,10 @@ public interface IPointerTarget
416
416
```
417
417
418
418
**INFORMATIVE TEXT**: Furthermore, it is our eventual goal to be able to support considering VR hands as pointer devices
419
-
through raycasting. Such a future proposal will involve a way to "fork" a `IPointerTarget` from that which represents
420
-
the 3D world (i.e. the entire VR world is a target, and the point representing the hand is _within_ that target - with
421
-
the `TargetPoint` being populated using `XrPosef` values), where calculation of points on forked targets are calculated
422
-
using raycasting from that position.
419
+
through raycasting. Such a future proposal will involve a way to create a child target within the bounds of this target
420
+
a `IPointerTarget` from that which represents the 3D world (i.e. the entire VR world is a target, and the point
421
+
representing the hand is _within_ that target - with the `TargetPoint` being populated using ``XrPosef values), where
422
+
calculation of points on those child targets are calculated using raycasting from that position.
423
423
424
424
The functionality of these APIs are described in the XML documentation inline.
425
425
@@ -495,7 +495,7 @@ by `IPointer.Targets`.
495
495
496
496
Additional APIs to construct `PointerState` will be added as appropriate.
497
497
498
-
Changes to `PointerState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section).
498
+
Changes to `PointerState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section). For the avoidance of doubt, this implies that `Timestamp` in ascending order.
499
499
500
500
The handler for pointer inputs shall be defined as follows:
501
501
```cs
@@ -578,9 +578,12 @@ public class MouseState : PointerState
578
578
}
579
579
```
580
580
581
+
`WheelPosition` represents the number of times the scroll wheel (e.g. ratchets) has scrolled in a particular direction
582
+
between the previous and latest times the input was captured by the backend.
583
+
581
584
Additional APIs to construct `MouseState` will be added as appropriate.
582
585
583
-
Changes to `MouseState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section).
586
+
Changes to `MouseState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section). For the avoidance of doubt, this implies that `Timestamp` in ascending order.
**INFORMATIVE TEXT:** This is something we can optimize in `InputList` to not be allocatey, rest assured it is not acceptable to the Silk.NET team to allocate a new list for every character.
700
703
701
-
Changes to `KeyboardState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section).
704
+
Changes to `KeyboardState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section). For the avoidance of doubt, this implies that `Timestamp` in ascending order.
@@ -1071,7 +1074,7 @@ public readonly struct DualReadOnlyList<T> : IReadOnlyList<T>
1071
1074
1072
1075
This is used where the list will only ever have exactly two elements, mainly because the "gamepad" form factor is standard and it doesn't make sense to have multiple thumbsticks or triggers given a human only has two thumbs or index fingers. More exotic devices should be exposed using the joystick API.
1073
1076
1074
-
Changes to `GamepadState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section).
1077
+
Changes to `GamepadState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section). For the avoidance of doubt, this implies that `Timestamp` in ascending order.
Changes to `JoystickState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section).
1142
+
Changes to `JoystickState` also have matching handler methods which are subject to the handler method rules i.e. the backend should call them in the order in which the backend received the events where possible etc (read the Input Handlers section). For the avoidance of doubt, this implies that `Timestamp` in ascending order.
0 commit comments