comparison pytouhou/ui/renderer.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 c622eaf64428
comparison
equal deleted inserted replaced
467:5bb7d2c0ff46 468:feecdb4a8928
45 45
46 46
47 DEF MAX_ELEMENTS = 640*4*3 47 DEF MAX_ELEMENTS = 640*4*3
48 48
49 49
50 cdef long find_objects(Renderer self, object elements): 50 cdef long find_objects(Renderer self, object elements) except -1:
51 # Don’t type element as Element, or else the overriding of objects won’t work. 51 # Don’t type element as Element, or else the overriding of objects won’t work.
52 cdef Element obj 52 cdef Element obj
53 cdef long i = 0 53 cdef long i = 0
54 for element in elements: 54 for element in elements:
55 for obj in element.objects: 55 for obj in element.objects:
98 def remove_texture(self, int texture): 98 def remove_texture(self, int texture):
99 for i in xrange(2): 99 for i in xrange(2):
100 free(self.indices[i][texture]) 100 free(self.indices[i][texture])
101 101
102 102
103 cpdef render_elements(self, elements): 103 cdef void render_elements(self, elements):
104 cdef int key 104 cdef int key
105 cdef int x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, ox, oy 105 cdef int x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, ox, oy
106 cdef float left, right, bottom, top 106 cdef float left, right, bottom, top
107 cdef unsigned char r, g, b, a 107 cdef unsigned char r, g, b, a
108 108
175 175
176 if not self.use_fixed_pipeline: 176 if not self.use_fixed_pipeline:
177 glBindBuffer(GL_ARRAY_BUFFER, 0) 177 glBindBuffer(GL_ARRAY_BUFFER, 0)
178 178
179 179
180 cpdef render_quads(self, rects, colors, texture): 180 cdef void render_quads(self, rects, colors, texture):
181 # There is nothing that batch more than two quads on the same texture, currently. 181 # There is nothing that batch more than two quads on the same texture, currently.
182 cdef Vertex buf[8] 182 cdef Vertex buf[8]
183 cdef unsigned short indices[12] 183 cdef unsigned short indices[12]
184 indices[:] = [0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4] 184 indices[:] = [0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4]
185 185
215 215
216 if not self.use_fixed_pipeline: 216 if not self.use_fixed_pipeline:
217 glBindBuffer(GL_ARRAY_BUFFER, 0) 217 glBindBuffer(GL_ARRAY_BUFFER, 0)
218 218
219 219
220 cpdef render_framebuffer(self, Framebuffer fb, Window window): 220 cdef void render_framebuffer(self, Framebuffer fb, Window window):
221 cdef PassthroughVertex[4] buf 221 cdef PassthroughVertex[4] buf
222 cdef unsigned short indices[6] 222 cdef unsigned short indices[6]
223 indices[:] = [0, 1, 2, 2, 3, 0] 223 indices[:] = [0, 1, 2, 2, 3, 0]
224 224
225 assert not self.use_fixed_pipeline 225 assert not self.use_fixed_pipeline