pyhexlib.utils module

pyhexlib.utils.handle_scrolling_event(event, renderer)[source]
Parameters:
Return type:

tuple[int, int] | None

pyhexlib.utils.outline_layer_imprinted_renderer(color_dark=(50, 50, 50), color_light=(200, 200, 200))[source]

Factory: returns a renderer function that calls render_outline_layer_imprinted with the provided default colors bound.

The returned function has the same call signature as render_outline_layer_imprinted(surface, grid, hexagons, …) -> pygame.Surface.

Parameters:
  • color_dark (Tuple[int, int, int] | Tuple[int, int, int, int] | pygame.Color)

  • color_light (Tuple[int, int, int] | Tuple[int, int, int, int] | pygame.Color)

Return type:

Callable

pyhexlib.utils.round_edges(surface, radius, in_place=True)[source]
Parameters:
  • surface (pygame.Surface)

  • radius (int)

  • in_place (bool)

Return type:

pygame.Surface

pyhexlib.utils.shadow_image(surface, shadow_color=(0, 0, 0), alpha=128)[source]
Parameters:
  • surface (pygame.Surface)

  • shadow_color (Tuple[int, int, int] | Tuple[int, int, int, int] | pygame.Color)

  • alpha (int)

Return type:

pygame.Surface

pyhexlib.utils.toggle_background(renderer)[source]
pyhexlib.utils.toggle_coordinate_layer(layers, font_color=(0, 0, 0), font_size=12)[source]
Parameters:
  • layers (HexGridManager)

  • font_color (Tuple[int, int, int] | Tuple[int, int, int, int] | pygame.Color)

  • font_size (int)

Return type:

bool

pyhexlib.utils.toggle_layer(layers, layer)[source]
Parameters:
Return type:

bool