added support for by-menu bg pictures

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2882 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-01-12 00:49:25 +00:00
parent 16c4d61de2
commit e44ac903d3
6 changed files with 35 additions and 8 deletions

View File

@ -10,7 +10,8 @@
;; points 1st, 0 is least points
;; 1st
(title-music "main_theme.music")
(menu-background "st_title_screen.rgb")
(mainmenu-background "st_title_screen.rgb")
(menu-background "menu_background.rgb")
(game-style "nitro") ;; "wheelie" or "nitro"
(max-history 10000) ;; maximum number of history frames.
(max-skidmarks 100) ;; max. number of skidmarks per kart.

View File

@ -120,6 +120,12 @@ void MenuManager::pushMenu(MenuManagerIDs id)
m_change_menu = true;
}
//-----------------------------------------------------------------------------
const bool MenuManager::isMainMenuActive() const
{
return m_menu_stack[ m_menu_stack.size()-1 ].first == MENUID_MAINMENU;
}
//-----------------------------------------------------------------------------
void MenuManager::popMenu()
{

View File

@ -92,7 +92,8 @@ public:
BaseGUI* getCurrentMenu() const {return m_current_menu;}
RaceGUI* getRaceMenu () const {return (RaceGUI*)m_RaceGUI;}
void update();
const bool isMainMenuActive() const;
private:
std::vector< std::pair<MenuManagerIDs, int> >
m_menu_stack;

View File

@ -61,9 +61,13 @@ MainLoop::~MainLoop()
*/
void MainLoop::run()
{
const GLuint TITLE_SCREEN_TEXTURE =
static const GLuint TITLE_SCREEN_TEXTURE =
material_manager->getMaterial(stk_config->m_mainmenu_background)->getState()->getTextureHandle();
static const GLuint MENUS_BG_TEXTURE =
material_manager->getMaterial(stk_config->m_menu_background)->getState()->getTextureHandle();
bool music_on = false;
m_curr_time = SDL_GetTicks();
float dt;
@ -181,9 +185,16 @@ void MainLoop::run()
// usleep(2000);
#endif
//Draw the splash screen
glBindTexture(GL_TEXTURE_2D,TITLE_SCREEN_TEXTURE);
if(menu_manager->isMainMenuActive())
glBindTexture(GL_TEXTURE_2D, TITLE_SCREEN_TEXTURE);
else
glBindTexture(GL_TEXTURE_2D, MENUS_BG_TEXTURE);
glBegin ( GL_QUADS ) ;
glColor3f (1, 1, 1 ) ;
glTexCoord2f(0, 0); glVertex2i(-1, -1);

View File

@ -89,6 +89,11 @@ void STKConfig::load(const std::string &filename)
fprintf(stderr,"No menu background defined in stk_config");
exit(-1);
}
if(m_mainmenu_background.size()==0)
{
fprintf(stderr,"No mainmenu background defined in stk_config");
exit(-1);
}
CHECK_NEG(m_max_karts, "max-karts" );
CHECK_NEG(m_grid_order, "grid-order" );
CHECK_NEG(m_parachute_friction, "parachute-friction" );
@ -177,6 +182,7 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
lisp->get("delay-finish-time", m_delay_finish_time );
lisp->get("music-credit-time", m_music_credit_time );
lisp->get("menu-background", m_menu_background );
lisp->get("mainmenu-background", m_mainmenu_background );
lisp->get("enable_networking", m_enable_networking );
std::string title_music;
lisp->get("title-music", title_music );

View File

@ -81,8 +81,10 @@ public:
MusicInformation
*m_title_music; /**<Filename of the title music to play.*/
std::string
m_menu_background; /**<Picture used as menu background. */
m_mainmenu_background; /**<Picture used as menu background. */
std::string
m_menu_background; /**<Picture used as background for other menus. */
/** Empty constructor. The actual work is done in load. */
STKConfig() {};
void init_defaults ();