-
Notifications
You must be signed in to change notification settings - Fork 328
CHANGE: Removed aliased values in Gamepad enum. (ISXB-543) #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
110e5c6
50f2a47
4035fe5
60640fb
3044d28
6e50417
e09b575
a964957
806f943
1318c70
5f1b160
e7e69d3
d85c1ed
dd2de37
d3fa10e
fc85832
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ public void Events_CanListenForEvents() | |
allButtonPresses.Clear(); | ||
|
||
Release(gamepad.buttonSouth); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.A, GamepadButton.B)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not expecting any changes needed to this file |
||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.South, GamepadButton.East)); | ||
InputSystem.Update(); | ||
|
||
Assert.That(callOnceOnButtonPressCount, Is.EqualTo(1)); | ||
|
@@ -135,7 +135,7 @@ public void Events_CanListenForButtonPresses() | |
|
||
Assert.That(callCount, Is.Zero); | ||
|
||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.A)); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.South)); | ||
InputSystem.Update(); | ||
|
||
Assert.That(callCount, Is.EqualTo(1)); | ||
|
@@ -145,7 +145,7 @@ public void Events_CanListenForButtonPresses() | |
|
||
Assert.That(callCount, Is.EqualTo(1)); | ||
|
||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.A)); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.South)); | ||
InputSystem.Update(); | ||
|
||
Assert.That(callCount, Is.EqualTo(1)); | ||
|
@@ -222,7 +222,7 @@ public void Events_CanGetAllButtonPressesInEvent() | |
controls = eventPtr.GetAllButtonPresses().ToList(); | ||
}; | ||
|
||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.A, GamepadButton.B)); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.South, GamepadButton.East)); | ||
InputSystem.Update(); | ||
|
||
Assert.That(controls, Is.EquivalentTo(new[] { gamepad.aButton, gamepad.bButton })); | ||
|
@@ -1319,7 +1319,7 @@ public unsafe void Events_CanTraceEventsOfDevice_AndFilterEventsThroughCallback( | |
|
||
trace.Enable(); | ||
|
||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.A)); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.South)); | ||
InputSystem.QueueStateEvent(gamepad, default(GamepadState)); | ||
InputSystem.Update(); | ||
|
||
|
@@ -1338,8 +1338,8 @@ public void Events_CanTraceEventsOfDevice_AndGrowBufferAsNeeded() | |
{ | ||
trace.Enable(); | ||
|
||
InputSystem.QueueStateEvent(device, new GamepadState().WithButton(GamepadButton.A)); | ||
InputSystem.QueueStateEvent(device, new GamepadState().WithButton(GamepadButton.B)); | ||
InputSystem.QueueStateEvent(device, new GamepadState().WithButton(GamepadButton.South)); | ||
InputSystem.QueueStateEvent(device, new GamepadState().WithButton(GamepadButton.East)); | ||
|
||
InputSystem.Update(); | ||
|
||
|
@@ -1358,7 +1358,7 @@ public void Events_CanTraceEventsOfDevice_AndRecordFrameBoundaries() | |
{ | ||
trace.Enable(); | ||
|
||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.A)); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.South)); | ||
InputSystem.Update(); | ||
|
||
Assert.That(trace.eventCount, Is.EqualTo(2)); | ||
|
@@ -1539,7 +1539,7 @@ public void Events_CanPersistEventTracesInStream() | |
originalTrace.Enable(); | ||
|
||
InputSystem.QueueStateEvent(pen, new PenState { position = new Vector2(123, 234) }); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.A)); | ||
InputSystem.QueueStateEvent(gamepad, new GamepadState(GamepadButton.South)); | ||
InputSystem.QueueStateEvent(pen, new PenState { position = new Vector2(234, 345) }); | ||
|
||
InputSystem.Update(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -424,7 +424,7 @@ public void State_CanUpdateButtonStateUsingEvent() | |
|
||
Assert.That(gamepad.buttonEast.isPressed, Is.False); | ||
|
||
var newState = new GamepadState {buttons = 1 << (int)GamepadButton.B}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not expecting any changes needed to this file |
||
var newState = new GamepadState {buttons = 1 << (int)GamepadButton.East}; | ||
InputSystem.QueueStateEvent(gamepad, newState); | ||
InputSystem.Update(); | ||
|
||
|
@@ -440,7 +440,7 @@ public void State_CanDetectWhetherButtonStateHasChangedThisFrame() | |
Assert.That(gamepad.buttonEast.wasPressedThisFrame, Is.False); | ||
Assert.That(gamepad.buttonEast.wasReleasedThisFrame, Is.False); | ||
|
||
var firstState = new GamepadState {buttons = 1 << (int)GamepadButton.B}; | ||
var firstState = new GamepadState {buttons = 1 << (int)GamepadButton.East}; | ||
InputSystem.QueueStateEvent(gamepad, firstState); | ||
InputSystem.Update(); | ||
|
||
|
@@ -472,7 +472,7 @@ public void State_PressingAndReleasingButtonInSameFrame_ShowsStateChange(bool us | |
|
||
var gamepad = InputSystem.AddDevice<Gamepad>(); | ||
|
||
var firstState = new GamepadState {buttons = 1 << (int)GamepadButton.B}; | ||
var firstState = new GamepadState {buttons = 1 << (int)GamepadButton.East}; | ||
var secondState = new GamepadState {buttons = 0}; | ||
|
||
InputSystem.QueueStateEvent(gamepad, firstState); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -942,7 +942,7 @@ public void Users_CanDetectUseOfUnpairedDevice() | |
|
||
++InputUser.listenForUnpairedDeviceActivity; | ||
|
||
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftStick = new Vector2(1, 0)}.WithButton(GamepadButton.A)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't need to change either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is due to my first pass where I removed the aliased values. Will revert |
||
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftStick = new Vector2(1, 0)}.WithButton(GamepadButton.South)); | ||
InputSystem.Update(); | ||
|
||
Assert.That(receivedControls, Has.Count.EqualTo(2)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ however, it has to be formatted properly to pass verification tests. | |
|
||
### Changed | ||
- Use `ProfilerMarker` instead of `Profiler.BeginSample` and `Profiler.EndSample` when appropriate to enable recording of profiling data. | ||
- Removed aliased values in GamepadButton enum. | ||
|
||
|
||
### Added | ||
- Added tests for Input Action Editor UI for managing action maps (List, create, rename, delete) (ISX-2087) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,31 +255,31 @@ public enum GamepadButton | |
/// The upper action button on a gamepad. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="Y"/> and <see cref="Triangle"/> which are the Xbox and PlayStation controller names for this button. | ||
/// Identical to <see cref="North"/> and <see cref="North"/> which are the Xbox and PlayStation controller names for this button. | ||
|
||
/// </remarks> | ||
North = 4, | ||
|
||
/// <summary> | ||
/// The right action button on a gamepad. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="B"/> and <see cref="Circle"/> which are the Xbox and PlayStation controller names for this button. | ||
/// Identical to <see cref="East"/> and <see cref="East"/> which are the Xbox and PlayStation controller names for this button. | ||
/// </remarks> | ||
East = 5, | ||
|
||
/// <summary> | ||
/// The lower action button on a gamepad. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="A"/> and <see cref="Cross"/> which are the Xbox and PlayStation controller names for this button. | ||
/// Identical to <see cref="South"/> and <see cref="South"/> which are the Xbox and PlayStation controller names for this button. | ||
/// </remarks> | ||
South = 6, | ||
|
||
/// <summary> | ||
/// The left action button on a gamepad. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="X"/> and <see cref="Square"/> which are the Xbox and PlayStation controller names for this button. | ||
/// Identical to <see cref="West"/> and <see cref="West"/> which are the Xbox and PlayStation controller names for this button. | ||
/// </remarks> | ||
West = 7, | ||
|
||
|
@@ -326,64 +326,6 @@ public enum GamepadButton | |
/// The right trigger button on a gamepad. | ||
/// </summary> | ||
RightTrigger = 33, | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cannot remove these from this enum without requiring a major version revision since it would break public API for existing customers (and according to semver), hence this is not a viable way forward. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hadn't thought of this. I re-added the aliased enum values (although I did not reset them in the other files that used them to move towards north/south/east/west). I also added a slightly modified version of the aliased enum drawer from #1862 where we can remove values from the drawer. |
||
/// <summary> | ||
/// The X button on an Xbox controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="West"/>, which is the generic name of this button. | ||
/// </remarks> | ||
X = West, | ||
/// <summary> | ||
/// The Y button on an Xbox controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="North"/>, which is the generic name of this button. | ||
/// </remarks> | ||
Y = North, | ||
/// <summary> | ||
/// The A button on an Xbox controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="South"/>, which is the generic name of this button. | ||
/// </remarks> | ||
A = South, | ||
/// <summary> | ||
/// The B button on an Xbox controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="East"/>, which is the generic name of this button. | ||
/// </remarks> | ||
B = East, | ||
|
||
/// <summary> | ||
/// The cross button on a PlayStation controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="South"/>, which is the generic name of this button. | ||
/// </remarks> | ||
Cross = South, | ||
/// <summary> | ||
/// The square button on a PlayStation controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="West"/>, which is the generic name of this button. | ||
/// </remarks> | ||
Square = West, | ||
/// <summary> | ||
/// The triangle button on a PlayStation controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="North"/>, which is the generic name of this button. | ||
/// </remarks> | ||
Triangle = North, | ||
/// <summary> | ||
/// The circle button on a PlayStation controller. | ||
/// </summary> | ||
/// <remarks> | ||
/// Identical to <see cref="East"/>, which is the generic name of this button. | ||
/// </remarks> | ||
Circle = East, | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix shouldn't have any impact on existing tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hence I wouldn't expect any changes to any tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is due to my first pass where I removed the aliased values. Will revert