diff pytouhou/ui/texture.pyx @ 473:1c891c71cf22

Cythonize pytouhou.game.text.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 16 Sep 2013 18:42:12 +0200
parents cae1ae9de430
children 69c73023f7a0
line wrap: on
line diff
--- a/pytouhou/ui/texture.pyx
+++ b/pytouhou/ui/texture.pyx
@@ -21,6 +21,7 @@ from pytouhou.lib.opengl cimport \
 
 from pytouhou.lib.sdl cimport load_png, create_rgb_surface, Font
 from pytouhou.formats.thtx import Texture #TODO: perhaps define that elsewhere?
+from pytouhou.game.text cimport NativeText
 
 import os
 
@@ -60,8 +61,10 @@ cdef class FontManager:
 
 
     def load(self, label_list):
+        cdef NativeText label
+
         for label in label_list:
-            if not hasattr(label, 'texture'):
+            if label.texture is None:
                 surface = self.font.render(label.text)
                 label.width, label.height = surface.surface.w, surface.surface.h