17.01.2021

+ WPF-Support
+ Game Controller System
+ GameKeybind System

+ SM_WPF_TEST
This commit is contained in:
Michel Fedde 2021-01-17 21:13:37 +01:00
parent af90d617d3
commit 6f23a80f7f
60 changed files with 1536 additions and 143 deletions

View file

@ -0,0 +1,39 @@
using SharpDX.XInput;
namespace SM.Game.Controls
{
public struct GameController
{
public static float GlobalDeadband = 2500;
private Controller _controller;
public float Deadband { get; set; }
public bool IsConnected => _controller.IsConnected;
public UserIndex Index { get; private set; }
public GameController(int id) : this((UserIndex)id)
{}
public GameController(UserIndex index = UserIndex.Any)
{
_controller = new Controller(index);
Index = index;
Deadband = GlobalDeadband;
}
public GameControllerState GetState()
{
if (!IsConnected)
{
return new GameControllerState(true);
}
Gamepad state = _controller.GetState().Gamepad;
return new GameControllerState(state, ref this);
}
}
}