Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
multitouch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
multitouch
Commits
d25c050b
Commit
d25c050b
authored
May 15, 2012
by
UVA Multi-touch
Committed by
Taddeus Kroes
May 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed fullscreen pygame flag in Windows.
parent
1a11d1c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
src/draw.py
src/draw.py
+19
-7
No files found.
src/draw.py
View file @
d25c050b
#!/usr/bin/env python
#!/usr/bin/env python
import
pygame
,
sys
,
time
import
pygame
from
touch
import
MultiTouchListener
import
sys
import
time
from
touch
import
MultiTouchListener
,
screen_size
from
math
import
degrees
,
cos
,
sin
from
math
import
degrees
,
cos
,
sin
from
events
import
Rotate
from
events
import
Rotate
pygame
.
init
()
pygame
.
init
()
FULLSCREEN
=
'-f'
in
sys
.
argv
[
1
:]
# Config
# Config
FINGER_RADIUS
=
20
FINGER_RADIUS
=
20
CENTROID_RADIUS
=
15
CENTROID_RADIUS
=
15
W
,
H
=
640
,
480
W
,
H
=
screen_size
if
FULLSCREEN
else
(
640
,
480
)
BG_COLOR
=
0
,
0
,
0
BG_COLOR
=
0
,
0
,
0
LINE_COLOR
=
128
,
128
,
128
LINE_COLOR
=
128
,
128
,
128
...
@@ -29,8 +33,9 @@ BEAM_INCREMENT = .8
...
@@ -29,8 +33,9 @@ BEAM_INCREMENT = .8
MAX_SCALE
=
10
MAX_SCALE
=
10
# Create canvas GUI in the current thread
# Create canvas GUI
screen
=
pygame
.
display
.
set_mode
((
W
,
H
))
flags
=
pygame
.
FULLSCREEN
if
FULLSCREEN
else
0
screen
=
pygame
.
display
.
set_mode
((
W
,
H
),
flags
)
def
rotate_point
(
point
,
axis
,
angle
):
def
rotate_point
(
point
,
axis
,
angle
):
...
@@ -127,7 +132,7 @@ def pinch(event):
...
@@ -127,7 +132,7 @@ def pinch(event):
# Start touch event listener in separate thread
# 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
(
'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
]))
...
@@ -136,8 +141,15 @@ listener.bind('double_tap', lambda e: dtaps.append(list(coord(*e.xy)) + [0]))
...
@@ -136,8 +141,15 @@ 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
# Start GUI event loop
import
sys
try
:
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
()
update
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
pass
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment