Skip to content

Commit

Permalink
Make Drawable (and children) conform to geometric points standard.
Browse files Browse the repository at this point in the history
For #30.
  • Loading branch information
skytreader committed Mar 24, 2018
1 parent d8e4587 commit a7e3726
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion components/drawable.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ class Drawable(object):
or `draw_unchanging`.
"""

def __init__(self, draw_offset, height_limit=None, width_limit=None):
def __init__(self, draw_offset, width_limit=None, height_limit=None):
"""
draw_offset is a (width, height) tuple.
"""
self.draw_offset = draw_offset if draw_offset else (0, 0)
# TODO Make the semantics like so: if width_limit is None, make it scale
# along the screen's width; if height_limit is None, make it scale along
# the screen's height.
self.max_size = (width_limit, height_limit) if width_limit and height_limit else None

def draw(self, window, screen, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions components/helpers/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Grid(Drawable):
A grid must be drawable (and traversable)!
"""

def __init__(self, draw_width=-1, draw_height=-1, draw_offset=None):
super(Grid, self).__init__(draw_offset)
def __init__(self, draw_offset=None, width_limit=None, height_limit=None):
super(Grid, self).__init__(draw_offset, width_limit, height_limit)

def traverse(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion components/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PointShape(Drawable):
@author Chad Estioco
"""

def __init__(self, point_list = None, line_color = Colors.MAX_BLACK, draw_offset=None):
def __init__(self, point_list=None, line_color=Colors.MAX_BLACK, draw_offset=None):
"""
Create a PointShape with the given point_list.
"""
Expand Down

0 comments on commit a7e3726

Please sign in to comment.