public Grid() { bounds = new Rectangle(538, 175, 850, 520); cellSizeX = bounds.Width / sizeX; cellSizeY = bounds.Height / sizeY; highlightedGrid = new Location2i(); }
public void Update(GameTime gameTime) { MouseState mousePoller = Util.UserInputCenter.mouse; int x = mousePoller.X; int y = mousePoller.Y; x -= this.bounds.X; y -= this.bounds.Y; x /= this.cellSizeX; y /= this.cellSizeY; if (x < 0) { x = 0; } if (y < 0) { y = 0; } if (x >= sizeX) { x = sizeX - 1; } if (y >= sizeY) { y = sizeY - 1; } highlightedGrid = new Location2i(x, y); }