示例#1
0
        /// <summary>
        /// #F7FE: 54321    +left
        /// </summary>
        private static long scan_F7FE(IKeyboardState state)
        {
            var res = 0L;

            if (state[Key.D1])
            {
                res |= 1;
            }
            if (state[Key.D2])
            {
                res |= 2;
            }
            if (state[Key.D3])
            {
                res |= 4;
            }
            if (state[Key.D4])
            {
                res |= 8;
            }
            if (state[Key.D5])
            {
                res |= 16;
            }

            if (state[Key.Escape])
            {
                res |= 1;
            }
            if (state[Key.LeftArrow])
            {
                res |= 16;
            }
            return(res);
        }
示例#2
0
        private static byte scan_FEFE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.LeftShift])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.Z])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.X])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.C])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.V])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#3
0
        /// <summary>
        /// Fills out the fields based on the MonoGame/XNA key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="shiftPressed">Helps identify which <see cref="Character"/> to use while the key is pressed. For example, if <see cref="Keys.A"/> is used the <see cref="Character"/> field will be either 'A' if <paramref name="shiftPressed"/> is true or 'a' if false.</param>
        /// <param name="state">Keyboar state to read from.</param>
        public void Fill(Keys key, bool shiftPressed, IKeyboardState state)
        {
            Key = key;
            bool numLock = state.NumLock;

            if (key >= Keys.A && key <= Keys.Z)
            {
                bool capsLock = state.CapsLock;
                Character = (char)(Key + (shiftPressed || capsLock ? CapOffset : LowerOffset));
                return;
            }

            if (shiftKeyMappings.ContainsKey(Key))
            {
                scases casesCur = shiftKeyMappings[Key];
                Character = shiftPressed ? casesCur.Item2 : casesCur.Item1;
                return;
            }

            if (s_numKeyMappings.ContainsKey(Key))
            {
                ncases casesCur = s_numKeyMappings[Key];
                Character = numLock ? casesCur.Item1 : (char)0;
                Key       = RemapVirtualKeys(Key, state);
                return;
            }

            Character = (char)0;
        }
示例#4
0
        /// <summary>
        /// Shortcut to get the <see cref="AsciiKey"/> for a specific MonoGame/XNA <see cref="Keys"/> type. Shift is considered not pressed.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="state">Keyboar state to read from.</param>
        /// <returns>The <see cref="AsciiKey"/> of the <see cref="Keys"/>.</returns>
        public static AsciiKey Get(Keys key, IKeyboardState state)
        {
            AsciiKey asciiKey = new AsciiKey();

            asciiKey.Fill(key, false, state);
            return(asciiKey);
        }
示例#5
0
        private ulong scanExtState(IKeyboardState state)
        {
            if (((state == null) || state[Key.LeftAlt]) || state[Key.RightAlt])
            {
                return(0);
            }
            ulong num = 0;

            if (state[Key.F11])
            {
                if (!m_nmiTriggered)
                {
                    m_nmiTriggered = true;
                    m_busManager.Events.RequestNmi(50000);
                }
            }
            else
            {
                m_nmiTriggered = false;
            }
            if (state[Key.F12])
            {
                m_cpu.RESET();
            }
            num = (num << 6) | scan_7F7E(state);
            num = (num << 6) | scan_BF7E(state);
            num = (num << 6) | scan_DF7E(state);
            num = (num << 6) | scan_EF7E(state);
            num = (num << 6) | scan_F77E(state);
            num = (num << 6) | scan_FB7E(state);
            num = (num << 6) | scan_FD7E(state);
            return((num << 6) | scan_FE7E(state));
        }
示例#6
0
        private static byte scan_FDFE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.A])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.S])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.D])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.F])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.G])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#7
0
        private static byte scan_BFFE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.Return])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.L])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.K])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.J])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.H])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#8
0
        private static byte scan_7FFE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.Space])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.RightShift])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.M])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.N])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.B])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#9
0
        private static byte scan_EFFE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.D0])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.D9])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.D8] || state[Key.RightArrow])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.D7] || state[Key.UpArrow])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.D6] || state[Key.DownArrow])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#10
0
        private static byte scan_DFFE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.P])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.O])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.I])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.U])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.Y])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#11
0
        private static byte scan_FBFE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.Q])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.W])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.E])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.R])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.T])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#12
0
        private static byte scan_F7FE(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.D1])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.D2])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.D3])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.D4])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.D5] || state[Key.LeftArrow])
            {
                num = (byte)(num | 0x10);
            }
            return(num);
        }
示例#13
0
        /// <summary>
        /// Shortcut to get the <see cref="AsciiKey"/> for a specific MonoGame/XNA <see cref="Keys"/> type.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="shiftPressed">If shift should be considered pressed or not.</param>
        /// <param name="state">Keyboar state to read from.</param>
        /// <returns>The <see cref="AsciiKey"/> of the <see cref="Keys"/>.</returns>
        public static AsciiKey Get(Keys key, bool shiftPressed, IKeyboardState state)
        {
            AsciiKey asciiKey = new AsciiKey();

            asciiKey.Fill(key, shiftPressed, state);
            return(asciiKey);
        }
示例#14
0
        public int[] Scan(IKeyboardState state)
        {
            //return _rowConditions
            //    .Select(arg => MakeRowValue(arg, state))
            //    .ToArray();
            // Optimized version:
            var result = new int[_rowConditions.Length];

            if (state == null)
            {
                return(result);
            }
            for (var j = 0; j < result.Length; j++)
            {
                var conditions = _rowConditions[j];
                var row        = 0;
                var mask       = 1;
                for (var i = 0; i < conditions.Length; i++, mask <<= 1)
                {
                    if (conditions[i](state))
                    {
                        row |= mask;
                    }
                }
                result[j] = row;
            }
            return(result);
        }
示例#15
0
        private static byte scan_FD7E(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.CapsLock])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.F2])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.Grave]) // ^ arrow
            {
                num = (byte)(num | 4);
            }
            if (state[Key.NumPad4])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.Apostrophe])
            {
                num = (byte)(num | 0x10);
            }
            if (state[Key.NumPad6])
            {
                num = (byte)(num | 0x20);
            }
            return(num);
        }
示例#16
0
        private static byte scan_FE7E(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.PageUp])
            {
                num = (byte)(num | 0x1);
            }
            if (state[Key.PageDown])
            {
                num = (byte)(num | 0x2);
            }
            if (state[Key.NumPad1])
            {
                num = (byte)(num | 0x8);
            }
            if (state[Key.NumPad2])
            {
                num = (byte)(num | 0x10);
            }
            if (state[Key.Period])
            {
                num = (byte)(num | 0x20);
            }
            return(num);
        }
示例#17
0
        private static byte scan_FB7E(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.Tab])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.F4])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.NumPad7])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.NumPad5])
            {
                num = (byte)(num | 0x10);
            }
            if (state[Key.NumPad9])
            {
                num = (byte)(num | 0x20);
            }
            return(num);
        }
示例#18
0
        private static byte scan_F77E(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.Escape]) // E-mode
            {
                num = (byte)(num | 1);
            }
            if (state[Key.F5])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.Delete])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.NumPadSlash])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.NumPad8])
            {
                num = (byte)(num | 0x10);
            }
            if (state[Key.NumPadMinus])
            {
                num = (byte)(num | 0x20);
            }
            return(num);
        }
示例#19
0
        private static byte scan_EF7E(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.Minus])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.Equals])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.BackSpace])
            {
                num = (byte)(num | 8);
            }
            if (state[Key.NumPadStar])
            {
                num = (byte)(num | 0x10);
            }
            if (state[Key.F6])
            {
                num = (byte)(num | 0x20);
            }
            return(num);
        }
示例#20
0
        private static byte scan_DF7E(IKeyboardState state)
        {
            byte num = 0;

            if (state[Key.SemiColon])
            {
                num = (byte)(num | 1);
            }
            if (state[Key.F3])
            {
                num = (byte)(num | 2);
            }
            if (state[Key.BackSlash])
            {
                num = (byte)(num | 4);
            }
            if (state[Key.RightBracket])
            {
                num = (byte)(num | 0x10);
            }
            if (state[Key.LeftBracket])
            {
                num = (byte)(num | 0x20);
            }
            return(num);
        }
