aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/bitfont.py8
-rw-r--r--client/render.py18
2 files changed, 18 insertions, 8 deletions
diff --git a/client/bitfont.py b/client/bitfont.py
index 7fa27b4..094616d 100644
--- a/client/bitfont.py
+++ b/client/bitfont.py
@@ -61,8 +61,12 @@ _bitfont_9 = [ True, True, True,
_bitfonts = [ _bitfont_0, _bitfont_1, _bitfont_2, _bitfont_3, _bitfont_4, _bitfont_5, _bitfont_6, _bitfont_7, _bitfont_8, _bitfont_9 ]
def bitfont(number):
- # Create the fonts
- # Generate the digits
+ """
+ Convert a base 10 number into a bitfont, which is represented by a list
+ representing a 3x5 grid, row by row. A value of True represents a cell
+ that should be drawn and a value of False represents a cell that should
+ be left blank.
+ """
result = []
number = add_digit(result, number)
while number > 0:
diff --git a/client/render.py b/client/render.py
index 8e4b0eb..3efa27a 100644
--- a/client/render.py
+++ b/client/render.py
@@ -23,6 +23,15 @@ class Renderer:
Initialise the renderer with a foreground colour and a background colour
and create an SDL2 window for drawing to. This assumes that SDL2 has
already been initialised.
+
+ Arguments:
+ title -- the title to give the client windows
+ dimensions -- the dimensions (in pixels) at which to start the windows
+ num_windows -- the number of windows to run the client with
+
+ Keyword arguments:
+ fg -- the foreground colour to draw with (default (255, 255, 255))
+ bg -- the background colour to draw with (default (0, 0, 0))
"""
self.fg = fg
self.bg = bg
@@ -34,6 +43,7 @@ class Renderer:
screen.window.show()
def set_offset(self, offset):
+ """Set this client's offset in the full-sized screen made by all clients."""
self.offset = offset
def render(self, balls, paddles, score):
@@ -108,14 +118,10 @@ class Renderer:
sdl2.SDL_SetWindowFullscreen(window.window, sdl2.SDL_WINDOW_FULLSCREEN)
def get_rightmost_edge(self):
- """
- Get the relative coordinate of the rightmost edge.
- """
+ """Get the relative coordinate of the rightmost edge."""
return self.offset + sum(self.get_screen_widths())
def get_screen_widths(self):
- """
- Get the relative screen widths in screen order.
- """
+ """Get the relative screen widths in screen order."""
# Window height is '1' between all clients, so divide the width by the height
return list(map(lambda screen: float(screen.width) / float(screen.height), self.screens))