pyhexlib.viewport module
- class pyhexlib.viewport.HexGridViewport(hexagonal_grid, radius, visible_size, origin, offset=pygame.Vector2)[source]
Bases:
object- Parameters:
hexagonal_grid (HexagonalGrid)
radius (int)
visible_size (tuple[int, int])
origin (Hexagon)
offset (pygame.Vector2)
- center(rc)[source]
Return cached pixel center for hex coordinate rc (r,c).
- Parameters:
rc (Hexagon)
- Return type:
pygame.Vector2
- edges(rc)[source]
Return cached list of six corner points for hex key h (r,c).
- Parameters:
rc (Hexagon)
- Return type:
list[pygame.Vector2]
- move_by(rows=0, cols=0)[source]
Move the viewport by a given amount.
- Parameters:
rows (int)
cols (int)
- Return type:
None
- class pyhexlib.viewport.Hexagons(hexagons)[source]
Bases:
object- Parameters:
hexagons (Dict[Any, Any])
- center(rc)[source]
Return cached pixel center for hex coordinate rc (r,c).
- Parameters:
rc (Hexagon)
- Return type:
pygame.Vector2