示例#21
0
        public override void Initialize()
        {
            currentMouseState    = Mouse.GetState();
            lastMouseState       = Mouse.GetState();
            currentKeyboardState = Keyboard.GetState(Keys.Escape);
            lastKeyboardState    = Keyboard.GetState(Keys.Escape);

            reversiGame    = ReversiGame.CurrentGame;
            boardRectangle = boardRect;

            aiTypePieces = new Piece[2, AIMaxCount];
            AICount      = ReversiAIType.GetAINames().Length;
            AIIndex[0]   = GameSettings.DefaultAIIndex;
            AIIndex[1]   = GameSettings.DefaultAIIndex;
            board        = curGame.LoadContent <Texture2D>(@"Images\Board");
            settingBoard = curGame.LoadContent <Texture2D>(@"Images\SettingBoard");
            int pieceSize = boardRect.Width / ReversiGame.BoardSize;

            startButton = CreateChild <StartButton, Rectangle>(new Rectangle(boardRect.X + pieceSize * 3, boardRect.Y + pieceSize * 6, pieceSize * 2, pieceSize));
            startButton.Initialize(settingType);
            showPieces[0]                      = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X + pieceSize * 3, boardRect.Y + pieceSize * 2, pieceSize, pieceSize));
            showPieces[0].PieceState           = PieceState.Black;
            showPieces[1]                      = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X + pieceSize * 4, boardRect.Y + pieceSize * 2, pieceSize, pieceSize));
            showPieces[1].PieceState           = PieceState.White;
            playerTypePieces[0]                = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X + pieceSize * 1, boardRect.Y + pieceSize * 3, pieceSize, pieceSize));
            playerTypePieces[0].CurrentDisplay = DisplayState.CanMove;
            chooseIndex[0]                     = 0;
            PlayerType[0]                      = PlayerTypes.Human;
            playerTypePieces[1]                = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X + pieceSize * 2, boardRect.Y + pieceSize * 3, pieceSize, pieceSize));
            playerTypePieces[1].CurrentDisplay = DisplayState.Normal;
            playerTypePieces[2]                = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X + pieceSize * 5, boardRect.Y + pieceSize * 3, pieceSize, pieceSize));
            playerTypePieces[2].CurrentDisplay = DisplayState.CanMove;
            chooseIndex[1]                     = 2;
            PlayerType[1]                      = PlayerTypes.AI;
            playerTypePieces[3]                = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X + pieceSize * 6, boardRect.Y + pieceSize * 3, pieceSize, pieceSize));
            playerTypePieces[3].CurrentDisplay = DisplayState.Normal;
            for (int i = 0; i < AIMaxCount; i++)
            {
                aiTypePieces[0, i] = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X, boardRect.Y + pieceSize * (i + 3), pieceSize, pieceSize));
            }
            for (int i = 0; i < AIMaxCount; i++)
            {
                aiTypePieces[1, i] = CreateChild <Piece, Rectangle>(new Rectangle(boardRect.X + pieceSize * 7, boardRect.Y + pieceSize * (i + 3), pieceSize, pieceSize));
            }
            foreach (Piece piece in showPieces)
            {
                piece.ForceShow = true;
            }
            foreach (Piece piece in playerTypePieces)
            {
                piece.ForceShow = true;
            }
            foreach (Piece piece in aiTypePieces)
            {
                piece.ForceShow = true;
            }

            base.Initialize();
        }
示例#22
0
 public override void Initialize()
 {
     currentMouseState    = Mouse.GetState();
     lastMouseState       = Mouse.GetState();
     currentKeyboardState = Keyboard.GetState(Keys.LeftControl, Keys.RightControl, Keys.Z);
     lastKeyboardState    = Keyboard.GetState(Keys.LeftControl, Keys.RightControl, Keys.Z);
     base.Initialize();
 }
示例#23
0
        /// <summary>
        /// #EFFE: 67890    +down,up,right, bksp
        /// </summary>
        private static long scan_EFFE(IKeyboardState state)
        {
            var res = 0L;

            if (state[Key.D0])
            {
                res |= 1;
            }
            if (state[Key.D9])
            {
                res |= 2;
            }
            if (state[Key.D8])
            {
                res |= 4;
            }
            if (state[Key.D7])
            {
                res |= 8;
            }
            if (state[Key.D6])
            {
                res |= 16;
            }

            if (state[Key.RightArrow])
            {
                res |= 4;
            }
            if (state[Key.UpArrow])
            {
                res |= 8;
            }
            if (state[Key.DownArrow])
            {
                res |= 16;
            }
            if (state[Key.BackSpace])
            {
                res |= 1;
            }
            if (state[Key.RightShift] || state[Key.LeftShift])
            {
                if (state[Key.Minus])
                {
                    res |= 1;                                   // _ = SS+0
                }
            }
            else
            {
                if (state[Key.Apostrophe])
                {
                    res |= 8;                                   // ' = SS+7
                }
            }
            return(res);
        }
        public AGSTextBoxComponent(IBlockingEvent <TextBoxKeyPressingEventArgs> onPressingKey,
                                   IInput input, IGame game, IKeyboardState keyboardState, IFocusedUI focusedUi)
        {
            CaretFlashDelay = 10;
            _keyboardState  = keyboardState;
            _focusedUi      = focusedUi;
            OnPressingKey   = onPressingKey;
            _game           = game;

            input.KeyDown.Subscribe(onKeyDown);
            input.KeyUp.Subscribe(onKeyUp);
        }
