donjuan.renderer

Module Contents

Classes

BaseRenderer

Base class for rendering dungeons into images.

Renderer

Default renderer for rendering dungeons into PNG files using matplotlib.

class donjuan.renderer.BaseRenderer(scale: float)

Bases: abc.ABC

Base class for rendering dungeons into images.

property scale(self) → float

The scale size of a single Cell. The meaning differs depending on the subclass.

abstract render(self, dungeon: Dungeon) → None
class donjuan.renderer.Renderer(scale: float = 1.0)

Bases: donjuan.renderer.BaseRenderer

Default renderer for rendering dungeons into PNG files using matplotlib.

Parameters

scale (float, optional) – size of a single cell in inches (default is 1 inch).

render(self, dungeon: Dungeon, file_path: str = 'rendered_dungeon.png', dpi: int = 200, save: bool = True) → Tuple

Render the dungeon.

Parameters
  • dungeon (Dungeon) – dungeon to render

  • file_path (str, optional) – path to save the dungeon at (default is rendered_dungeon.png)

  • dpi (int, optional) – dots per inch used to save (default is 200)

  • save (bool, optional) – flag indicating whether to save the dungeon with matplotlib.pyplot.savefig()