Пример #1
0
    void Browser::RenderApp() {
        // Begin to draw
        Begin();

        // Draw bg
        RenderBg();

        // Draw some text using font
        m_font.Begin();
        // need to fix that ..
        //m_font.DrawTextF("Error ?", SelectedColor, -0.55f, 0.3f);

        // Top part
        RenderTopPanel();

        // Render file listing
        RenderFileListPanel();

        // Render bottom part
        RenderFileInfoPanel();

        RenderActionPanel();

        if (panelSelected == PANEL_PROGRESS)
            RenderProgress();

        // Finished to draw font things ...
        m_font.End();

        // Draw all text + form
        Render();
        // Draw is finished
        End();
    }
//Función para cargar los recursos necesarios para el juego.
bool cGame::LoadResources( void )
{

	bool lbResult;

	lbResult = LoadWindowProperties();

	if ( lbResult )
	{
		//Se inicializa la clase que encapsula las operaciones de OpenGL:
		lbResult = cGraphicManager::Get().Init( &cWindow::Get() );   

		// Clean Window context
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);     
		// Resetea color de fondo
		glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

		if (lbResult)
		{
			//Se inicializa la clase que gestiona la texturas indicando que habrá 1, por ejemplo.
			cTextureManager::Get().Init(60);

			mMad_drive_loading = cTextureManager::Get().LoadResource( "Mad_drive_loading", "Data/Scene/images/hud/mad_drive_loading.png" );
			mMad_drive = cTextureManager::Get().LoadResource( "Mad_drive", "Data/Scene/images/hud/mad_drive.png" );
			mLoading = cTextureManager::Get().LoadResource( "Loading", "Data/Scene/images/hud/loading.png" );

			Load2DCameraProperties();

			cGraphicManager::Get().ActivateCamera( &m2DCamera );

			RenderProgress(0.1f);

			Load3DCameraProperties();

			RenderProgress(0.2f);

			LoadIAProperties();

			LoadManagerProperties();

			RenderProgress(0.3f);

			//Se carga la escena.
			//mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/dragonsmall.DAE" ); 		
			//*mDuck = cSceneManager::Get().LoadResource( "Duck", "./Data/Scene/duck_triangulate.dae" ); 
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_cactus.dae" ); 
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_carretera.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_matorral.dae" ); 
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_palmera.dae" ); 
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_tronco.dae" ); 

			LoadVehicles();

			RenderProgress(0.5f);

			LoadHUD();

			RenderProgress(0.6f);

			LoadEffects();

			RenderProgress(0.7f);

			LoadObstacles();

			RenderProgress(0.85f);

//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_exterior.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_arma.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_rueda.dae" );
//		    mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_ruina.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/combustible.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/especial_invencibilidad.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/especial_superturbo.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/municion.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo1_destruido_arma.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo1_destruido_exterior.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_destruido_arma.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_destruido_exterior.dae" );
//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mustang_destruido_exterior.dae" );
			//mScene1 = cSceneManager::Get().LoadResource( "TestLevel1", "./Data/Scene/mustang_destruido_interior.dae" );
			
			// Loads skeleton 
		//	cResourceHandle mustang_mesh = cMeshManager::Get().LoadResource("testlevel1", "./Data/Scene/mustang_destruido_interior.dae");

			/*if (!((cScene *)mScene.GetResource())->Init("TestLevel1", "./Data/Scene/mustang_destruido_interior.dae")){
				OutputDebugStr("Error loading object!");
			}*/

//			mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/plane.DAE" );

			//cPhysicObject mModelObject = *((cPhysicObject*) ((cScene *)mScene.GetResource())->getSubObject( 1 ));


			// Inits skeleton model
			//cSkeletalManager::Get().LoadResource("Skeleton", "./Data/Skeletal/SkeletonModel.xml");
		
			// Loads skeleton 
			//mSkeletalMesh = cMeshManager::Get().LoadResource("Skeleton", "Skeleton", kuiSkeletalMesh);

			// Get skeleton mesh
			//cSkeletalMesh* lpSkeletonMesh=(cSkeletalMesh*)mSkeletalMesh.GetResource();

			// Load Skeleton meshes
			//cResourceHandle lMaterial = cMaterialManager::Get().LoadResource("Skeleton", "./Data/Material/SkeletonMaterial.xml");
		
			//assert(lMaterial.IsValidHandle());
			//mObject.AddMesh(mSkeletalMesh, lMaterial);	
		
			// Bounding box del personaje
			/*mBoxModel.InitBox( 0.0f, cVec3( 0.3f, 1.0f, 0.3f ) );
			mObject.CreatePhysics( &mBoxModel );
			lScaleMatrix.LoadScale(0.01f);
			mObject.SetScaleMatrix( lScaleMatrix );*/

			LoadObjects();

			RenderProgress(1.0f);
			
			LoadWorld();

		} else {
			//Si algo falla se libera la ventana.
			cWindow::Get().Deinit();
		}
	}

   return lbResult;
}