Exemplo n.º 1
0
// This runs the game
void MainGame::Run()
{
	InitSystems();

	// temp
	_sprites.push_back(new Sprite());
	_sprites.back()->Init(-1.0f, -1.0f, 1.0f, 1.0f, "Textures/kumiko.png");

	_sprites.push_back(new Sprite());
	_sprites.back()->Init(0.0f, -1.0f, 1.0f, 1.0f, "Textures/kumiko.png");

	_sprites.push_back(new Sprite());
	_sprites.back()->Init(0.0f, 0.0f, 1.0f, 1.0f, "Textures/kumiko.png");

	for (int i = 0; i < 10; i++)
	{
		_sprites.push_back(new Sprite());
		_sprites.back()->Init(-1.0f, 0.0f, 1.0f, 1.0f, "Textures/kumiko.png");
	}

	//_playerTexture = ImageLoader::LoadPNG("Textures/kumiko.png");

	//This only returns when the game ends
	GameLoop();
}
Exemplo n.º 2
0
CParticleSystemLibrary::CParticleSystemLibrary()
{
	s_pParticleSystemLibrary = this;
	m_iParticleSystemsLoaded = 0;

	m_iSystemInstanceIndex = 0;

	InitSystems();
}
Exemplo n.º 3
0
void CParticleSystemLibrary::ReloadSystems()
{
	ClearInstances();

	CParticleSystemLibrary* pPSL = Get();

	for (size_t i = 0; i < pPSL->m_apParticleSystems.size(); i++)
		delete pPSL->m_apParticleSystems[i];

	pPSL->m_apParticleSystems.clear();

	InitSystems();

	for (size_t i = 0; i < pPSL->m_apParticleSystems.size(); i++)
		pPSL->LoadParticleSystem(i);
}
Exemplo n.º 4
0
bool CEngine::Init() 
{
    Message("Engine Init\n");

	Timer()->Start();

    CreateSystems();

    if ( !InitSystems() ) 
    {
        return false;
    }
    
    Message("Engine Init Successful\n");
    return true;
}
Exemplo n.º 5
0
BOOL GApp::Initialize( VOID )
{
__ENTER_FUNCTION

	InitPacketFactories();
	g_Log.SaveLog( LOG_LV_NORMAL, "Initialized Packet Factories, total num<%d>",
		g_PacketFactoryManager.GetCount() );

	m_mapSystems.clear();
	InitSystems();
	g_Log.SaveLog( LOG_LV_NORMAL, "Initialized Systems, total num<%d>",
		m_mapSystems.size() );

	m_StubManager.SetConnectedPtr( GApp::__OnConnected );
	m_StubManager.SetDisconnectedPtr( GApp::__OnDisconnected );

	if( !m_StubManager.Init( 1231 ) )
	{
		g_Log.SaveLog( LOG_LV_ERROR, "StubManager Init<%d> failed!", 1231 );
	}
	else
	{
		g_Log.SaveLog( LOG_LV_NORMAL, "StubManager Init Successed!" );
	}

	SystemPtrMap::iterator itEnd = m_mapSystems.end();
	for( SystemPtrMap::iterator it = m_mapSystems.begin(); it != itEnd; ++it )
	{
		g_Log.SaveLog( LOG_LV_NORMAL, "Initialize System<%s> ....", it->second->SystemName() );
		if( !it->second->__Initialize() )
		{
			g_Log.SaveLog( LOG_LV_ERROR, "Initialize System<%s> failed!", it->second->SystemName() );
			continue;
		}
		
		g_Log.SaveLog( LOG_LV_NORMAL, "Initialize System<%s> successed!", it->second->SystemName() );
	}

	return TRUE;

__LEAVE_FUNCTION

	return FALSE;
}
Exemplo n.º 6
0
void MainProgram::Run()
{
  //Init stuff which are needed before the main loop
  if (InitSystems())
  {
    //if the systems initialized properly
    //Enter the loop
    MainLoop();
  }

  //end program
  SDL_DestroyRenderer(m_renderer.GetRenderer());
  SDL_DestroyWindow(m_window.GetWindow());

  m_window.SetNull();
  m_renderer.SetNull();

  SDL_Quit();
}