Beispiel #1
0
        /// <summary>
        /// Tests skipping if key in VX is pressed
        /// Opcodes: 0xEX9E
        /// </summary>
        public void TestSkipIfPressed()
        {
            emu.progCounter = 0;
            emu.V[0x4]      = 0xB;
            emu.PressKey(0xC);
            emu.ExecuteInstruction(0xE49E);

            emu.progCounter = 0;
            emu.V[0x4]      = 0xC;
            emu.PressKey(0xC);
            emu.ExecuteInstruction(0xE49E);
            Assert.AreEqual(2, emu.progCounter);
        }
Beispiel #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // For Mobile devices, this logic will close the Game when the Back button is pressed
            // Exit() is obsolete on iOS
            oldKey = key;
            key    = Keyboard.GetState();

#if !__IOS__ && !__TVOS__
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
#endif
            for (int i = 0; i < 2; i++)
            {
                emu.Step();
            }

            Keys keyPressed = key.GetPressedKeys().Length > 0 ? key.GetPressedKeys().First() : Keys.None;
            if (emu.KeyboardTranslation.ContainsKey(keyPressed))
            {
                emu.PressKey(emu.KeyboardTranslation[keyPressed]);
            }


            base.Update(gameTime);
        }