forked from IntelligentMOtionlab/SNU_ComputerGraphics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.py
More file actions
59 lines (47 loc) · 1.46 KB
/
control.py
File metadata and controls
59 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import pyglet
from pyglet import window, app, shapes
from pyglet.window import mouse,key
from pyglet.math import Mat4, Vec3
class Control:
"""
Control class controls keyboard & mouse inputs.
"""
def __init__(self, window):
window.on_key_press = self.on_key_press
window.on_key_release = self.on_key_release
window.on_mouse_motion = self.on_mouse_motion
window.on_mouse_drag = self.on_mouse_drag
window.on_mouse_press = self.on_mouse_press
window.on_mouse_release = self.on_mouse_release
window.on_mouse_scroll = self.on_mouse_scroll
self.window = window
self.setup()
def setup(self):
pass
def update(self, vector):
pass
def on_key_press(self, symbol, modifier):
# TODO:
pass
def on_key_release(self, symbol, modifier):
if symbol == pyglet.window.key.ESCAPE:
pyglet.app.exit()
elif symbol == pyglet.window.key.SPACE:
self.window.animate = not self.window.animate
# TODO:
pass
def on_mouse_motion(self, x, y, dx, dy):
# TODO:
pass
def on_mouse_press(self, x, y, button, modifier):
# TODO:
pass
def on_mouse_release(self, x, y, button, modifier):
# TODO:
pass
def on_mouse_drag(self, x, y, dx, dy, button, modifier):
# TODO:
pass
def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
# TODO:
pass