Commit 35a46583 authored by Taddeus Kroes's avatar Taddeus Kroes

Source code cleanup.

parent d25c050b
...@@ -128,28 +128,27 @@ def rotate(event): ...@@ -128,28 +128,27 @@ def rotate(event):
def pinch(event): def pinch(event):
global scale global scale
scale = max(scale * event.amount, MAX_SCALE) scale = min(scale * event.amount, MAX_SCALE)
# Start touch event listener in separate thread # 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('rotate', rotate)
#listener.bind('pinch', pinch) listener.bind('pinch', pinch)
listener.bind('tap', lambda e: taps.append([coord(*e.xy), FINGER_RADIUS])) 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('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.bind('double_tap', lambda e: dtaps.append(list(coord(*e.xy)) + [0]))
listener.start(threaded=True) listener.start(threaded=True)
# Start GUI event loop
import sys
try: def is_quit_event(e):
while True: return e.type == pygame.QUIT \
for e in pygame.event.get(): or (e.type == pygame.KEYDOWN and e.key == ord('q'))
if e.type == pygame.QUIT or (e.type == pygame.KEYDOWN
and e.key == 113):
sys.exit()
try:
# Start GUI event loop
while not any(filter(is_quit_event, pygame.event.get())):
update() update()
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment