-
Notifications
You must be signed in to change notification settings - Fork 0
/
drawing.py
34 lines (29 loc) · 1.1 KB
/
drawing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pymlgame
from misc import Point
def draw_p(surface, origin=Point(0, 0), color=pymlgame.RED):
"""
Draw the letter P to the given surface. The size is 3x5.
"""
# note(hrantzsch): we might want scaling, but ATM we don't need it
tr = origin + Point(2, 0) # top right
bl = origin + Point(0, 4)
surface.draw_line(origin, bl, color)
surface.draw_line(tr, tr + Point(0, 2), color)
surface.draw_dot(origin + Point(1, 0), color)
surface.draw_dot(origin + Point(1, 2), color)
def draw_0(surface, origin=Point(0, 0), color=pymlgame.RED):
"""
Draw the figure 0 to the given surface. The size is 3x5.
"""
tr = origin + Point(2, 0) # top right
bl = origin + Point(0, 4)
br = origin + Point(2, 4)
surface.draw_line(origin, bl, color)
surface.draw_line(tr, br, color)
surface.draw_dot(origin + Point(1, 0), color)
surface.draw_dot(bl + Point(1, 0), color)
def draw_1(surface, origin=Point(0, 0), color=pymlgame.RED):
"""
Draw the figure 1 to the given surface. The size is 1x5.
"""
surface.draw_line(origin, origin + Point(0, 4), color)