Exemple #1
0
static void
SDLGL_Close(void *obj)
{
	AG_Driver *drv = obj;
	AG_DriverSDLGL *sgl = obj;

#ifdef AG_DEBUG
	if (nDrivers != 1) { AG_FatalError("Driver close without open"); }
#endif
	AG_FreeCursors(AGDRIVER(sgl));

	if (AG_CfgBool("view.full-screen")) {
		SDL_WM_ToggleFullScreen(sgl->s);
	}
	if (initedSDLVideo) {
		SDL_QuitSubSystem(SDL_INIT_VIDEO);
		initedSDLVideo = 0;
	}
	AG_ObjectDetach(drv->mouse);
	AG_ObjectDestroy(drv->mouse);
	AG_ObjectDetach(drv->kbd);
	AG_ObjectDestroy(drv->kbd);
	drv->mouse = NULL;
	drv->kbd = NULL;

	if (sgl->outMode != AG_SDLGL_OUT_NONE) {
		Free(sgl->outBuf);
		sgl->outBuf = NULL;
		sgl->outMode = AG_SDLGL_OUT_NONE;
	}

	nDrivers = 0;
}
Exemple #2
0
static void
SDLGL_Close(void *obj)
{
	AG_Driver *drv = obj;
	AG_DriverSw *dsw = obj;
	AG_DriverSDLGL *sgl = obj;
	
	AG_DelEventSpinner(sglEventSpinner); sglEventSpinner = NULL;
	AG_DelEventEpilogue(sglEventEpilogue); sglEventEpilogue = NULL;

	if (drv->gl != NULL)
		AG_GL_DestroyContext(sgl);

#ifdef AG_DEBUG
	if (nDrivers != 1) { AG_FatalError("Driver close without open"); }
#endif
	AG_FreeCursors(AGDRIVER(sgl));

	if (dsw->flags & AG_DRIVER_SW_FULLSCREEN) {
		if (SDL_WM_ToggleFullScreen(sgl->s))
			dsw->flags &= ~(AG_DRIVER_SW_FULLSCREEN);
	}
	if (initedSDLVideo) {
		SDL_QuitSubSystem(SDL_INIT_VIDEO);
		initedSDLVideo = 0;
	}
	AG_ObjectDelete(drv->mouse); drv->mouse = NULL;
	AG_ObjectDelete(drv->kbd); drv->kbd = NULL;

	if (sgl->outMode != AG_SDLGL_OUT_NONE) {
		Free(sgl->outBuf);
		sgl->outBuf = NULL;
		sgl->outMode = AG_SDLGL_OUT_NONE;
	}

	nDrivers = 0;
}