comparison pytouhou/ui/gamerenderer.pyx @ 473:1c891c71cf22

Cythonize pytouhou.game.text.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 16 Sep 2013 18:42:12 +0200
parents feecdb4a8928
children c622eaf64428
comparison
equal deleted inserted replaced
472:8038f1957b71 473:1c891c71cf22
20 GL_FOG, GL_FOG_MODE, GL_LINEAR, GL_FOG_START, GL_FOG_END, 20 GL_FOG, GL_FOG_MODE, GL_LINEAR, GL_FOG_START, GL_FOG_END,
21 GL_FOG_COLOR, GL_COLOR_BUFFER_BIT, GLfloat, glViewport, glScissor, 21 GL_FOG_COLOR, GL_COLOR_BUFFER_BIT, GLfloat, glViewport, glScissor,
22 GL_SCISSOR_TEST, GL_DEPTH_BUFFER_BIT) 22 GL_SCISSOR_TEST, GL_DEPTH_BUFFER_BIT)
23 23
24 from pytouhou.utils.maths cimport perspective, setup_camera, ortho_2d 24 from pytouhou.utils.maths cimport perspective, setup_camera, ortho_2d
25 from pytouhou.game.text cimport NativeText, GlyphCollection
25 from .shaders.eosd import GameShader, BackgroundShader, PassthroughShader 26 from .shaders.eosd import GameShader, BackgroundShader, PassthroughShader
26 27
27 from collections import namedtuple 28 from collections import namedtuple
28 Rect = namedtuple('Rect', 'x y w h') 29 Rect = namedtuple('Rect', 'x y w h')
29 Color = namedtuple('Color', 'r g b a') 30 Color = namedtuple('Color', 'r g b a')
175 176
176 glDisable(GL_SCISSOR_TEST) 177 glDisable(GL_SCISSOR_TEST)
177 178
178 179
179 cdef void render_text(self, texts): 180 cdef void render_text(self, texts):
181 cdef NativeText label
182
180 if self.font_manager is None: 183 if self.font_manager is None:
181 return 184 return
182 185
183 labels = [label for label in texts if label is not None] 186 labels = [label for label in texts if label is not None]
184 self.font_manager.load(labels) 187 self.font_manager.load(labels)
199 else: 202 else:
200 self.render_quads([rect], [gradient], label.texture) 203 self.render_quads([rect], [gradient], label.texture)
201 204
202 205
203 cdef void render_interface(self, interface, game_boss): 206 cdef void render_interface(self, interface, game_boss):
207 cdef GlyphCollection label
208
204 elements = [] 209 elements = []
205 210
206 if self.use_fixed_pipeline: 211 if self.use_fixed_pipeline:
207 glMatrixMode(GL_MODELVIEW) 212 glMatrixMode(GL_MODELVIEW)
208 glLoadMatrixf(self.interface_mvp.data) 213 glLoadMatrixf(self.interface_mvp.data)