From c488ef9c2b8133e5f776a76f9c7f69ce3738986a Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 5 Mar 2023 10:49:02 -0800 Subject: [PATCH] Add doc string for Configuration attributes --- erynrl/__main__.py | 8 +++----- erynrl/configuration.py | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/erynrl/__main__.py b/erynrl/__main__.py index 19d8985..f801654 100644 --- a/erynrl/__main__.py +++ b/erynrl/__main__.py @@ -39,18 +39,16 @@ def main(argv): else: font_config = FontConfiguration.default_configuration() except FontConfigurationError as error: - log.ROOT.error('Unable to create a default font configuration: %s', error) + log.ROOT.error('Unable to create a font configuration: %s', error) return -1 configuration = Configuration( - console_size=CONSOLE_SIZE, - console_font_config=font_config, - map_size=MAP_SIZE, + console_font_configuration=font_config, sandbox=args.sandbox) engine = Engine(configuration) - tileset = configuration.console_font_config.tileset + tileset = configuration.console_font_configuration.tileset console = tcod.Console(*configuration.console_size.numpy_shape, order='F') with tcod.context.new(columns=console.width, rows=console.height, tileset=tileset) as context: engine.run_event_loop(context, console) diff --git a/erynrl/configuration.py b/erynrl/configuration.py index 5df1721..f0f2c72 100644 --- a/erynrl/configuration.py +++ b/erynrl/configuration.py @@ -166,10 +166,23 @@ class TilesheetFontConfiguration(FontConfiguration): @dataclass class Configuration: - '''Configuration of the game engine''' - console_size: Size - console_font_config: FontConfiguration + ''' + Configuration of the game engine - map_size: Size + ### Attributes + + console_font_configuration : FontConfiguration + A configuration object that defines the font to use for rendering the console + console_size : Size + The size of the console in tiles + map_size : Size + The size of the map in tiles + sandbox : bool + If this flag is toggled on, the map is rendered with no shroud + ''' + console_font_configuration: FontConfiguration + + console_size: Size = CONSOLE_SIZE + map_size: Size = MAP_SIZE sandbox: bool = False