|
|
@@ -128,28 +128,27 @@ def rotate(event):
|
|
|
|
|
|
def pinch(event):
|
|
|
global scale
|
|
|
- scale = max(scale * event.amount, MAX_SCALE)
|
|
|
+ scale = min(scale * event.amount, MAX_SCALE)
|
|
|
|
|
|
|
|
|
# Start touch event listener in separate thread
|
|
|
-listener = MultiTouchListener(verbose=0, tuio_verbose=0)
|
|
|
+listener = MultiTouchListener(verbose=1, tuio_verbose=0)
|
|
|
listener.bind('rotate', rotate)
|
|
|
-#listener.bind('pinch', pinch)
|
|
|
+listener.bind('pinch', pinch)
|
|
|
listener.bind('tap', lambda e: taps.append([coord(*e.xy), FINGER_RADIUS]))
|
|
|
listener.bind('single_tap', lambda e: dtaps.append(list(coord(*e.xy)) + [1]))
|
|
|
listener.bind('double_tap', lambda e: dtaps.append(list(coord(*e.xy)) + [0]))
|
|
|
listener.start(threaded=True)
|
|
|
|
|
|
-# Start GUI event loop
|
|
|
-import sys
|
|
|
|
|
|
-try:
|
|
|
- while True:
|
|
|
- for e in pygame.event.get():
|
|
|
- if e.type == pygame.QUIT or (e.type == pygame.KEYDOWN
|
|
|
- and e.key == 113):
|
|
|
- sys.exit()
|
|
|
+def is_quit_event(e):
|
|
|
+ return e.type == pygame.QUIT \
|
|
|
+ or (e.type == pygame.KEYDOWN and e.key == ord('q'))
|
|
|
|
|
|
+
|
|
|
+try:
|
|
|
+ # Start GUI event loop
|
|
|
+ while not any(filter(is_quit_event, pygame.event.get())):
|
|
|
update()
|
|
|
except KeyboardInterrupt:
|
|
|
pass
|