hackathon-dev #1

Merged
amy merged 101 commits from hackathon-dev into develop 2019-12-12 13:56:11 -07:00
Showing only changes of commit b7e9de7d7e - Show all commits

View File

@ -42,6 +42,18 @@ def rubberband_rectangle(x, y, down, up):
if not up:
hdc.rectangle(min(origin_x, current_x), min(origin_y, current_y), max(origin_x, current_x), max(origin_y, current_y))
def rubberband_line(x, y, down, up):
global current_x, current_y
hdc.text_color = YELLOW
hdc.rop2 = upiwin.R2_XORPEN
if not down:
hdc.move_to(origin_x, origin_y)
hdc_line_to(current_x, current_y)
current_x = x
current_y = y
if not up:
hdc.move_to(origin_x, origin_y)
hdc_line_to(current_x, current_y)
@ -54,15 +66,15 @@ def on_touchdown(x, y):
if point_in_rect(drawing_rect, x, y):
origin_x = x
origin_y = y
rubberband_rectangle(x, y, True, False)
rubberband_line(x, y, True, False)
def on_touchmove(x, y):
if point_in_rect(drawing_rect, x, y):
rubberband_rectangle(x, y, False, False)
rubberband_line(x, y, False, False)
def on_touchup(x, y):
if point_in_rect(drawing_rect, x, y):
rubberband_rectangle(x, y, False, True)
rubberband_line(x, y, False, True)
def on_touchclick(x, y):
print("Click at {0},{1}".format(x, y))