Mercurial > touhou
comparison pytouhou/ui/gamerenderer.pyx @ 468:feecdb4a8928
Add “except *” to cdef void functions, and type some more.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 12 Sep 2013 15:47:08 +0200 |
parents | 36bc577b2392 |
children | 1c891c71cf22 |
comparison
equal
deleted
inserted
replaced
467:5bb7d2c0ff46 | 468:feecdb4a8928 |
---|---|
50 self.background_renderer.load(background) | 50 self.background_renderer.load(background) |
51 else: | 51 else: |
52 self.background_renderer = None | 52 self.background_renderer = None |
53 | 53 |
54 | 54 |
55 cdef void start(self, game): | 55 cdef void start(self, Game game): |
56 self.proj = perspective(30, float(game.width) / float(game.height), | 56 self.proj = perspective(30, float(game.width) / float(game.height), |
57 101010101./2010101., 101010101./10101.) | 57 101010101./2010101., 101010101./10101.) |
58 game_view = setup_camera(0, 0, 1) | 58 game_view = setup_camera(0, 0, 1) |
59 self.game_mvp = game_view * self.proj | 59 self.game_mvp = game_view * self.proj |
60 self.interface_mvp = ortho_2d(0., float(game.interface.width), float(game.interface.height), 0.) | 60 self.interface_mvp = ortho_2d(0., float(game.interface.width), float(game.interface.height), 0.) |
61 | 61 |
62 | 62 |
63 cdef void render(self, game, window): | 63 cdef void render(self, Game game, Window window): |
64 if not self.use_fixed_pipeline: | 64 if not self.use_fixed_pipeline: |
65 self.framebuffer.bind() | 65 self.framebuffer.bind() |
66 | 66 |
67 self.render_game(game) | 67 self.render_game(game) |
68 self.render_text(game.texts + game.native_texts) | 68 self.render_text(game.texts + game.native_texts) |
72 self.passthrough_shader.bind() | 72 self.passthrough_shader.bind() |
73 self.passthrough_shader.uniform_matrix('mvp', self.interface_mvp) | 73 self.passthrough_shader.uniform_matrix('mvp', self.interface_mvp) |
74 self.render_framebuffer(self.framebuffer, window) | 74 self.render_framebuffer(self.framebuffer, window) |
75 | 75 |
76 | 76 |
77 cdef void render_game(self, game): | 77 cdef void render_game(self, Game game): |
78 cdef long game_x, game_y | 78 cdef long game_x, game_y |
79 cdef float x, y, z, dx, dy, dz, fog_data[4], fog_start, fog_end | 79 cdef float x, y, z, dx, dy, dz, fog_data[4], fog_start, fog_end |
80 cdef unsigned char fog_r, fog_g, fog_b | 80 cdef unsigned char fog_r, fog_g, fog_b |
81 cdef Matrix mvp | 81 cdef Matrix mvp |
82 | 82 |
165 game.msg_sprites())) | 165 game.msg_sprites())) |
166 self.render_elements(chain(game.bullets, game.lasers, | 166 self.render_elements(chain(game.bullets, game.lasers, |
167 game.cancelled_bullets, game.items, | 167 game.cancelled_bullets, game.items, |
168 game.labels)) | 168 game.labels)) |
169 | 169 |
170 if game.msg_runner: | 170 if game.msg_runner is not None: |
171 rect = Rect(48, 368, 288, 48) | 171 rect = Rect(48, 368, 288, 48) |
172 color1 = Color(0, 0, 0, 192) | 172 color1 = Color(0, 0, 0, 192) |
173 color2 = Color(0, 0, 0, 128) | 173 color2 = Color(0, 0, 0, 128) |
174 self.render_quads([rect], [(color1, color1, color2, color2)], 0) | 174 self.render_quads([rect], [(color1, color1, color2, color2)], 0) |
175 | 175 |