Przeglądaj źródła

Update Apos.Input

Jean-David Moisan 6 lat temu
rodzic
commit
3d62cfd821
2 zmienionych plików z 7 dodań i 7 usunięć
  1. 1 1
      Source/Apos.Gui.csproj
  2. 6 6
      Source/Default.cs

+ 1 - 1
Source/Apos.Gui.csproj

@@ -22,6 +22,6 @@
     <PackageReference Include="MonoGame.Framework.Portable" PrivateAssets="All" Version="3.6.0.1625" />
     <PackageReference Include="SpriteFontPlus.MonoGame" Version="0.7.0.22" />
     <PackageReference Include="Optional" Version="4.0.0" />
-    <PackageReference Include="Apos.Input" Version="0.4.0" />
+    <PackageReference Include="Apos.Input" Version="0.5.1" />
   </ItemGroup>
 </Project>

+ 6 - 6
Source/Default.cs

@@ -20,9 +20,9 @@ namespace Apos.Gui {
         /// The left mouse button requires that the component is hovered.
         /// </returns>
         public static Func<Component, bool> ConditionInteraction = (Component c) =>
-            c.HasFocus && (buttonReleased(s => s[0].Buttons.A) ||
+            c.HasFocus && (buttonReleased(GamePadButton.A, 0) ||
                            buttonReleased(Keys.Space) || buttonReleased(Keys.Enter)) ||
-            c.IsHovered && buttonReleased(s => s.LeftButton);
+            c.IsHovered && buttonReleased(MouseButton.LeftButton);
         /// <returns>
         /// Returns true when gamepad 0's left thumbstick has just been made positive or the up arrow key is released.
         /// </returns>
@@ -39,7 +39,7 @@ namespace Apos.Gui {
         /// Returns true when gamepad 0's B button is released or the escape key is released.
         /// </returns>
         public static Func<bool> ConditionBackFocus = () =>
-            buttonReleased(s => s[0].Buttons.B) ||
+            buttonReleased(GamePadButton.B, 0) ||
             buttonReleased(Keys.Escape);
         /// <returns>
         /// Always returns true. This is useful when you want a condition to mark an input as used.
@@ -129,11 +129,11 @@ namespace Apos.Gui {
         private static bool buttonReleased(Keys key) {
             return InputHelper.IsActive && ConditionKeyboard.Released(key);
         }
-        private static bool buttonReleased(Func<MouseState, ButtonState> button) {
+        private static bool buttonReleased(MouseButton button) {
             return InputHelper.IsActive && ConditionMouse.Released(button);
         }
-        private static bool buttonReleased(Func<GamePadState[], ButtonState> button) {
-            return InputHelper.IsActive && ConditionGamePad.Released(button);
+        private static bool buttonReleased(GamePadButton button, int gamePadIndex) {
+            return InputHelper.IsActive && ConditionGamePad.Released(button, gamePadIndex);
         }
     }
 }