示例#25
0
 private void addTestInputManagerStep()
 {
     AddStep("Add InputManager", () =>
     {
         testInputManager = new TestInputManager();
         Add(testInputManager);
         state    = testInputManager.CurrentState;
         mouse    = state.Mouse;
         keyboard = state.Keyboard;
         joystick = state.Joystick;
     });
 }
示例#26
0
        public override void Initialize()
        {
            buttonStartNormalTexture  = curGame.LoadContent <Texture2D>(@"Images\StartButton0");
            buttonStartRollTexture    = curGame.LoadContent <Texture2D>(@"Images\StartButton1");
            buttonResumeNormalTexture = curGame.LoadContent <Texture2D>(@"Images\ResumeButton0");
            buttonResumeRollTexture   = curGame.LoadContent <Texture2D>(@"Images\ResumeButton1");
            buttonRestartRollTexture  = curGame.LoadContent <Texture2D>(@"Images\ResumeButton2");

            currentMouseState    = Mouse.GetState();
            lastMouseState       = Mouse.GetState();
            currentKeyboardState = Keyboard.GetState(Keys.Enter);
            lastKeyboardState    = Keyboard.GetState(Keys.Enter);
        }
示例#27
0
 public void Scan()
 {
     _state = null;
     if (diKeyboard == null)
         return;
     if (!kbdActive)
     {
         WndActivated(null, null);
         return;
     }
     try { _state = new KeyboardStateWrapper(diKeyboard.GetCurrentKeyboardState()); }
     catch { WndActivated(null, null); return; }
 }
示例#28
0
        /// <summary>
        /// #FBFE: QWERT    +period,comma
        /// </summary>
        private static long scan_FBFE(IKeyboardState state)
        {
            var res = 0L;

            if (state[Key.Q])
            {
                res |= 1;
            }
            if (state[Key.W])
            {
                res |= 2;
            }
            if (state[Key.E])
            {
                res |= 4;
            }
            if (state[Key.R])
            {
                res |= 8;
            }
            if (state[Key.T])
            {
                res |= 16;
            }

            if (state[Key.F11])
            {
                res |= 1;                           // SS+Q
            }
            if (state[Key.F12])
            {
                res |= 2;                           // SS+W
            }
            if (state[Key.F5])
            {
                res |= 4 | ExtKeyMask;                  // E + b6
            }
            if (state[Key.RightShift] || state[Key.LeftShift])
            {
                if (state[Key.Period])
                {
                    res |= 16;
                }
                if (state[Key.Comma])
                {
                    res |= 8;
                }
            }
            return(res);
        }
示例#29
0
        private static long scanState(IKeyboardState state)
        {
            if (state==null || ((state[Key.LeftAlt] || state[Key.RightAlt])&&state[Key.Return]))
                return 0;

            long value = 0;
            value = (value << 5) | scan_7FFE(state);
            value = (value << 5) | scan_BFFE(state);
            value = (value << 5) | scan_DFFE(state);
            value = (value << 5) | scan_EFFE(state);
            value = (value << 5) | scan_F7FE(state);
            value = (value << 5) | scan_FBFE(state);
            value = (value << 5) | scan_FDFE(state);
            value = (value << 5) | scan_FEFE(state);
            return value;
        }
示例#30
0
        /// <summary>
        ///  Does any necessary remapping for virtual keys.
        /// </summary>
        /// <param name="key"> The key to be remapped. </param>
        /// <param name="state">Keyboar state to read numlock.</param>
        /// <returns> The remapped key. </returns>
        public static Keys RemapVirtualKeys(Keys key, IKeyboardState state)
        {
            bool numLock = state.NumLock;

            if (numLock)
            {
                return(key);
            }

            if (s_numKeyMappings.ContainsKey(key))
            {
                return(s_numKeyMappings[key].Item2);
            }

            return(key);
        }
