Exemplo n.º 1
0
        public override void keyEvent(KeyEvent e)
        {
            if (e.key == Keys.LeftShift && e.pressed){
                this.nextMapDisplay();
            } else if (e.key == Keys.LeftControl && e.pressed){
                this.nextMapZoom();
            }

            base.keyEvent(e);
        }
Exemplo n.º 2
0
 public virtual void keyEvent(KeyEvent e)
 {
     // Ignore this event
 }
Exemplo n.º 3
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)
        {
            Keys[] pressedKeys = Keyboard.GetState().GetPressedKeys();
            List<Keys> justPressedKeys = pressedKeys.ToList();
            foreach(Keys k in previousPressedKeys){
                justPressedKeys.Remove(k);
            }
            previousPressedKeys = pressedKeys;

            if ( justPressedKeys.Contains(Keys.Escape) ){
                this.Exit();
            }

            foreach (Keys k in justPressedKeys){
                KeyEvent ke = new KeyEvent();
                ke.key = k;
                ke.pressed = true;
                ke.released = false;
                ke.remainsPressed = false;
                this.gameScreenNode.keyEvent(ke);
            }

            base.Update(gameTime);
        }