Guest User

Untitled

a guest
Mar 22nd, 2013
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. public static class Sixense
  9. {
  10.     public struct ControllerData
  11.     {
  12.         public float pos_x;
  13.         public float pos_y;
  14.         public float pos_z;
  15.         public float rot_mat_00;
  16.         public float rot_mat_01;
  17.         public float rot_mat_02;
  18.         public float rot_mat_10;
  19.         public float rot_mat_11;
  20.         public float rot_mat_12;
  21.         public float rot_mat_20;
  22.         public float rot_mat_21;
  23.         public float rot_mat_22;
  24.         public float joystick_x;
  25.         public float joystick_y;
  26.         public float trigger;
  27.         public uint buttons;
  28.         public byte sequence_number;
  29.         public float rot_quat0;
  30.         public float rot_quat1;
  31.         public float rot_quat2;
  32.         public float rot_quat3;
  33.         public ushort firmware_revision;
  34.         public ushort hardware_revision;
  35.         public ushort packet_type;
  36.         public ushort magnetic_frequency;
  37.         public int enabled;
  38.         public int controller_index;
  39.         public byte is_docked;
  40.         public byte which_hand;
  41.         public byte hemi_tracking_enabled;
  42.     }
  43.  
  44.     public struct ControllerAngles
  45.     {
  46.         public float yaw;
  47.         public float pitch;
  48.         public float roll;
  49.     }
  50.  
  51.     public const int SUCCESS = 0;
  52.     public const int FAILURE = 1;
  53.  
  54.     public const int BUTTON_BUMPER = (0x01 << 7);
  55.     public const int BUTTON_JOYSTICK = (0x01 << 8);
  56.     public const int BUTTON_1 = (0x01 << 5);
  57.     public const int BUTTON_2 = (0x01 << 6);
  58.     public const int BUTTON_3 = (0x01 << 3);
  59.     public const int BUTTON_4 = (0x01 << 4);
  60.     public const int BUTTON_START = (0x01 << 0);
  61.  
  62.  
  63.     [DllImport("sixense.dll", SetLastError = false, EntryPoint = "sixenseInit", CallingConvention = CallingConvention.Cdecl)]
  64.     public static extern int Init();
  65.  
  66.     [DllImport("sixense.dll", SetLastError = false, EntryPoint = "sixenseExit", CallingConvention = CallingConvention.Cdecl)]
  67.     public static extern int Exit();
  68.  
  69.     [DllImport("sixense.dll", SetLastError = false, EntryPoint = "sixenseIsBaseConnected", CallingConvention = CallingConvention.Cdecl)]
  70.     public static extern int IsBaseConnected(int base_num);
  71.  
  72.     [DllImport("sixense.dll", SetLastError = false, EntryPoint = "sixenseSetActiveBase", CallingConvention = CallingConvention.Cdecl)]
  73.     public static extern int SetActiveBase(int base_num);
  74.  
  75.     [DllImport("sixense.dll", SetLastError = false, EntryPoint = "sixenseGetNewestData", CallingConvention = CallingConvention.Cdecl)]
  76.     public static extern int GetNewestData(int which, out ControllerData data);
  77. }
Advertisement
Add Comment
Please, Sign In to add comment