public void TestOneButtonRelease()
        {
            ControlBoardListenerAccessor target = new ControlBoardListenerAccessor();

            JoystickVal val = new JoystickVal();
            val.Buttons = 0x04;

            List<ControlButton> buttons = target.GetButtonListList(val);

            Assert.AreEqual(1, buttons.Count);
            Assert.AreEqual(0, buttons[0].ButtonNr);
            Assert.AreEqual(false, buttons[0].IsPressed);
            Assert.AreEqual(true, buttons[0].IsReleased);
        }
示例#2
0
        protected static List<ControlButton> GetButtonValues(JoystickVal val)
        {
            List<ControlButton> listButtons = new List<ControlButton>();

            int j = 0;
            for (int i = 1; i <= 0x10; i <<= 4)
            {
                ControlButton b = GetButton(val, i, j++);

                if (b != null) listButtons.Add(b);
            }

            return listButtons;
        }
示例#3
0
 private void SetDefault()
 {
     val = new JoystickVal();
     ButtonVal = 1;
 }
示例#4
0
 private void ControlListener_OnAchsisChanged(int methodid, JoystickVal val)
 {
     TurnContinuous(val.Value, val.Nr);
 }
 public List<ControlButton> GetButtonListList(JoystickVal val)
 {
     return ControlBoardListener.GetButtonValues(val);
 }
示例#6
0
        private static ControlButton GetButton(JoystickVal val, int mask, int nr)
        {
            ControlButton b = null;

            if ((val.Buttons & mask) > 0)
            {
                b = new ControlButton();
                b.IsPressed = true;
            }
            else if ((val.Buttons & (mask << 2)) > 0)
            {
                b = new ControlButton();
                b.IsReleased = true;
            }

            // The MH-Nr is also the player-nr!
            if (b != null)
            {
                b.ButtonNr = nr;
                b.PlayerNr = val.Nr;
            }

            return b;
        }