comparison pytouhou/ui/gamerunner.py @ 420:3a7b36324611

Replace Pyglet’s image loader with our SDL2_image-based one.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 16 Jul 2013 21:07:15 +0200
parents 1c92721f8e49
children b1248bab2d0f
comparison
equal deleted inserted replaced
419:1c92721f8e49 420:3a7b36324611
86 class GameRunner(GameRenderer): 86 class GameRunner(GameRenderer):
87 def __init__(self, resource_loader, game=None, background=None, replay=None, double_buffer=True, fps_limit=60, fixed_pipeline=False, skip=False): 87 def __init__(self, resource_loader, game=None, background=None, replay=None, double_buffer=True, fps_limit=60, fixed_pipeline=False, skip=False):
88 GameRenderer.__init__(self, resource_loader, game, background) 88 GameRenderer.__init__(self, resource_loader, game, background)
89 89
90 sdl.init(sdl.INIT_VIDEO) 90 sdl.init(sdl.INIT_VIDEO)
91 sdl.img_init(sdl.INIT_PNG)
91 sdl.gl_set_attribute(sdl.GL_CONTEXT_MAJOR_VERSION, 2) 92 sdl.gl_set_attribute(sdl.GL_CONTEXT_MAJOR_VERSION, 2)
92 sdl.gl_set_attribute(sdl.GL_CONTEXT_MINOR_VERSION, 1) 93 sdl.gl_set_attribute(sdl.GL_CONTEXT_MINOR_VERSION, 1)
93 sdl.gl_set_attribute(sdl.GL_DOUBLEBUFFER, int(double_buffer)) 94 sdl.gl_set_attribute(sdl.GL_DOUBLEBUFFER, int(double_buffer))
94 sdl.gl_set_attribute(sdl.GL_DEPTH_SIZE, 24) 95 sdl.gl_set_attribute(sdl.GL_DEPTH_SIZE, 24)
95 96
186 vbo_array = (c_uint * 2)(self.vbo, self.back_vbo) 187 vbo_array = (c_uint * 2)(self.vbo, self.back_vbo)
187 glDeleteBuffers(2, vbo_array) 188 glDeleteBuffers(2, vbo_array)
188 189
189 self.win.gl_delete_context() 190 self.win.gl_delete_context()
190 self.win.destroy_window() 191 self.win.destroy_window()
192 sdl.img_quit()
191 sdl.quit() 193 sdl.quit()
192 194
193 195
194 def update(self): 196 def update(self):
195 if self.background: 197 if self.background: