#include "print.h"
#include "../../include/keycodes.h"
#include "sdl.h"
-#include "opengl.h"
#include <SDL2/SDL.h>
#define GL3_PROTOTYPES 1
}
sdl_initialized = 1;
+retry_without_multisampling:
if (multisampling > 1) {
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
/* open window */
gl_window = SDL_CreateWindow(progname, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
if (!gl_window) {
- print_error("Failed to open SDL window: %s (try without multisampling)\n", SDL_GetError());
+ if (multisampling) {
+ print_info("Failed to open SDL window: %s (retrying without multisampling)\n", SDL_GetError());
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
+ multisampling = 0;
+ goto retry_without_multisampling;
+ }
+ print_error("Failed to open SDL window: %s\n", SDL_GetError());
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, multisampling);
rc = EIO;
goto error;
}
case SDLK_RCTRL: return KEYCODE_RCTRL;
case SDLK_LSHIFT: return KEYCODE_LSHIFT;
case SDLK_RSHIFT: return KEYCODE_RSHIFT;
+ case SDLK_LALT: return KEYCODE_LALT;
+ case SDLK_RALT: return KEYCODE_RALT;
case SDLK_PAUSE: return KEYCODE_PAUSE;
case SDLK_LEFT: return KEYCODE_LEFT;
case SDLK_RIGHT: return KEYCODE_RIGHT;