Ejemplo n.º 1
0
void wm_ghost_exit(void)
{
	if (g_system)
		GHOST_DisposeSystem(g_system);

	g_system = NULL;
}
Ejemplo n.º 2
0
void multitestapp_free(MultiTestApp *app) {
	mainwindow_free(app->main);
	loggerwindow_free(app->logger);
	GHOST_DisposeSystem(app->sys);
	MEM_freeN(app);
}
Ejemplo n.º 3
0
int main(int argc, char **argv)
{
	GHOST_GLSettings glSettings = {0};
	char *title1 = "gears - main window";
	char *title2 = "gears - secondary window";
	GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(processEvent, NULL);

	/* Create the system */
	shSystem = GHOST_CreateSystem();
	GHOST_AddEventConsumer(shSystem, consumer);
	
	if (shSystem)
	{
		/* Create the main window */
		sMainWindow = GHOST_CreateWindow(
		        shSystem, title1,
		        10, 64, 320, 200,
		        GHOST_kWindowStateNormal,
		        GHOST_kDrawingContextTypeOpenGL,
		        glSettings);
		if (!sMainWindow)
		{
			printf("could not create main window\n");
			exit(-1);
		}
		
		/* Create a secondary window */
		sSecondaryWindow = GHOST_CreateWindow(
		        shSystem,
		        title2,
		        340, 64, 320, 200,
		        GHOST_kWindowStateNormal,
		        GHOST_kDrawingContextTypeOpenGL,
		        glSettings);
		if (!sSecondaryWindow)
		{
			printf("could not create secondary window\n");
			exit(-1);
		}
		
		/* Install a timer to have the gears running */
		sGearsTimer = GHOST_InstallTimer(shSystem,
		                                 0,
		                                 10,
		                                 gearsTimerProc,
		                                 sMainWindow);

		/* Enter main loop */
		while (!sExitRequested)
		{
			if (!GHOST_ProcessEvents(shSystem, 0)) 
			{
#ifdef WIN32
				/* If there were no events, be nice to other applications */
				Sleep(10);
#endif
			}
			GHOST_DispatchEvents(shSystem);
		}
	}

	/* Dispose windows */
	if (GHOST_ValidWindow(shSystem, sMainWindow))
	{
		GHOST_DisposeWindow(shSystem, sMainWindow);
	}
	if (GHOST_ValidWindow(shSystem, sSecondaryWindow))
	{
		GHOST_DisposeWindow(shSystem, sSecondaryWindow);
	}

	/* Dispose the system */
	GHOST_DisposeSystem(shSystem);
	
	return 0;
}