示例#31
0
 private static long scanState(IKeyboardState state)
 {
     if (((state == null) || state[Key.LeftAlt]) || state[Key.RightAlt])
     {
         return 0;
     }
     long num = 0;
     num = (num << 5) | scan_7FFE(state);
     num = (num << 5) | scan_BFFE(state);
     num = (num << 5) | scan_DFFE(state);
     num = (num << 5) | scan_EFFE(state);
     num = (num << 5) | scan_F7FE(state);
     num = (num << 5) | scan_FBFE(state);
     num = (num << 5) | scan_FDFE(state);
     return ((num << 5) | scan_FEFE(state));
 }
示例#32
0
        /// <summary>
        /// #FDFE: GFDSA
        /// </summary>
        private static long scan_FDFE(IKeyboardState state)
        {
            var res = 0L;

            if (state[Key.A])
            {
                res |= 1;
            }
            if (state[Key.S])
            {
                res |= 2;
            }
            if (state[Key.D])
            {
                res |= 4;
            }
            if (state[Key.F])
            {
                res |= 8;
            }
            if (state[Key.G])
            {
                res |= 16;
            }

            if (state[Key.BackSlash])
            {
                res |= 4;                           // SS+D
            }
            if (state[Key.F1])
            {
                res |= 1 | ExtKeyMask;                  // A + b6
            }
            if (state[Key.F4])
            {
                res |= 4 | ExtKeyMask;                  // D + b6
            }
            if (state[Key.F6])
            {
                res |= 8 | ExtKeyMask;                  // F + b6
            }
            if (state[Key.F7])
            {
                res |= 16 | ExtKeyMask;                 // G + b6
            }
            return(res);
        }
示例#33
0
        private static long scanState(IKeyboardState state)
        {
            if (((state == null) || state[Key.LeftAlt]) || state[Key.RightAlt])
            {
                return(0);
            }
            long num = 0;

            num = (num << 5) | scan_7FFE(state);
            num = (num << 5) | scan_BFFE(state);
            num = (num << 5) | scan_DFFE(state);
            num = (num << 5) | scan_EFFE(state);
            num = (num << 5) | scan_F7FE(state);
            num = (num << 5) | scan_FBFE(state);
            num = (num << 5) | scan_FDFE(state);
            return((num << 5) | scan_FEFE(state));
        }
示例#34
0
 private static byte scan_F77E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.Escape]) // E-mode
     {
         num = (byte)(num | 1);
     }
     if (state[Key.F5])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.Delete])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.NumPadSlash])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.NumPad8])
     {
         num = (byte)(num | 0x10);
     }
     if (state[Key.NumPadMinus])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#35
0
 private static byte scan_F7FE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.D1])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.D2])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.D3])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.D4])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.D5] || state[Key.LeftArrow])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }
示例#36
0
        /// <summary>
        /// #FEFE: VCXZ[caps]     +left,right,up,down,bksp
        /// </summary>
        private static long scan_FEFE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.LeftControl] || state[Key.RightControl]) res |= 1;
            if (state[Key.Z]) res |= 2;
            if (state[Key.X]) res |= 4;
            if (state[Key.C]) res |= 8;
            if (state[Key.V]) res |= 16;

            if (state[Key.F3]) res |= 8 | ExtKeyMask;      // C + b6

            if (state[Key.Escape]) res |= 1;
            if (state[Key.LeftArrow]) res |= 1;
            if (state[Key.RightArrow]) res |= 1;
            if (state[Key.UpArrow]) res |= 1;
            if (state[Key.DownArrow]) res |= 1;
            if (state[Key.BackSpace]) res |= 1;
            if (state[Key.CapsLock]) res |= 1;
            if (state[Key.Tab]) res |= 1;
            if (state[Key.NumPadSlash]) res |= 16;
            if (state[Key.RightShift] || state[Key.LeftShift])
            {
                if (state[Key.SemiColon]) res |= 2;
                if (state[Key.Slash]) res |= 8;
            }
            else
            {
                if (state[Key.Slash]) res |= 16;
            }
            return res;
        }
