Ejemplo n.º 1
0
void ClientApplication::Proc() {
	LoadScene(SceneList::FIRST);

	//prepare the time system
	typedef std::chrono::steady_clock Clock;

	Clock::time_point simTime = Clock::now();
	Clock::time_point realTime;

	//The main loop
	while(activeScene->GetNextScene() != SceneList::QUIT) {
		//switch scenes when necessary
		if (activeScene->GetNextScene() != SceneList::CONTINUE) {
			LoadScene(activeScene->GetNextScene());
			continue;
		}

		//update the current time
		realTime = Clock::now();

		//simulate game time
		while (simTime < realTime) {
			//call each user defined function
			activeScene->RunFrame();
			//~60 FPS
			simTime += std::chrono::duration<int, std::milli>(16);
		}

		//draw the game to the screen
		activeScene->RenderFrame();
	}

	UnloadScene();
}
Ejemplo n.º 2
0
void ClientApplication::LoadScene(SceneList sceneIndex) {
	UnloadScene();
	switch(sceneIndex) {
		//add scene creation calls here
		case SceneList::FIRST:
		case SceneList::CONWAY:
			activeScene = new Conway();
		break;
		default:
			throw(std::logic_error("Failed to recognize the scene index"));
	}
}
Ejemplo n.º 3
0
void Player::UnloadAllScenes()
{
    Vector<SharedPtr<Scene>> scenes = loadedScenes_;

    for (unsigned i = 0; i < scenes.Size(); i++)
    {
        UnloadScene(scenes[i]);
    }

    assert(loadedScenes_.Size() == 0);
    
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *filename - 
//-----------------------------------------------------------------------------
void C_SceneEntity::LoadSceneFromFile( const char *filename )
{
	UnloadScene();

	int sleepCount = 0;
	while ( scenefilecache->IsStillAsyncLoading( filename ) )
	{
		::Sleep( 10 );
		++sleepCount;

		if ( sleepCount > 10 )
		{
			Assert( 0 );
			break;
		}
	}
	m_pScene = LoadScene( filename );
}
Ejemplo n.º 5
0
C_SceneEntity::~C_SceneEntity( void )
{
	UnloadScene();
}
Ejemplo n.º 6
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *filename - 
//-----------------------------------------------------------------------------
void C_SceneEntity::LoadSceneFromFile( const char *filename )
{
	UnloadScene();
	m_pScene = LoadScene( filename );
}
Ejemplo n.º 7
0
  /// \brief
	///   This overridable is called when loading is aborted. The default implementation calls UnloadScene and sets the m_bAborted flag
  SCENE_IMPEXP virtual void OnAbort()
  {
    m_bAborted = true;
    UnloadScene();
  }
Ejemplo n.º 8
0
  /// \brief
  ///   Static helper function to clear the scene content, and prepare empty scene
  ///   for use.	
  static inline void  ClearScene()   
  { 
    UnloadScene();

    Vision::InitWorld();
  }