fixed documentation

This commit is contained in:
Nicholas Dyer 2023-05-13 11:47:36 -04:00
parent 63a87c12dd
commit 4904ed2184
3 changed files with 15 additions and 8 deletions

View File

@ -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."""

View File

@ -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))

View File

@ -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."""