示例#37
0
        /// <summary>
        /// #BFFE: HJKL[enter]
        /// </summary>
        private static long scan_BFFE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.Return]) res |= 1;
            if (state[Key.L]) res |= 2;
            if (state[Key.K]) res |= 4;
            if (state[Key.J]) res |= 8;
            if (state[Key.H]) res |= 16;

            if (state[Key.LeftAlt]) res |= 1;       // SS+ENTER

            if (state[Key.F8]) res |= 16 | ExtKeyMask;  // H + b6
            if (state[Key.F10]) res |= 8 | ExtKeyMask;  // J + b6
            if (state[Key.Home]) res |= 4 | ExtKeyMask; // K + b6
            if (state[Key.End]) res |= 2 | ExtKeyMask;  // L + b6

            if (state[Key.NumPadEnter]) res |= 1;
            if (state[Key.NumPadMinus]) res |= 8;
            if (state[Key.NumPadPlus]) res |= 4;
            if (state[Key.RightShift] || state[Key.LeftShift])
            {
                if (state[Key.Equals]) res |= 4;
            }
            else
            {
                if (state[Key.Minus]) res |= 8;
                if (state[Key.Equals]) res |= 2;
            }
            return res;
        }
示例#38
0
 private static byte scan_7FFE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.Space])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.RightShift])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.M])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.N])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.B])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }
示例#39
0
 private static byte scan_BFFE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.Return])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.L])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.K])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.J])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.H])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }
示例#40
0
 private static byte scan_DFFE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.P])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.O])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.I])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.U])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.Y])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }
示例#41
0
 private static byte scan_FEFE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.LeftShift])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.Z])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.X])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.C])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.V])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }
示例#42
0
 private ulong scanExtState(IKeyboardState state)
 {
     if (((state == null) || state[Key.LeftAlt]) || state[Key.RightAlt])
     {
         return 0;
     }
     ulong num = 0;
     if (state[Key.F11])
     {
         m_cpu.NMI = true;
     }
     if (state[Key.F12])
     {
         m_cpu.RESET();
     }
     num = (num << 6) | scan_7F7E(state);
     num = (num << 6) | scan_BF7E(state);
     num = (num << 6) | scan_DF7E(state);
     num = (num << 6) | scan_EF7E(state);
     num = (num << 6) | scan_F77E(state);
     num = (num << 6) | scan_FB7E(state);
     num = (num << 6) | scan_FD7E(state);
     return ((num << 6) | scan_FE7E(state));
 }
示例#43
0
        /// <summary>
        /// #FBFE: QWERT    +period,comma
        /// </summary>
        private static long scan_FBFE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.Q]) res |= 1;
            if (state[Key.W]) res |= 2;
            if (state[Key.E]) res |= 4;
            if (state[Key.R]) res |= 8;
            if (state[Key.T]) res |= 16;

            if (state[Key.F11]) res |= 1;           // SS+Q
            if (state[Key.F12]) res |= 2;           // SS+W

            if (state[Key.F5]) res |= 4 | ExtKeyMask;   // E + b6

            if (state[Key.RightShift] || state[Key.LeftShift])
            {
                if (state[Key.Period]) res |= 16;
                if (state[Key.Comma]) res |= 8;
            }
            return res;
        }
示例#44
0
 private static byte scan_7F7E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.F1])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.NumPad0])
     {
         num = (byte)(num | 8);
     }
     if (state[(Key)83])
     {
         Logger.GetLogger().LogTrace("NUMPAD DOT PRESSED!!!");
         num = (byte)(num | 0x10);
     }
     if (state[Key.NumPadPlus])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#45
0
        /// <summary>
        /// #7FFE: BNM[symbol][space]    +'
        /// </summary>
        private static long scan_7FFE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.Space]) res |= 1;
            if (state[Key.RightShift] || state[Key.LeftShift]) res |= 2;
            if (state[Key.M]) res |= 4;
            if (state[Key.N]) res |= 8;
            if (state[Key.B]) res |= 16;

            if (state[Key.LeftAlt]) res |= 2;       // SS+ENTER
            if (state[Key.RightAlt]) res |= 2 | 1;  // SS+SPACE
            if (state[Key.F11]) res |= 2;           // SS+Q
            if (state[Key.F12]) res |= 2;           // SS+W
            if (state[Key.BackSlash]) res |= 2;     // SS+D
            if (state[Key.LeftBracket]) res |= 2;   // SS+Y
            if (state[Key.RightBracket]) res |= 2;  // SS+U

            if (state[Key.F2]) res |= 16 | ExtKeyMask;      // B + b6
            if (state[Key.PageUp]) res |= 4 | ExtKeyMask;   // M + b6
            if (state[Key.PageDown]) res |= 8 | ExtKeyMask; // N + b6

            if (state[Key.CapsLock] || state[Key.NumPadPlus] || state[Key.NumPadMinus] || state[Key.NumPadStar] || state[Key.NumPadSlash])
                res |= 2;                                                            // numpad CapsLock +-*/
            if (state[Key.Period] || state[Key.Comma] || state[Key.SemiColon] ||
                state[Key.Apostrophe] || state[Key.Slash] ||
                state[Key.Minus] || state[Key.Equals] || state[Key.LeftBracket] ||
                state[Key.RightBracket])
                res |= 2;                                                            // SS for .,;"/-=[]

            if (state[Key.NumPadStar]) res |= 16;                                    // * = SS+B
            if (!state[Key.RightShift] && !state[Key.LeftShift])
            {
                if (state[Key.Period]) res |= 4;
                if (state[Key.Comma]) res |= 8;
            }
            return res;
        }
示例#46
0
 private long scanState(IKeyboardState state)
 {
     if (state == null || ((state[Key.LeftAlt] || state[Key.RightAlt]) && state[Key.Return]))
         return 0;
     long value = 0;
     value = (value << 5) | scan_7FFE(state) | value & ExtKeyMask;    // BNM[symbol][space]
     value = (value << 5) | scan_BFFE(state) | value & ExtKeyMask;    // HJKL[enter]
     value = (value << 5) | scan_DFFE(state) | value & ExtKeyMask;    // YUIOP
     value = (value << 5) | scan_EFFE(state) | value & ExtKeyMask;    // 67890
     value = (value << 5) | scan_F7FE(state) | value & ExtKeyMask;    // 54321
     value = (value << 5) | scan_FBFE(state) | value & ExtKeyMask;    // QWERT
     value = (value << 5) | scan_FDFE(state) | value & ExtKeyMask;    // GFDSA
     value = (value << 5) | scan_FEFE(state) | value & ExtKeyMask;    // VCXZ[caps]
     return value;
 }
示例#47
0
 private static byte scan_EFFE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.D0])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.D9])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.D8] || state[Key.RightArrow])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.D7] || state[Key.UpArrow])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.D6] || state[Key.DownArrow])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }
示例#48
0
        /// <summary>
        /// #EFFE: 67890    +down,up,right, bksp
        /// </summary>
        private static long scan_EFFE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.D0]) res |= 1;
            if (state[Key.D9]) res |= 2;
            if (state[Key.D8]) res |= 4;
            if (state[Key.D7]) res |= 8;
            if (state[Key.D6]) res |= 16;

            if (state[Key.RightArrow]) res |= 4;
            if (state[Key.UpArrow]) res |= 8;
            if (state[Key.DownArrow]) res |= 16;
            if (state[Key.BackSpace]) res |= 1;
            if (state[Key.RightShift] || state[Key.LeftShift])
            {
                if (state[Key.Minus]) res |= 1;                 // _ = SS+0
            }
            else
            {
                if (state[Key.Apostrophe]) res |= 8;            // ' = SS+7
            }
            return res;
        }
示例#49
0
 private static byte scan_EF7E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.Minus])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.Equals])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.BackSpace])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.NumPadStar])
     {
         num = (byte)(num | 0x10);
     }
     if (state[Key.F6])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#50
0
        /// <summary>
        /// #DFFE: YUIOP    +",'
        /// </summary>
        private static long scan_DFFE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.P]) res |= 1;
            if (state[Key.O]) res |= 2;
            if (state[Key.I]) res |= 4;
            if (state[Key.U]) res |= 8;
            if (state[Key.Y]) res |= 16;

            if (state[Key.LeftBracket]) res |= 16;      // SS+Y
            if (state[Key.RightBracket]) res |= 8;      // SS+U

            if (state[Key.F9]) res |= 4 | ExtKeyMask;       // I + b6
            if (state[Key.Insert]) res |= 2 | ExtKeyMask;   // O + b6
            if (state[Key.Delete]) res |= 1 | ExtKeyMask;   // P + b6

            if (state[Key.Tab]) res |= 4;
            if (state[Key.RightShift] || state[Key.LeftShift])
            {
                if (state[Key.Apostrophe]) res |= 1;            // " = SS+P
            }
            else
            {
                if (state[Key.SemiColon]) res |= 2;             // ; = SS+O
            }
            return res;
        }
示例#51
0
 private static byte scan_DF7E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.SemiColon])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.F3])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.BackSlash])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.RightBracket])
     {
         num = (byte)(num | 0x10);
     }
     if (state[Key.LeftBracket])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#52
