Пример #1
0
 // Wand Availability
 public static int GetWandAvailability(
     ref bool wandAvailable,
     [MarshalAs(UnmanagedType.I4)] Input.WandTarget wandTarget)
 {
     // Implementation will be included in a future non-preview version of the SDK.
     return(0);
 }
Пример #2
0
 // Wand Controls State
 public static int GetControllerState(
     [MarshalAs(UnmanagedType.I4)] Input.WandTarget wandTarget,
     ref UInt32 buttons,
     [MarshalAs(UnmanagedType.LPArray, SizeConst = 2)] float[] stick,
     ref float trigger,
     ref Int64 timestamp)
 {
     // Implementation will be included in a future non-preview version of the SDK.
     return(0);
 }
Пример #3
0
        // TODO: We may want to change this to something like "GetWandStatus()",
        // returning a flags enum with options like "ready, disconnected, batteryLow" etc.
        public static bool GetWandAvailability(Input.WandTarget targetWand = Input.WandTarget.Primary)
        {
            bool wandAvailable = false;

            try
            {
                int result = NativePlugin.GetWandAvailability(ref wandAvailable, targetWand);
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
            }

            return(wandAvailable);
        }
Пример #4
0
        internal static bool GetWandControlsState(ref WandControlsState wandButtonsState, Input.WandTarget targetWand = Input.WandTarget.Primary)
        {
            int result = 1;

            try
            {
                UInt32  buttons   = 0;
                float[] stick     = new float[2];
                float   trigger   = 0f;
                Int64   timestamp = 0;

                result = NativePlugin.GetControllerState(targetWand, ref buttons, stick, ref trigger, ref timestamp);

                wandButtonsState = new WandControlsState(timestamp, buttons, new Vector2(stick[0], stick[1]), trigger);
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
            }


            return(0 == result);
        }