Mercurial > touhou
comparison pytouhou/opengl/gamerunner.py @ 146:96c30ffd9b87
Evil workaround to pyglet's X11 backend
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Mon, 03 Oct 2011 22:42:26 +0200 |
parents | fab7ad2f0d8b |
children | 5cf927cbd9c5 |
comparison
equal
deleted
inserted
replaced
145:30338dc33a7b | 146:96c30ffd9b87 |
---|---|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 ## GNU General Public License for more details. | 12 ## GNU General Public License for more details. |
13 ## | 13 ## |
14 | 14 |
15 import pyglet | 15 import pyglet |
16 import traceback | |
17 | |
16 from pyglet.gl import * | 18 from pyglet.gl import * |
17 | 19 |
18 from pytouhou.opengl.texture import TextureManager | 20 from pytouhou.opengl.texture import TextureManager |
19 from pytouhou.opengl.sprite import get_sprite_rendering_data #TODO: cimport? | 21 from pytouhou.opengl.sprite import get_sprite_rendering_data #TODO: cimport? |
20 from pytouhou.opengl.background import get_background_rendering_data | 22 from pytouhou.opengl.background import get_background_rendering_data |
61 | 63 |
62 def on_resize(self, width, height): | 64 def on_resize(self, width, height): |
63 glViewport(0, 0, width, height) | 65 glViewport(0, 0, width, height) |
64 | 66 |
65 | 67 |
68 def _event_text_symbol(self, ev): | |
69 # XXX: Ugly workaround to a pyglet bug on X11 | |
70 #TODO: fix that bug in pyglet | |
71 try: | |
72 return pyglet.window.Window._event_text_symbol(self, ev) | |
73 except Exception as exc: | |
74 print('*WARNING* Pyglet error:') | |
75 traceback.print_exc(exc) | |
76 return None, None | |
77 | |
78 | |
66 def on_key_press(self, symbol, modifiers): | 79 def on_key_press(self, symbol, modifiers): |
67 if symbol == pyglet.window.key.ESCAPE: | 80 if symbol == pyglet.window.key.ESCAPE: |
68 self.has_exit = True | 81 self.has_exit = True |
69 # XXX: Fullscreen will be enabled the day pyglet stops sucking | 82 # XXX: Fullscreen will be enabled the day pyglet stops sucking |
70 elif symbol == pyglet.window.key.F11: | 83 elif symbol == pyglet.window.key.F11: |