Ejemplo n.º 1
0
int video_init(void)
{
    SDL_WM_SetCaption("iceball",NULL);

    screen = SDL_SetVideoMode(screen_width, screen_height, 32, 0);

    if(screen == NULL)
        return error_sdl("SDL_SetVideoMode");

    return 0;
}
Ejemplo n.º 2
0
int platform_init(void)
{
    if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE))
        return error_sdl("SDL_Init");

#ifndef WIN32
    signal(SIGPIPE, SIG_IGN);
    signal(SIGINT, SIG_DFL);
#endif

    return 0;
}
Ejemplo n.º 3
0
int video_init(void)
{
	SDL_WM_SetCaption("iceball",NULL);
	
#ifdef USE_OPENGL
	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_DEPTH_SIZE, 24);

	if (screen_antialiasing_level > 0)
	{
		SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
		SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, screen_antialiasing_level);
	}

	screen = SDL_SetVideoMode(screen_width, screen_height, 32, SDL_OPENGL
		| (screen_fullscreen ? SDL_FULLSCREEN : 0));
	GLenum err_glew = glewInit();
	if(err_glew != GLEW_OK)
	{
		fprintf(stderr, "GLEW failed to init: %s\n", glewGetErrorString(err_glew));
		return 1;
	}
	if(!GL_ARB_texture_non_power_of_two)
	{
		fprintf(stderr, "ERROR: GL_ARB_texture_non_power_of_two not supported by your GPU. Either get a better GPU, or use the software renderer.\n");
		return 1;
	}
#else
	screen = SDL_SetVideoMode(screen_width, screen_height, 32, 0
		| (screen_fullscreen ? SDL_FULLSCREEN : 0));
#endif
	
	if(screen == NULL)
		return error_sdl("SDL_SetVideoMode");
	
	return 0;
}