-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial.py
More file actions
25 lines (21 loc) · 823 Bytes
/
Copy pathtutorial.py
File metadata and controls
25 lines (21 loc) · 823 Bytes
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
from ggame import App, Color, LineStyle, Sprite
from ggame import RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset
# Three primary colors with no transparency (alpha = 1.0)
red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 0.5)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
# Define a line style that is a thin (1 pixel) wide black line
thinline = LineStyle(1, black)
# A graphics asset that represents a rectangle
rectangle = RectangleAsset(50, 20, thinline, blue)
square = RectangleAsset(100, 100, thinline, red)
ellipse = EllipseAsset(200, 50, thinline, blue)
triangle = PolygonAsset([(100,100), (50, 60), (200,70)], thinline, green)
# Now display a rectangle
Sprite(rectangle, (200, 60))
Sprite(square, (210, 50))
Sprite(ellipse, (290, 400))
Sprite(triangle, (300, 300))
myapp = App()
myapp.run()