I am looking to print something on the terminal in VS 2019, .NET Core 3 using SharpDX.XInput for the joystick. Maybe some value -1 if the joystick is pushed to the left and 1 if the joystick is pushed to the right. This is the code I'm currenlty using but I'm stuck with Printing a value to the screen:
namespace XboxC { class Program {
Controller controller;
Gamepad gamepad;
public bool connected = false;
public int deadband = 2500;
public Point leftThumb, rightThumb = new Point(0,0);
public float leftTrigger, rightTrigger;
public Program()
{
controller = new Controller(UserIndex.One);
connected = controller.IsConnected;
}
public static void Main()
{
}
public void Update()
{
if (!connected)
return;
gamepad = controller.GetState().Gamepad;
leftThumb.X = (int)((Math.Abs((float)gamepad.LeftThumbX) < deadband) ? 0 : (float)gamepad.LeftThumbX / short.MinValue * -100);
leftThumb.Y = (int)((Math.Abs((float)gamepad.LeftThumbY) < deadband) ? 0 : (float)gamepad.LeftThumbY / short.MaxValue * 100);
rightThumb.X = (int)((Math.Abs((float)gamepad.RightThumbX) < deadband) ? 0 : (float)gamepad.RightThumbX / short.MaxValue * 100);
rightThumb.Y = (int)((Math.Abs((float)gamepad.RightThumbY) < deadband) ? 0 : (float)gamepad.RightThumbY / short.MaxValue * 100);
leftTrigger = gamepad.LeftTrigger;
rightTrigger = gamepad.RightTrigger;
}
}
}