Mercurial > touhou
diff pytouhou/opengl/sprite.pyx @ 131:fab7ad2f0d8b
Use Cython, improve performances!
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 11 Sep 2011 02:02:59 +0200 |
parents | pytouhou/opengl/sprite.py@0313ca2c50e9 |
children |
line wrap: on
line diff
copy from pytouhou/opengl/sprite.py copy to pytouhou/opengl/sprite.pyx --- a/pytouhou/opengl/sprite.py +++ b/pytouhou/opengl/sprite.pyx @@ -15,10 +15,12 @@ from math import pi -from pytouhou.utils.matrix import Matrix +from pytouhou.utils.matrix cimport Matrix -def get_sprite_rendering_data(sprite): +cpdef object get_sprite_rendering_data(object sprite): + cdef Matrix vertmat + if not sprite._changed: return sprite._rendering_data @@ -52,7 +54,7 @@ def get_sprite_rendering_data(sprite): if sprite.corner_relative_placement: # Reposition vertmat.translate(width / 2., height / 2., 0.) if sprite.allow_dest_offset: - vertmat.translate(*sprite.dest_offset) + vertmat.translate(sprite.dest_offset[0], sprite.dest_offset[1], sprite.dest_offset[2]) x_1 = 1. / sprite.anm.size[0] y_1 = 1. / sprite.anm.size[1]