hackathon-dev #1
@ -27,8 +27,8 @@ drawing_rect = (screen_rect[0], screen_rect[1], screen_rect[2] - 60, screen_rect
 | 
			
		||||
command_rect = (drawing_rect[2], screen_rect[1], screen_rect[2], screen_rect[3])
 | 
			
		||||
 | 
			
		||||
# further divide up the "command" area
 | 
			
		||||
cmd1_rect = (command_rect[0], command_rect[1], command_rect[2], 60)
 | 
			
		||||
cmd2_rect = (command_rect[0], 60, command_rect[2], 120)
 | 
			
		||||
tool_select_rect = (command_rect[0], command_rect[1], command_rect[2], 60)
 | 
			
		||||
color_select_rect = (command_rect[0], 60, command_rect[2], 120)
 | 
			
		||||
cmd3_rect = (command_rect[0], 120, command_rect[2], 180)
 | 
			
		||||
cmd4_rect = (command_rect[0], 180, command_rect[2], command_rect[3])
 | 
			
		||||
 | 
			
		||||
@ -58,7 +58,7 @@ current_color = 0
 | 
			
		||||
def draw_current_color():
 | 
			
		||||
	hdc.text_color = color_list[current_color]
 | 
			
		||||
	hdc.rop2 = upiwin.R2_COPYPEN
 | 
			
		||||
	hdc.solid_rectangle(cmd2_rect[0] + 6, cmd2_rect[1] + 6, cmd2_rect[0] + 54, cmd2_rect[1] + 54)
 | 
			
		||||
	hdc.solid_rectangle(color_select_rect[0] + 6, color_select_rect[1] + 6, color_select_rect[0] + 54, color_select_rect[1] + 54)
 | 
			
		||||
	
 | 
			
		||||
def select_next_color():
 | 
			
		||||
	global current_color
 | 
			
		||||
@ -73,7 +73,7 @@ def draw_freehand(color, data):
 | 
			
		||||
	hdc.text_color = color
 | 
			
		||||
	hdc.rop2 = upiwin.R2_COPYPEN
 | 
			
		||||
	hdc.move_to(data[0][0], data[0][1])
 | 
			
		||||
	for pt in data[1:len(data) - 1]:
 | 
			
		||||
	for pt in data[1:]:
 | 
			
		||||
		hdc.line_to(pt[0], pt[1])
 | 
			
		||||
		
 | 
			
		||||
def draw_line(color, data):
 | 
			
		||||
@ -179,7 +179,7 @@ current_tool = 0
 | 
			
		||||
 | 
			
		||||
def draw_current_tool():
 | 
			
		||||
	hdc_bits.select_object(tool_list[current_tool]['icon'])
 | 
			
		||||
	hdc.bitblt(cmd1_rect[0] + 6, cmd1_rect[1] + 6, cmd1_rect[0] + 54, cmd1_rect[1] + 54, hdc_bits, 0, 0, 0)
 | 
			
		||||
	hdc.bitblt(tool_select_rect[0] + 6, tool_select_rect[1] + 6, tool_select_rect[0] + 54, tool_select_rect[1] + 54, hdc_bits, 0, 0, 0)
 | 
			
		||||
	
 | 
			
		||||
def select_next_tool():
 | 
			
		||||
	global current_tool
 | 
			
		||||
@ -211,9 +211,9 @@ def on_touchup(x, y):
 | 
			
		||||
		objects_drawn += [object]
 | 
			
		||||
 | 
			
		||||
def on_touchclick(x, y):
 | 
			
		||||
	if point_in_rect(cmd1_rect, x, y):
 | 
			
		||||
	if point_in_rect(tool_select_rect, x, y):
 | 
			
		||||
		select_next_tool()
 | 
			
		||||
	elif point_in_rect(cmd2_rect, x, y):
 | 
			
		||||
	elif point_in_rect(color_select_rect, x, y):
 | 
			
		||||
		select_next_color()
 | 
			
		||||
	elif point_in_rect(cmd3_rect, x, y):
 | 
			
		||||
		print("Click command 3")
 | 
			
		||||
@ -233,8 +233,8 @@ do_backlight()
 | 
			
		||||
# Draw the basic layout.
 | 
			
		||||
hdc.text_color = LTGRAY
 | 
			
		||||
hdc.rop2 = upiwin.R2_COPYPEN
 | 
			
		||||
hdc.rectangle(cmd1_rect[0], cmd1_rect[1], cmd1_rect[2], cmd1_rect[3])
 | 
			
		||||
hdc.rectangle(cmd2_rect[0], cmd2_rect[1], cmd2_rect[2], cmd2_rect[3])
 | 
			
		||||
hdc.rectangle(tool_select_rect[0], tool_select_rect[1], tool_select_rect[2], tool_select_rect[3])
 | 
			
		||||
hdc.rectangle(color_select_rect[0], color_select_rect[1], color_select_rect[2], color_select_rect[3])
 | 
			
		||||
hdc.rectangle(cmd3_rect[0], cmd3_rect[1], cmd3_rect[2], cmd3_rect[3])
 | 
			
		||||
hdc.rectangle(cmd4_rect[0], cmd4_rect[1], cmd4_rect[2], cmd4_rect[3])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user