From 4904ed21844007f7098211b748e68d82e9b87b79 Mon Sep 17 00:00:00 2001 From: Nicholas Dyer Date: Sat, 13 May 2023 11:47:36 -0400 Subject: [PATCH] fixed documentation --- .../game_files/elements/__init__.py | 2 +- pocket_friends/game_files/elements/sprites.py | 19 +++++++++++++------ pocket_friends/game_files/io/__init__.py | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pocket_friends/game_files/elements/__init__.py b/pocket_friends/game_files/elements/__init__.py index 6867307..7f96f12 100644 --- a/pocket_friends/game_files/elements/__init__.py +++ b/pocket_friends/game_files/elements/__init__.py @@ -1 +1 @@ -"""Sub-module for use in the game. Helps with the drawing of various objects such as sprites and text boxes.""" +"""Submodule for use in the game. Helps with the drawing of various objects such as sprites and text boxes.""" diff --git a/pocket_friends/game_files/elements/sprites.py b/pocket_friends/game_files/elements/sprites.py index 467ac7e..1752dab 100644 --- a/pocket_friends/game_files/elements/sprites.py +++ b/pocket_friends/game_files/elements/sprites.py @@ -113,9 +113,14 @@ class InfoText: Class for drawing large amounts of text on the screen at a time """ - def __init__(self, resources_dir, game_res, text='Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' - 'Nam commodo tempor aliquet. Suspendisse placerat accumsan' - ' neque, nec volutpat nunc porta ut.'): + def __init__(self, resources_dir, game_res, text='Test text.'): + """ + Creates an InfoText object to be used on a surface. + Args: + resources_dir (str): The full path of the game's resources directory + game_res (int): The internal resolution of the game. Used for correct scaling. + text (:obj:`str`, optional): The given text to render. Defaults to "Test text."' + """ self.font = pygame.font.Font(resources_dir + '/fonts/5Pts5.ttf', 10) self.text = [] # Text broken up into a list according to how it will fit on screen. @@ -188,8 +193,9 @@ class InfoText: def draw(self, surface): """ - Draws the text on a given surface. - :param surface: The surface for the text to be drawn on. + Draw the text on a given surface. + Args: + surface (:obj:`pygame.Surface`): The surface to draw the text on """ # Constants to help draw the text line_separation = 7 @@ -264,7 +270,8 @@ class EggInfo: def draw(self, surface): """ Draw the info icons on a given surface. - :param surface: the surface to draw the icons on. + Args: + surface (:obj:`pygame.Surface`): The surface to draw the text on """ # Blit the info onto the given surface. surface.blit(self.surface, (self.x, self.y)) diff --git a/pocket_friends/game_files/io/__init__.py b/pocket_friends/game_files/io/__init__.py index d266b0e..8828bf5 100644 --- a/pocket_friends/game_files/io/__init__.py +++ b/pocket_friends/game_files/io/__init__.py @@ -1,2 +1,2 @@ -"""Sub-package for handling all I/O operations including keyboard input (GPIO input when connected to a Raspberry Pi) +"""Subpackage for handling all I/O operations including keyboard input (GPIO input when connected to a Raspberry Pi) and save data reading and writing.""" \ No newline at end of file