Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multitouch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
multitouch
Commits
879ef48e
Commit
879ef48e
authored
12 years ago
by
UVA Multi-touch
Browse files
Options
Downloads
Patches
Plain Diff
Added fullscreen option to test draw program.
parent
f1245e5d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/draw.py
+19
-5
19 additions, 5 deletions
src/draw.py
with
19 additions
and
5 deletions
src/draw.py
+
19
−
5
View file @
879ef48e
#!/usr/bin/env python
import
pygame
,
sys
,
time
from
touch
import
add
,
MultiTouchListener
import
pygame
import
sys
import
time
from
touch
import
add
,
MultiTouchListener
,
screen_size
from
math
import
degrees
,
cos
,
sin
from
events
import
Rotate
pygame
.
init
()
FULLSCREEN
=
'
-f
'
in
sys
.
argv
[
1
:]
# Config
FINGER_RADIUS
=
20
CENTROID_RADIUS
=
15
W
,
H
=
640
,
480
W
,
H
=
screen_size
if
FULLSCREEN
else
(
640
,
480
)
BG_COLOR
=
0
,
0
,
0
LINE_COLOR
=
128
,
128
,
128
...
...
@@ -30,6 +34,9 @@ BEAM_INCREMENT = .8
# Create canvas GUI in the current thread
screen
=
pygame
.
display
.
set_mode
((
W
,
H
))
if
FULLSCREEN
:
pygame
.
display
.
toggle_fullscreen
()
def
rotate_point
(
point
,
axis
,
angle
):
px
,
py
=
point
...
...
@@ -125,7 +132,7 @@ def pinch(event):
# Start touch event listener in separate thread
listener
=
MultiTouchListener
(
verbose
=
1
,
tuio_verbose
=
0
)
listener
=
MultiTouchListener
(
verbose
=
0
,
tuio_verbose
=
0
)
listener
.
bind
(
'
rotate
'
,
rotate
)
listener
.
bind
(
'
pinch
'
,
pinch
)
listener
.
bind
(
'
tap
'
,
lambda
e
:
taps
.
append
([
coord
(
*
e
.
xy
),
FINGER_RADIUS
]))
...
...
@@ -134,8 +141,15 @@ 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
not
filter
(
lambda
e
:
e
.
type
==
pygame
.
QUIT
,
pygame
.
event
.
get
()):
while
True
:
for
e
in
pygame
.
event
.
get
():
if
e
.
type
==
pygame
.
QUIT
or
(
e
.
type
==
pygame
.
KEYDOWN
and
e
.
key
==
113
):
sys
.
exit
()
update
()
except
KeyboardInterrupt
:
pass
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment