Example #1
0
        public void Update(GameTime gameTime, MouseController mouse)
        {
            /*TODO: DO NOT ASSUME STARING POSITION IS 0,0 (IMAGINE POSSIBILITY OF OFFSET) */
            int xTileOver = (int)(mouse.Position.X / Configuration.DefaultTileWidth);
            int yTileOver = (int)(mouse.Position.Y / Configuration.DefaultTileHeight);
            bool validXTile = xTileOver < TileXCount && xTileOver > -1;
            bool validYTile = yTileOver < TileYCount && yTileOver > -1;

            CurrentOver = null;

            if (validXTile && validYTile) {
                CurrentOver = Tiles[xTileOver, yTileOver];
            }

            //Clear current Tile
            if (mouse.RightMouseAction == MouseAction.MouseDown)
            {
                if(CurrentOver != null)
                    CurrentOver.Reset();
            }

            //Draw selected Tile
            if(mouse.LeftMouseAction == MouseAction.MouseDown)
            {
                if (CurrentOver != null)
                {
                    CurrentOver.SetTile(SpriteSheetManager.Instance.GetSelectedSpriteSheet());
                }
            }
        }
        public MapManager()
        {
            CurrentMap = new MapScreen(Configuration.DefaultXTiles, Configuration.DefaultYTiles);
            MouseObject = new MouseController();
            KeyboardObject = new KeyboardController();

            instance = this;
        }
Example #3
0
 public void Update(GameTime gameTime,MouseController mouseObject)
 {
     selectedLayer.Update(gameTime, mouseObject);
 }
 public InputService()
 {
     Keyboard = new KeyboardController();
     Mouse = new MouseController();
 }