-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting2d
More file actions
30 lines (21 loc) · 730 Bytes
/
testing2d
File metadata and controls
30 lines (21 loc) · 730 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
26
27
28
29
30
from cmu_graphics import *
from ShapeObject import ShapeObject
from FaceObject import FaceObject
from shapeCollectionObject import shapeCollectionObject
from buttonHandler import ButtonHandler
import math
import random
def convertToViewport(app, x, y):
scale = app.viewportScale if hasattr(app, "viewportScale") else 50
centerX = app.width / 2
centerY = app.height / 2
viewportX = centerX + x * scale
viewportY = centerY - y * scale
return viewportX, viewportY
def onAppStart(app):
app.viewportScale = 50
app.shape = ShapeObject((0, 0, 0), 1, 1)
app.flattened_faces = app.shape.flattenTo2D()
def redrawAll(app):
file_path = app.getTextInput("hi")
runApp(width=800, height=600)