Skip to content

Commit 8dba362

Browse files
committed
Fixes from comments i think
1 parent 543e415 commit 8dba362

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

documentation/proposals/Proposal - Multi-Backend Input.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ All handler methods are called in the order that the state changes happened in t
179179
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.
180180

181181
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).
188188

189189
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.
190190

@@ -289,7 +289,7 @@ public readonly record struct GamepadTriggerMoveEvent(IGamepad Gamepad, long Tim
289289

290290
`Timestamp` shall be the `Stopwatch.GetTimestamp()` at which the event was raised. This allows the user to get the
291291
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`.
293293

294294
This is the part of this proposal that incorporates the ideas in Enhanced Input Events, and is why this proposal supersedes that one.
295295

@@ -416,10 +416,10 @@ public interface IPointerTarget
416416
```
417417

418418
**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.
423423

424424
The functionality of these APIs are described in the XML documentation inline.
425425

@@ -495,7 +495,7 @@ by `IPointer.Targets`.
495495

496496
Additional APIs to construct `PointerState` will be added as appropriate.
497497

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.
499499

500500
The handler for pointer inputs shall be defined as follows:
501501
```cs
@@ -578,9 +578,12 @@ public class MouseState : PointerState
578578
}
579579
```
580580

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+
581584
Additional APIs to construct `MouseState` will be added as appropriate.
582585

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.
584587

585588
```cs
586589
public interface IMouseInputHandler : IButtonInputHandler<PointerButton>
@@ -698,7 +701,7 @@ public class KeyboardState
698701

699702
**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.
700703

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.
702705

703706
```cs
704707
public interface IKeyboardInputHandler : IButtonInputHandler<KeyName>
@@ -1071,7 +1074,7 @@ public readonly struct DualReadOnlyList<T> : IReadOnlyList<T>
10711074

10721075
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.
10731076

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.
10751078

10761079
```cs
10771080
public interface IGamepadInputHandler : IButtonInputHandler<JoystickButton>
@@ -1136,7 +1139,7 @@ public enum JoystickButton
11361139
}
11371140
```
11381141

1139-
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.
11401143

11411144
```cs
11421145
public interface IJoystickInputHandler : IButtonInputHandler<JoystickButton>

0 commit comments

Comments
 (0)