diff options
author | ClxS <slxxls92@gmail.com> | 2016-03-07 17:25:51 +0000 |
---|---|---|
committer | ClxS <slxxls92@gmail.com> | 2016-03-07 17:25:51 +0000 |
commit | 0462c9de79a2f1a02e720ac24400d1bf00f74680 (patch) | |
tree | 9b33ca49e7780ac3597908a487a82efa779c7eb1 /StardewModdingAPI/Events | |
parent | ba6420efac4a3cb158ea343b926ba5cfeaf783a8 (diff) | |
download | SMAPI-0462c9de79a2f1a02e720ac24400d1bf00f74680.tar.gz SMAPI-0462c9de79a2f1a02e720ac24400d1bf00f74680.tar.bz2 SMAPI-0462c9de79a2f1a02e720ac24400d1bf00f74680.zip |
Finished gamepad input events
Diffstat (limited to 'StardewModdingAPI/Events')
-rw-r--r-- | StardewModdingAPI/Events/Controls.cs | 12 | ||||
-rw-r--r-- | StardewModdingAPI/Events/EventArgs.cs | 30 |
2 files changed, 40 insertions, 2 deletions
diff --git a/StardewModdingAPI/Events/Controls.cs b/StardewModdingAPI/Events/Controls.cs index fa344bab..c79c28f6 100644 --- a/StardewModdingAPI/Events/Controls.cs +++ b/StardewModdingAPI/Events/Controls.cs @@ -16,6 +16,8 @@ namespace StardewModdingAPI.Events public static event EventHandler<EventArgsMouseStateChanged> MouseChanged = delegate { };
public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed = delegate { };
public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased = delegate { };
+ public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { };
+ public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { };
public static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
{
@@ -46,5 +48,15 @@ namespace StardewModdingAPI.Events {
ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons));
}
+
+ public static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
+ {
+ ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value));
+ }
+
+ public static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
+ {
+ ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value));
+ }
}
}
diff --git a/StardewModdingAPI/Events/EventArgs.cs b/StardewModdingAPI/Events/EventArgs.cs index 6c5e1401..ee30b406 100644 --- a/StardewModdingAPI/Events/EventArgs.cs +++ b/StardewModdingAPI/Events/EventArgs.cs @@ -38,7 +38,7 @@ namespace StardewModdingAPI.Events PlayerIndex = playerIndex;
ButtonPressed = buttonPressed;
}
- public PlayerIndex PlayerIndex;
+ public PlayerIndex PlayerIndex { get; private set; }
public Buttons ButtonPressed { get; private set; }
}
@@ -49,10 +49,36 @@ namespace StardewModdingAPI.Events PlayerIndex = playerIndex;
ButtonReleased = buttonReleased;
}
- public PlayerIndex PlayerIndex;
+ public PlayerIndex PlayerIndex { get; private set; }
public Buttons ButtonReleased { get; private set; }
}
+ public class EventArgsControllerTriggerPressed : EventArgs
+ {
+ public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons buttonPressed, float value)
+ {
+ PlayerIndex = playerIndex;
+ ButtonPressed = buttonPressed;
+ Value = value;
+ }
+ public PlayerIndex PlayerIndex { get; private set; }
+ public Buttons ButtonPressed { get; private set; }
+ public float Value { get; private set; }
+ }
+
+ public class EventArgsControllerTriggerReleased : EventArgs
+ {
+ public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons buttonReleased, float value)
+ {
+ PlayerIndex = playerIndex;
+ ButtonReleased = buttonReleased;
+ Value = value;
+ }
+ public PlayerIndex PlayerIndex { get; private set; }
+ public Buttons ButtonReleased { get; private set; }
+ public float Value { get; private set; }
+ }
+
public class EventArgsMouseStateChanged : EventArgs
{
public EventArgsMouseStateChanged(MouseState priorState, MouseState newState)
|