X-Git-Url: http://nitlanguage.org diff --git a/lib/gamnit/display_linux.nit b/lib/gamnit/display_linux.nit index cb6bdf0..dcfd963 100644 --- a/lib/gamnit/display_linux.nit +++ b/lib/gamnit/display_linux.nit @@ -82,29 +82,34 @@ redef class GamnitDisplay print_error "Failed to initialize SDL2 IMG: {sdl.error}" end - var sdl_window = new SDLWindow(window_title.to_cstring, window_width, window_height, (new SDLWindowFlags).opengl) + var sdl_window = new SDLWindow(window_title.to_cstring, window_width, window_height, sdl_window_flags) assert not sdl_window.address_is_null else print_error "Failed to create SDL2 window: {sdl.error}" end # Audio support var inited = mix.initialize(mix_init_flags) - assert inited != mix_init_flags else + if inited != mix_init_flags then print_error "Failed to load SDL2 mixer format supports: {mix.error}" end - var opened = mix.open_audio(44100, mix.default_format, 2, 1024) - assert opened else + var open = mix.open_audio(44100, mix.default_format, 2, 1024) + if not open then print_error "Failed to initialize SDL2 mixer: {mix.error}" end return sdl_window end - # Initialization flags passed to SDL2 mixer + # SDL2 window initialization flags # - # Defaults to all available formats. - var mix_init_flags: MixInitFlags = mix.flac | mix.mod | mix.mp3 | mix.ogg is lazy, writable + # The default value supports OpenGL and window resizing. + var sdl_window_flags: SDLWindowFlags = (new SDLWindowFlags).opengl.resizable is lazy, writable + + # SDL2 mixer initialization flags + # + # Defaults to FLAC, MP3 and OGG. + var mix_init_flags: MixInitFlags = mix.flac | mix.mp3 | mix.ogg is lazy, writable # Close the SDL display fun close_sdl