17.01.2021
+ WPF-Support + Game Controller System + GameKeybind System + SM_WPF_TEST
This commit is contained in:
parent
af90d617d3
commit
6f23a80f7f
60 changed files with 1536 additions and 143 deletions
45
SMOptionals/SM.Game/Controls/GameControllerStateButtons.cs
Normal file
45
SMOptionals/SM.Game/Controls/GameControllerStateButtons.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using SharpDX.XInput;
|
||||
|
||||
namespace SM.Game.Controls
|
||||
{
|
||||
public struct GameControllerStateButtons
|
||||
{
|
||||
public static GameControllerStateButtons Default = new GameControllerStateButtons(GamepadButtonFlags.None);
|
||||
|
||||
private GamepadButtonFlags _buttonFlags;
|
||||
|
||||
public bool X;
|
||||
public bool Y;
|
||||
public bool A;
|
||||
public bool B;
|
||||
|
||||
public bool LB;
|
||||
public bool RB;
|
||||
|
||||
public bool LeftThumb;
|
||||
public bool RightThumb;
|
||||
|
||||
public bool this[GamepadButtonFlags flags] => _buttonFlags.HasFlag(flags);
|
||||
|
||||
internal GameControllerStateButtons(GamepadButtonFlags flags)
|
||||
{
|
||||
_buttonFlags = flags;
|
||||
|
||||
X = flags.HasFlag(GamepadButtonFlags.X);
|
||||
Y = flags.HasFlag(GamepadButtonFlags.Y);
|
||||
A = flags.HasFlag(GamepadButtonFlags.A);
|
||||
B = flags.HasFlag(GamepadButtonFlags.B);
|
||||
|
||||
LB = flags.HasFlag(GamepadButtonFlags.LeftShoulder);
|
||||
RB = flags.HasFlag(GamepadButtonFlags.RightShoulder);
|
||||
|
||||
LeftThumb = flags.HasFlag(GamepadButtonFlags.LeftThumb);
|
||||
RightThumb = flags.HasFlag(GamepadButtonFlags.RightThumb);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"X: {(X ? "1" : "0")}; Y: {(Y ? "1" : "0")}; A: {(A ? "1" : "0")}; B: {(B ? "1" : "0")}; LB: {(LB ? "1" : "0")}; RB: {(RB ? "1" : "0")}; LT: {(LeftThumb ? "1" : "0")}; RT: {(RightThumb ? "1" : "0")}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue