comparison pytouhou/ui/opengl/backend.pyx @ 554:653a9f087673

Make both double- and single-buffer available on the CLI, but default to SDL’s default.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 30 May 2014 04:06:09 +0200
parents 8f51e34d911c
children 98380e4a0ee5
comparison
equal deleted inserted replaced
553:8f51e34d911c 554:653a9f087673
21 21
22 version = options['version'] 22 version = options['version']
23 major = int(version) 23 major = int(version)
24 minor = <int>(version * 10) % 10 24 minor = <int>(version * 10) % 10
25 25
26 double_buffer = options['double-buffer'] 26 maybe_double_buffer = options['double-buffer']
27 double_buffer = maybe_double_buffer if maybe_double_buffer is not None else -1
28
27 is_legacy = flavor == 'legacy' 29 is_legacy = flavor == 'legacy'
28 30
29 #TODO: check for framebuffer/renderbuffer support. 31 #TODO: check for framebuffer/renderbuffer support.
30 32
31 from pytouhou.ui.opengl.gamerenderer import GameRenderer 33 from pytouhou.ui.opengl.gamerenderer import GameRenderer
32 34
33 35
34 def create_window(title, x, y, width, height): 36 def create_window(title, x, y, width, height):
35 sdl.gl_set_attribute(sdl.GL_CONTEXT_MAJOR_VERSION, major) 37 sdl.gl_set_attribute(sdl.GL_CONTEXT_MAJOR_VERSION, major)
36 sdl.gl_set_attribute(sdl.GL_CONTEXT_MINOR_VERSION, minor) 38 sdl.gl_set_attribute(sdl.GL_CONTEXT_MINOR_VERSION, minor)
37 sdl.gl_set_attribute(sdl.GL_DOUBLEBUFFER, double_buffer)
38 sdl.gl_set_attribute(sdl.GL_DEPTH_SIZE, 24) 39 sdl.gl_set_attribute(sdl.GL_DEPTH_SIZE, 24)
40 if double_buffer >= 0:
41 sdl.gl_set_attribute(sdl.GL_DOUBLEBUFFER, double_buffer)
39 42
40 flags = sdl.WINDOW_SHOWN | sdl.WINDOW_OPENGL 43 flags = sdl.WINDOW_SHOWN | sdl.WINDOW_OPENGL
41 44
42 #TODO: legacy can support one of the framebuffer extensions. 45 #TODO: legacy can support one of the framebuffer extensions.
43 if not is_legacy: 46 if not is_legacy: