Mercurial > touhou
comparison pytouhou/ui/window.pyx @ 450:2a352118c55a
Add back Windows support, using GLEW for OpenGL.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 30 Aug 2013 18:21:07 +0200 |
parents | d8630c086926 |
children | 1f5156093785 |
comparison
equal
deleted
inserted
replaced
449:d56536ef28e8 | 450:2a352118c55a |
---|---|
17 | 17 |
18 from pytouhou.lib.opengl cimport \ | 18 from pytouhou.lib.opengl cimport \ |
19 (glEnable, glHint, glEnableClientState, GL_TEXTURE_2D, GL_BLEND, | 19 (glEnable, glHint, glEnableClientState, GL_TEXTURE_2D, GL_BLEND, |
20 GL_PERSPECTIVE_CORRECTION_HINT, GL_FOG_HINT, GL_NICEST, | 20 GL_PERSPECTIVE_CORRECTION_HINT, GL_FOG_HINT, GL_NICEST, |
21 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY) | 21 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY) |
22 | |
23 IF USE_GLEW: | |
24 from pytouhou.lib.opengl cimport glewInit | |
22 | 25 |
23 | 26 |
24 class Clock(object): | 27 class Clock(object): |
25 def __init__(self, fps=None): | 28 def __init__(self, fps=None): |
26 self._target_fps = 0 | 29 self._target_fps = 0 |
74 fixed_pipeline=False, sound=True): | 77 fixed_pipeline=False, sound=True): |
75 self.fps_limit = fps_limit | 78 self.fps_limit = fps_limit |
76 self.use_fixed_pipeline = fixed_pipeline | 79 self.use_fixed_pipeline = fixed_pipeline |
77 self.runner = None | 80 self.runner = None |
78 | 81 |
82 IF UNAME_SYSNAME == "Windows": | |
83 sdl.set_main_ready() | |
79 sdl.init(sdl.INIT_VIDEO) | 84 sdl.init(sdl.INIT_VIDEO) |
80 sdl.img_init(sdl.INIT_PNG) | 85 sdl.img_init(sdl.INIT_PNG) |
81 if sound: | 86 if sound: |
82 sdl.mix_init(0) | 87 sdl.mix_init(0) |
83 | 88 |
91 self.win = sdl.Window('PyTouhou', | 96 self.win = sdl.Window('PyTouhou', |
92 sdl.WINDOWPOS_CENTERED, sdl.WINDOWPOS_CENTERED, | 97 sdl.WINDOWPOS_CENTERED, sdl.WINDOWPOS_CENTERED, |
93 self.width, self.height, | 98 self.width, self.height, |
94 sdl.WINDOW_OPENGL | sdl.WINDOW_SHOWN) | 99 sdl.WINDOW_OPENGL | sdl.WINDOW_SHOWN) |
95 self.win.gl_create_context() | 100 self.win.gl_create_context() |
101 | |
102 IF USE_GLEW: | |
103 if glewInit() != 0: | |
104 raise Exception('GLEW init fail!') | |
96 | 105 |
97 # Initialize OpenGL | 106 # Initialize OpenGL |
98 glEnable(GL_BLEND) | 107 glEnable(GL_BLEND) |
99 if self.use_fixed_pipeline: | 108 if self.use_fixed_pipeline: |
100 glEnable(GL_TEXTURE_2D) | 109 glEnable(GL_TEXTURE_2D) |