comparison pytouhou/ui/window.pyx @ 458:1b56d62250ab

Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 05 Sep 2013 23:11:54 +0200
parents cae1ae9de430
children ec327e58b477
comparison
equal deleted inserted replaced
457:4ccc47828002 458:1b56d62250ab
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details. 12 ## GNU General Public License for more details.
13 ## 13 ##
14 14
15 15
16 from pytouhou.lib cimport sdl
17
18 from pytouhou.lib.opengl cimport \ 16 from pytouhou.lib.opengl cimport \
19 (glEnable, glHint, glEnableClientState, GL_TEXTURE_2D, GL_BLEND, 17 (glEnable, glHint, glEnableClientState, GL_TEXTURE_2D, GL_BLEND,
20 GL_PERSPECTIVE_CORRECTION_HINT, GL_FOG_HINT, GL_NICEST, 18 GL_PERSPECTIVE_CORRECTION_HINT, GL_FOG_HINT, GL_NICEST,
21 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY) 19 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY)
22 20
23 IF USE_GLEW: 21 IF USE_GLEW:
24 from pytouhou.lib.opengl cimport glewInit 22 from pytouhou.lib.opengl cimport glewInit
25 23
26 24
27 cdef class Clock: 25 cdef class Clock:
28 cdef long _target_fps, _ref_tick, _ref_frame, _fps_tick, _fps_frame
29 cdef double _rate
30
31 def __init__(self, long fps=-1): 26 def __init__(self, long fps=-1):
32 self._target_fps = 0 27 self._target_fps = 0
33 self._ref_tick = 0 28 self._ref_tick = 0
34 self._ref_frame = 0 29 self._ref_frame = 0
35 self._fps_tick = 0 30 self._fps_tick = 0
78 self._ref_frame = 0 73 self._ref_frame = 0
79 74
80 75
81 76
82 cdef class Window: 77 cdef class Window:
83 cdef sdl.Window win 78 def __init__(self, tuple size=None, bint double_buffer=True, long fps_limit=-1,
84 cdef long fps_limit
85 cdef public long width, height
86 cdef public bint use_fixed_pipeline
87 cdef object runner
88 cdef Clock clock
89
90 def __init__(self, size=None, bint double_buffer=True, long fps_limit=-1,
91 bint fixed_pipeline=False, bint sound=True): 79 bint fixed_pipeline=False, bint sound=True):
92 self.fps_limit = fps_limit 80 self.fps_limit = fps_limit
93 self.use_fixed_pipeline = fixed_pipeline 81 self.use_fixed_pipeline = fixed_pipeline
94 self.runner = None 82 self.runner = None
95 83