Esempio n. 1
0
        private static void ManageYAxis(System.IntPtr device, System.IntPtr element, System.IntPtr value)
        {
            Engine.Joystick joystick = GetJoystick(device);
            if (joystick == null)
            {
                return;
            }
            int min  = MacNative.IOHIDElementGetLogicalMin(element).ToInt32();
            int max  = MacNative.IOHIDElementGetLogicalMax(element).ToInt32();
            int axis = MacNative.IOHIDValueGetIntegerValue(value).ToInt32();

            joystick.y = Normalize(axis, min, max);
        }
Esempio n. 2
0
        private static void ManageButtons(System.IntPtr device, System.IntPtr cookie, System.IntPtr value)
        {
            if (cookie.ToInt32() < 0 || cookie.ToInt32() > 19)
            {
                return;
            }
            Engine.Joystick joystick = GetJoystick(device);
            if (joystick == null)
            {
                return;
            }
            int buttonPressed = MacNative.IOHIDValueGetIntegerValue(value).ToInt32();

            joystick.buttons [cookie.ToInt32()] = buttonPressed >= 1;
        }