public void Draw(SpriteBatch spriteBatch, HexagonGrid grid, Images images, FarSeerCamera2D camera) { foreach (Cell cell in grid) { Vector2 centerPixel = DeterminePositionToDraw(cell); Vector2 screenPosition = camera.ConvertWorldToScreen(centerPixel); if (_viewport.Contains(screenPosition)) { DrawCell(spriteBatch, cell, images, centerPixel); } } }
public void Update(FarSeerCamera2D camera) { if (_inputManager.IsNewMouseButtonPress(MouseButtons.LeftButton)) { Vector2 mousePosition = _inputManager.GetMousePosition(); Vector2 mousePositionWorld = camera.ConvertScreenToWorld(mousePosition); if (_position.IncludesPixel(mousePositionWorld)) { _isSelected = true; } else { //_isSelected = false; } } }