示例#1
0
int
KillVideo()
{
	// if the IconSurface has been initialized, destroy it
	if(s_IconSurface) {
		SDL_FreeSurface(s_IconSurface);
		s_IconSurface=0;
	}

	// return failure if the video system was not initialized
	if(s_inited == 0)
		return -1;
    
	// if the rest of the system has been initialized, shut it down
#ifdef OPENGL
	// check for OpenGL and shut it down
	if(s_useOpenGL)
		KillOpenGL();
	else
#endif
		// shut down the system that converts from 8 to 16/32 bpp
		if(s_curbpp > 8)
			KillBlitToHigh();

	// shut down the SDL video sub-system
	SDL_QuitSubSystem(SDL_INIT_VIDEO);

	s_inited = 0;
	return 0;
}
示例#2
0
int
KillVideo()
{
	// if the IconSurface has been initialized, destroy it
	if(s_IconSurface) {
		SDL_FreeSurface(s_IconSurface);
		s_IconSurface=0;
	}

	// return failure if the video system was not initialized
	if(s_inited == 0)
		return -1;

	// shut down the system that converts from 8 to 16/32 bpp
	if(s_curbpp > 8)
		KillBlitToHigh();

	// Tear down SDL2 resources in reverse order from init
	if(s_texture) {
		SDL_DestroyTexture(s_texture);
		s_texture = 0;
	}

	if(s_screen) {
		SDL_FreeSurface(s_screen);
		s_screen=0;
	}

	if(s_renderer) {
		SDL_DestroyRenderer(s_renderer);
	}

	if( s_window ) {
		SDL_DestroyWindow(s_window);
		s_window=0;
	}

	// shut down the SDL video sub-system
	SDL_QuitSubSystem(SDL_INIT_VIDEO);

	s_inited = 0;
	return 0;
}