comparison pytouhou/ui/renderer.pyx @ 384:690b5faaa0e6

Make rendering of multiple-sprites elements work like single-sprites.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 02 Oct 2012 13:27:05 +0200
parents 0537af9125a7
children 9e2cbb2c2c64
comparison
equal deleted inserted replaced
383:0537af9125a7 384:690b5faaa0e6
13 ## 13 ##
14 14
15 from libc.stdlib cimport malloc, free 15 from libc.stdlib cimport malloc, free
16 from libc.math cimport tan 16 from libc.math cimport tan
17 from math import radians 17 from math import radians
18 from itertools import chain
18 19
19 import ctypes 20 import ctypes
20 21
21 from struct import pack 22 from struct import pack
22 23
52 cpdef render_elements(self, elements): 53 cpdef render_elements(self, elements):
53 cdef unsigned short nb_vertices = 0 54 cdef unsigned short nb_vertices = 0
54 55
55 indices_by_texture = {} 56 indices_by_texture = {}
56 57
57 for element in elements: 58 objects = chain(*[element.objects for element in elements])
59 for element in objects:
58 if nb_vertices >= MAX_ELEMENTS - 4: 60 if nb_vertices >= MAX_ELEMENTS - 4:
59 break 61 break
60 62
61 sprite = element.sprite 63 sprite = element.sprite
62 if sprite and sprite.visible: 64 if sprite and sprite.visible: