changeset 257:9b699e8de4a7

Switch Bullet to Cython to improve performances.
author Thibaut Girka <thib@sitedethib.com>
date Sun, 22 Jan 2012 21:54:07 +0100
parents 507dfd6efe0c
children 620134bc51f4
files pytouhou/game/bullet.py pytouhou/game/bullet.pyx
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
rename from pytouhou/game/bullet.py
rename to pytouhou/game/bullet.pyx
--- a/pytouhou/game/bullet.py
+++ b/pytouhou/game/bullet.pyx
@@ -21,7 +21,14 @@ from pytouhou.game.sprite import Sprite
 
 LAUNCHING, LAUNCHED, CANCELLED = range(3)
 
-class Bullet(object):
+cdef class Bullet(object):
+    cdef public unsigned int _state, flags, frame, sprite_idx_offset
+    cdef public double dx, dy, angle, speed #TODO
+    cdef public object player_bullet, target
+    cdef public object _game, _sprite, _anmrunner, _removed, _bullet_type, _was_visible
+    cdef public object attributes, damage, hitbox_half_size, speed_interpolator, grazed
+    cdef public object x, y #TODO
+
     def __init__(self, pos, bullet_type, sprite_idx_offset,
                        angle, speed, attributes, flags, target, game,
                        player_bullet=False, damage=0, hitbox=None):