0
 private static byte scan_FD7E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.CapsLock])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.F2])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.Grave]) // ^ arrow
     {
         num = (byte)(num | 4);
     }
     if (state[Key.NumPad4])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.Apostrophe])
     {
         num = (byte)(num | 0x10);
     }
     if (state[Key.NumPad6])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#53
0
 private static byte scan_BF7E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.Comma])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.Slash])
     {
         num = (byte)(num | 0x10);
     }
     if (state[Key.NumPad3])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#54
0
 private static byte scan_FBFE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.Q])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.W])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.E])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.R])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.T])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }
示例#55
0
        private static byte scan_7FFE(IKeyboardState state)
        {
            byte res = 0;
            if (state[Key.Space]) res |= 1;
            if (state[Key.RightShift]) res |= 2;
            if (state[Key.M]) res |= 4;
            if (state[Key.N]) res |= 8;
            if (state[Key.B]) res |= 16;

            if (state[Key.CapsLock] || state[Key.NumPadPlus] || state[Key.NumPadMinus] || state[Key.NumPadStar] || state[Key.NumPadSlash])
                res |= 2;                                                            // numpad CapsLock +-*/
            if (state[Key.Period] || state[Key.Comma] || state[Key.SemiColon] ||
                state[Key.Apostrophe] || state[Key.Slash] ||
                state[Key.Minus] || state[Key.Equals] || state[Key.LeftBracket] ||
                state[Key.RightBracket])
                res |= 2;                                                            // SS for .,;"/-=[]

            if (state[Key.NumPadStar]) res |= 16;                                    // * = SS+B
            if (!state[Key.RightShift])
            {
                if (state[Key.Period]) res |= 4;
                if (state[Key.Comma]) res |= 8;
            }
            return res;
        }
示例#56
0
 private static byte scan_FB7E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.Tab])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.F4])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.NumPad7])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.NumPad5])
     {
         num = (byte)(num | 0x10);
     }
     if (state[Key.NumPad9])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#57
0
 private static byte scan_FE7E(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.PageUp])
     {
         num = (byte)(num | 0x1);
     }
     if (state[Key.PageDown])
     {
         num = (byte)(num | 0x2);
     }
     if (state[Key.NumPad1])
     {
         num = (byte)(num | 0x8);
     }
     if (state[Key.NumPad2])
     {
         num = (byte)(num | 0x10);
     }
     if (state[Key.Period])
     {
         num = (byte)(num | 0x20);
     }
     return num;
 }
示例#58
0
        /// <summary>
        /// #FDFE: GFDSA
        /// </summary>
        private static long scan_FDFE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.A]) res |= 1;
            if (state[Key.S]) res |= 2;
            if (state[Key.D]) res |= 4;
            if (state[Key.F]) res |= 8;
            if (state[Key.G]) res |= 16;

            if (state[Key.BackSlash]) res |= 4;     // SS+D

            if (state[Key.F1]) res |= 1 | ExtKeyMask;   // A + b6
            if (state[Key.F4]) res |= 4 | ExtKeyMask;   // D + b6
            if (state[Key.F6]) res |= 8 | ExtKeyMask;   // F + b6
            if (state[Key.F7]) res |= 16 | ExtKeyMask;  // G + b6
            return res;
        }
示例#59
0
        /// <summary>
        /// #F7FE: 54321    +left
        /// </summary>
        private static long scan_F7FE(IKeyboardState state)
        {
            var res = 0L;
            if (state[Key.D1]) res |= 1;
            if (state[Key.D2]) res |= 2;
            if (state[Key.D3]) res |= 4;
            if (state[Key.D4]) res |= 8;
            if (state[Key.D5]) res |= 16;

            if (state[Key.Escape]) res |= 1;
            if (state[Key.LeftArrow]) res |= 16;
            return res;
        }
示例#60
0
 private static byte scan_FDFE(IKeyboardState state)
 {
     byte num = 0;
     if (state[Key.A])
     {
         num = (byte)(num | 1);
     }
     if (state[Key.S])
     {
         num = (byte)(num | 2);
     }
     if (state[Key.D])
     {
         num = (byte)(num | 4);
     }
     if (state[Key.F])
     {
         num = (byte)(num | 8);
     }
     if (state[Key.G])
     {
         num = (byte)(num | 0x10);
     }
     return num;
 }