SDL_MixAudio(stream, (Uint8 *)audio_data, len, SDL_MIX_MAXVOLUME);
}
-int init_sdl(const char *progname, int width, int height, int sound_samplerate, int sound_chunk, void (*keyboard)(int down, SDL_Keycode sym), void (*audio)(float *data, int len))
+int init_sdl(const char *progname, int width, int height, int sound_samplerate, int sound_chunk, void (*keyboard)(int down, SDL_Keycode sym), void (*audio)(float *data, int len), int multisampling)
{
int rc;
}
sdl_initialized = 1;
+ if (multisampling) {
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, multisampling);
+ }
+
/* open window */
gl_window = SDL_CreateWindow(progname, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
if (!gl_window) {
/* just in case */
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
+ if (multisampling)
+ glEnable(GL_MULTISAMPLE);
/* open audio */
SDL_AudioSpec want, have;
if (fullscreen) {
fullscreen = 0;
SDL_SetWindowFullscreen(gl_window, 0);
+ SDL_ShowCursor(SDL_ENABLE);
} else {
SDL_SetWindowFullscreen(gl_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+ SDL_ShowCursor(SDL_DISABLE);
fullscreen = 1;
}
}