Ejemplo n.º 1
0
 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);
         }
     }
 }
Ejemplo n.º 2
0
 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;
         }
     }
 }