-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
35 lines (32 loc) · 966 Bytes
/
Copy pathtest.py
File metadata and controls
35 lines (32 loc) · 966 Bytes
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
import sys
import sdl2
import sdl2.ext
def run():
window = sdl2.ext.Window("hi", size=(800, 600))
window.show()
running = True
while running:
events = sdl2.ext.get_events()
for event in events:
if event.type == sdl2.SDL_QUIT:
running = False
break
window.refresh()
return 0
def run2():
sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO)
sdl2.SDL_Init(sdl2.SDL_INIT_JOYSTICK)
joystick = sdl2.SDL_JoystickOpen(0)
sdl2.ext.init()
window = sdl2.ext.Window("test", size=(800,600),position=(0,0),flags=sdl2.SDL_WINDOW_SHOWN)
window.refresh()
while True:
for event in sdl2.ext.get_events():
if event.type==sdl2.SDL_KEYDOWN:
print sdl2.SDL_GetKeyName(event.key.keysym.sym).lower()
elif event.type==sdl2.SDL_JOYAXISMOTION:
print [event.jaxis.axis,event.jaxis.value]
return 0
if __name__ == "__main__":
sys.exit(run2())
# sys.exit(run())