Example #1
0
CGameStartup::~CGameStartup()
{
	if (m_pMod)
	{
		m_pMod->Shutdown();
		m_pMod = 0;
	}

	if (m_modDll)
	{
		CryFreeLibrary(m_modDll);
		m_modDll = 0;
	}

	ShutdownFramework();
}
CGameStartup::~CGameStartup()
{
	if (m_pGame)
	{
		m_pGame->Shutdown();
		m_pGame = nullptr;
	}

	if (m_gameDll)
	{
		CryFreeLibrary(m_gameDll);
		m_gameDll = 0;
	}

	ShutdownFramework();
}
Example #3
0
CGameStartup::~CGameStartup()
{
	if (m_pMod)
	{
		m_pMod->Shutdown();
		m_pMod = 0;
	}

	if (m_modDll)
	{
		CryFreeLibrary(m_modDll);
		m_modDll = 0;
	}

	CGameStartupStatic::g_pGameStartup = NULL;

	ShutdownFramework();
}
Example #4
0
void Framework::ProcessEvents()
{
	if( ProgramStages->IsEmpty() )
  {
    quitProgram = true;
    return;
	}

	// Convert Allegro events before we process
	// TODO: Consider threading the translation
	TranslateAllegroEvents();

	al_lock_mutex( eventMutex );

	while( eventQueue.size() > 0 && !ProgramStages->IsEmpty() )
	{
#ifdef WRITE_LOG
  // fprintf( LogFile, "Framework: ProcessEvents (%d events queued)\n", eventQueue.size() );
#endif

		Event* e;
		e = eventQueue.front();
		eventQueue.pop_front();
		switch( e->Type )
		{
			case EVENT_WINDOW_CLOSED:
				delete e;
				al_unlock_mutex( eventMutex );
				ShutdownFramework();
				return;
				break;
			default:
				ProgramStages->Current()->EventOccurred( e );
#ifdef DOWNLOAD_SUPPORT
				DOWNLOADS->EventOccured( e );
#endif
				break;
		}
		delete e;
	}

	al_unlock_mutex( eventMutex );
}
Example #5
0
Framework::~Framework()
{
#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Save Config\n" );
#endif
  SaveSettings();

#ifdef PANDORA
#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Hacky Pandora Shutdown\n" );
#endif
	raise(SIGKILL);
#endif

#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Clear stages\n" );
#endif
	if( ProgramStages != 0 )
	{
		// Just make sure all stages are popped and deleted
		ShutdownFramework();
	}

#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Shutdown\n" );
#endif
	al_unregister_event_source( eventAllegro, DISPLAY->GetEventSource() );
	al_destroy_event_queue( eventAllegro );
	al_destroy_mutex( eventMutex );
	al_destroy_timer( frameTimer );

#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Shutdown display\n" );
#endif
	DISPLAY->Shutdown();
	delete DISPLAY;

#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Shutdown audio\n" );
#endif
	delete AUDIO;
	
#ifdef NETWORK_SUPPORT
#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Shutdown enet\n" );
#endif
	enet_deinitialize();
#endif

#ifdef DOWNLOAD_SUPPORT
#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Shutdown downloads\n" );
#endif
	DOWNLOADS->AbortDownloads = true;
	delete DOWNLOADS;
#endif

#ifdef WRITE_LOG
  fprintf( LogFile, "Framework: Shutdown Allegro\n" );
#endif
	al_uninstall_system();

#ifdef WRITE_LOG
	fclose( LogFile );
#endif

}