void PrintStickState(JoystickActivityArgs aState) { Console.WriteLine("X: {0} Y: {1} Z: {2}", aState.X, aState.Y, aState.Z); Console.WriteLine("R: {0}", aState.R); Console.WriteLine("POV: {0}", aState.POV); Console.WriteLine("A Button Is Pressed: {0}", aState.AButtonIsPressed); Console.WriteLine("Button 1: {0}", aState.IsButtonPressed(1)); Console.WriteLine("Button 2: {0}", aState.IsButtonPressed(2)); Console.WriteLine("Button 3: {0}", aState.IsButtonPressed(3)); Console.WriteLine("Button 4: {0}", aState.IsButtonPressed(4)); }
public static JoystickActivityArgs Create(Joystick aStick, float threshold, float offset) { joyinfoex_tag fStickInfo; fStickInfo = new joyinfoex_tag(); fStickInfo.dwSize = System.Runtime.InteropServices.Marshal.SizeOf(fStickInfo); fStickInfo.dwFlags = winmm.JOY_RETURNALL; winmm.joyGetPosEx(aStick.ID, ref fStickInfo); JoystickActivityArgs newState = new JoystickActivityArgs(aStick, fStickInfo, threshold, offset); return newState; }