예제 #1
0
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            Vector2       Mousepos = GetRealMousePos();
            KeyboardState keyboard = Keyboard.GetState();

            currentBounds = new Rectangle(((int)Mousepos.X / tileSize) * tileSize, ((int)Mousepos.Y / tileSize) * tileSize, tileSize, tileSize);

            //undo/redo
            if (keyboard.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) &&
                keyboard.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z) &&
                prevKeyboard.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Z) &&
                keyboard.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.LeftShift))
            {
                tileMapEditHandler.Undo(ref tileMap);
            }

            if (keyboard.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) &&
                keyboard.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift) &&
                keyboard.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z) &&
                prevKeyboard.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Z))
            {
                tileMapEditHandler.Redo(ref tileMap);
            }

            prevKeyboard = keyboard;
        }