Back to index

extremetuxracer  0.5beta
loading.cpp
Go to the documentation of this file.
00001 /* 
00002  * PPRacer 
00003  * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
00004  * 
00005  * Copyright (C) 1999-2001 Jasmin F. Patry
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00021 
00022 #include "loading.h"
00023 
00024 #include "ppgltk/ui_mgr.h"
00025 #include "ppgltk/audio/audio.h"
00026 
00027 #include "game_config.h"
00028 #include "gl_util.h"
00029 #include "fps.h"
00030 #include "render_util.h"
00031 #include "phys_sim.h"
00032 #include "view.h"
00033 #include "course_render.h"
00034 #include "loop.h"
00035 #include "fog.h"
00036 #include "viewfrustum.h"
00037 #include "course_mgr.h"
00038 
00039 #include "ppgltk/ui_snow.h"
00040 #include "ppgltk/ui_theme.h"
00041 
00042 #include "joystick.h"
00043 #include "part_sys.h"
00044 
00045 #include "game_mgr.h"
00046 
00047 Loading::Loading()
00048 {
00049     int width = getparam_x_resolution();
00050     int height = getparam_y_resolution();
00051        
00052        pp::Vec2d pos(width/2,height/2);   
00053        mp_loadingLbl = new pp::Label(pos,"loading",_("Loading, Please Wait..."));
00054        mp_loadingLbl->alignment.center();
00055        mp_loadingLbl->alignment.middle();
00056        
00057        m_loadedCondition = (race_conditions_t)-1;
00058        play_music( "loading" );
00059 }
00060 
00061 Loading::~Loading()
00062 {
00063        delete mp_loadingLbl;
00064 }
00065 
00066 void
00067 Loading::loop(float timeStep)
00068 {
00069        int width, height;
00070     width = getparam_x_resolution();
00071     height = getparam_y_resolution();
00072 
00073     update_audio();
00074 
00075     clear_rendering_context();
00076 
00077     set_gl_options( GUI );
00078 
00079     UIMgr.setupDisplay();
00080 
00081        drawSnow(timeStep, gameMgr->getCurrentRace().windy);
00082        
00083     theme.drawMenuDecorations();
00084 
00085     reshape( width, height );
00086 
00087        UIMgr.draw(); 
00088        
00089     winsys_swap_buffers();
00090        
00091 
00092     if ( m_loadedCourse.empty() ||
00093               m_loadedCourse != gameMgr->getCurrentRace().course ||
00094               m_loadedCondition != gameMgr->getCurrentRace().condition ) 
00095     {
00096        // Load the course
00097        load_course( gameMgr->getCurrentRace().course );
00098 
00099        m_loadedCourse = gameMgr->getCurrentRace().course;
00100        m_loadedCondition = gameMgr->getCurrentRace().condition;
00101     }
00102 
00103     set_course_mirroring( gameMgr->getCurrentRace().mirrored );
00104 
00105     // We're done here, enter INTRO mode
00106     set_game_mode( INTRO ); 
00107 }