Fixed help widgets not being highlighted after switching pages by separating the pages(which also makes things cleaner), plus the removal of a bunch of commented out code that won't be useful in the future from the files in the src/gui/ directory.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1347 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2007-12-12 21:30:30 +00:00
parent d3e0019d61
commit 38a4c359b2
24 changed files with 293 additions and 424 deletions

View File

@ -109,7 +109,8 @@ supertuxkart_SOURCES = main.cpp \
gui/difficulty.cpp gui/difficulty.hpp \
gui/char_sel.cpp gui/char_sel.hpp \
gui/main_menu.cpp gui/main_menu.hpp \
gui/help_menu.cpp gui/help_menu.hpp \
gui/help_page_one.cpp gui/help_page_one.hpp \
gui/help_page_two.cpp gui/help_page_two.hpp \
gui/credits_menu.cpp gui/credits_menu.hpp \
gui/grand_prix_select.cpp gui/grand_prix_select.hpp \
gui/font.hpp gui/font.cpp \

View File

@ -121,10 +121,6 @@ void
BaseGUI::update(float dt)
{
widget_manager->update(dt);
#if 0
widgetSet -> timer(m_menu_id, dt) ;
widgetSet -> paint(m_menu_id) ;
#endif
} // update
//-----------------------------------------------------------------------------

View File

@ -78,9 +78,6 @@ CharSel::CharSel(int whichPlayer)
widget_manager->break_line();
//FIXME: this supports only a static number of karts
// unsigned int lastKartId = user_config->m_player[m_player_index].getLastKartId();
// bool skipActivatingLast = false;
for (unsigned int i = 0; i < kart_properties_manager->getNumberOfKarts(); i++)
{
const KartProperties* kp= kart_properties_manager->getKartById(i);
@ -141,7 +138,7 @@ void CharSel::switchCharacter(int n)
if (m_current_kart != n && kp != NULL)
{
widget_manager->set_wgt_text( WTOK_NAME, kp->getName().c_str());
//FIXME: maybe I should rename WGT_SCROLL_* to WGT_POS_*
//FIXME: maybe this should be renamed from WGT_SCROLL_* to WGT_POS_*
widget_manager->set_wgt_x_scroll_pos( WTOK_NAME, WGT_SCROLL_CENTER );
m_current_kart = n;

View File

@ -72,43 +72,14 @@ ConfigControls::ConfigControls()
widget_manager->set_wgt_text_size( WTOK_QUIT, WGT_FNT_SML );
widget_manager->layout( WGT_AREA_ALL );
/*
* m_menu_id = widgetSet -> vstack(0);
widgetSet -> label(m_menu_id, _("Edit controls for which player?"), GUI_LRG);
const int VA = widgetSet -> varray(m_menu_id);
static char playerN[4][MAX_MESSAGE_LENGTH];
for(int i=1; i<=4; i++)
{
snprintf(playerN[i-1], MAX_MESSAGE_LENGTH,
_("Player %d"), i);
if (i == 1)
widgetSet -> start(VA, playerN[i-1], GUI_MED, i);
else
widgetSet -> state(VA, playerN[i-1], GUI_MED, i);
}
widgetSet -> space(VA);
widgetSet -> state(VA, _("Press <ESC> to go back"), GUI_SML, 5);
widgetSet -> layout(m_menu_id, 0, 0);*/
}
//-----------------------------------------------------------------------------
ConfigControls::~ConfigControls()
{
widget_manager->reset();
// widgetSet -> delete_widget(m_menu_id) ;
}
//-----------------------------------------------------------------------------
/*void ConfigControls::update(float dt)
{
widgetSet -> timer(m_menu_id, dt) ;
widgetSet -> paint(m_menu_id) ;
}
*/
//-----------------------------------------------------------------------------
void ConfigControls::select()
{

View File

@ -28,7 +28,6 @@ public:
ConfigControls();
~ConfigControls();
// void update(float dt);
void select();
};

View File

@ -124,17 +124,9 @@ ConfigDisplay::ConfigDisplay()
//-----------------------------------------------------------------------------
ConfigDisplay::~ConfigDisplay()
{
// widgetSet -> delete_widget(m_menu_id) ;
widget_manager->reset();
}
//-----------------------------------------------------------------------------
/*void ConfigDisplay::update(float dt)
{
widgetSet -> timer(m_menu_id, dt) ;
widgetSet -> paint(m_menu_id) ;
}*/
//-----------------------------------------------------------------------------
void ConfigDisplay::select()
{
@ -142,12 +134,6 @@ void ConfigDisplay::select()
{
case WTOK_FULLSCREEN:
drv_toggleFullscreen();
// widgetSet -> delete_widget(m_menu_id) ;
// Since changing the video mode in drv_toggleFullscreen deletes all
// display lists, textures etc., we have to load the menu again.
// drv_toggleFullscreen takes care of general material, general
// widgetSet, etc.
// CreateMenu();
if(user_config->m_fullscreen)
{
widget_manager->set_wgt_text( WTOK_FULLSCREEN, _("Window mode"));

View File

@ -31,7 +31,6 @@ public:
ConfigDisplay();
~ConfigDisplay();
// void update(float dt);
void select();
private:

View File

@ -114,7 +114,6 @@ void ConfigSound::select()
user_config->setSFX(UserConfig::UC_ENABLE);
widget_manager->set_wgt_text(WTOK_SFX, _("Turn off sound effects"));
}
// widgetSet->toggle(m_sfx_menu_id);
break;
case WTOK_QUIT:
menu_manager->popMenu();

View File

@ -21,8 +21,6 @@
#define HEADER_CREDITSMENU_H
#include "base_gui.hpp"
//#include "player.hpp"
class CreditsMenu: public BaseGUI
{

View File

@ -62,19 +62,6 @@ public:
doShadow);
}
#if 0
// Convenience functions to reduce the number of parameters
// --------------------------------------------------------
void Print( const std::string &text, int size, int x, int y,
int red=255, int green=255, int blue=255,
int left=-1, int right=-1, int top=-1, int bottom=-1)
{
Print(text, size, x, y,
red, green, blue, 1.0f, 1.0f,
left, right, top, bottom);
}
#endif
void PrintShadow(const char *text, int size,
int x, int y,
int red=255, int green=255, int blue=255,
@ -85,16 +72,6 @@ public:
red, green, blue, scale_x, scale_y,
left, right, top, bottom, true);
}
#if 0
void PrintShadow(const char *text, int size, int x, int y,
int red=255, int green=255, int blue=255,
int left=-1, int right=-1, int top=-1, int bottom=-1)
{
Print(text, size, x, y,
red, green, blue, 1.0f, 1.0f,
left, right, top, bottom, true);
}
#endif
};
int init_fonts();

View File

@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "help_menu.hpp"
#include "help_page_one.hpp"
#include "widget_manager.hpp"
#include "race_manager.hpp"
#include "menu_manager.hpp"
@ -29,7 +29,6 @@
enum WidgetTokens
{
/* For the first screen */
WTOK_MSG1,
WTOK_MSG2,
WTOK_MSG3,
@ -44,22 +43,11 @@ enum WidgetTokens
WTOK_FIRST_KEYBINDING,
WTOK_LAST_KEYBINDING = WTOK_FIRST_KEYBINDING + KA_LAST,
/* For the second screen */
WTOK_MSG6,
WTOK_ITEMIMG1, WTOK_ITEMTXT1,
WTOK_ITEMIMG2, WTOK_ITEMTXT2,
WTOK_ITEMIMG3, WTOK_ITEMTXT3,
WTOK_ITEMIMG4, WTOK_ITEMTXT4,
WTOK_ITEMIMG5, WTOK_ITEMTXT5,
WTOK_ITEMIMG6, WTOK_ITEMTXT6,
WTOK_FIRST_PAGE,
WTOK_SECOND_PAGE,
WTOK_QUIT
};
HelpMenu::HelpMenu()
HelpPageOne::HelpPageOne()
{
//The ssgContext constructor calls makeCurrent(), it has to be restored
ssgContext* oldContext = ssgGetCurrentContext();
@ -73,83 +61,6 @@ HelpMenu::HelpMenu()
m_clock = 0;
switch_to_first_screen();
} // HelpMenu
//-----------------------------------------------------------------------------
HelpMenu::~HelpMenu()
{
widget_manager->reset();
if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL
&& m_banana != NULL )
{
ssgDeRefDelete(m_box);
ssgDeRefDelete(m_silver_coin);
ssgDeRefDelete(m_gold_coin);
ssgDeRefDelete(m_banana);
}
delete m_context;
} // ~HelpMenu
//-----------------------------------------------------------------------------
void HelpMenu::update(float dt)
{
m_clock += dt * 40.0f;
BaseGUI::update(dt);
if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL
&& m_banana != NULL )
{
ssgContext* oldContext = ssgGetCurrentContext();
m_context -> makeCurrent();
glClear(GL_DEPTH_BUFFER_BIT);
#if 0
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glViewport ( 0, 0, viewport[2], viewport[3]);
m_context -> setFOV ( 45.0f, 45.0f * viewport[2]/viewport[3] ) ;
m_context -> setNearFar ( 0.05f, 1000.0f ) ;
#endif
sgCoord cam_pos;
sgSetCoord(&cam_pos, 0, 0, 0, 0, 0, 0);
m_context -> setCamera ( &cam_pos ) ;
glEnable (GL_DEPTH_TEST);
sgCoord trans;
sgSetCoord(&trans, -4, 10, 1.85f, m_clock, 0, 0);
m_box->setTransform (&trans);
sgSetCoord(&trans, -2, 8, 1.5f, m_clock, 0, 0);
m_silver_coin->setTransform (&trans);
sgSetCoord(&trans, -1, 8, 1.5f, m_clock, 0, 0);
m_gold_coin->setTransform (&trans);
sgSetCoord(&trans, 5, 15, 3, m_clock, 0, 0);
m_banana->setTransform (&trans);
//glShadeModel(GL_SMOOTH);
ssgCullAndDraw ( m_box ) ;
ssgCullAndDraw ( m_silver_coin ) ;
ssgCullAndDraw ( m_gold_coin ) ;
ssgCullAndDraw ( m_banana ) ;
glViewport ( 0, 0, user_config->m_width, user_config->m_height ) ;
glDisable (GL_DEPTH_TEST);
oldContext->makeCurrent();
}
}
//-----------------------------------------------------------------------------
void HelpMenu::switch_to_first_screen()
{
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML;
@ -247,140 +158,86 @@ get stuck or fall too far, use the rescue button to get back on track."));
widget_manager->activate_wgt(WTOK_QUIT);
widget_manager->layout( WGT_AREA_TOP );
}
} // HelpPageOne
//-----------------------------------------------------------------------------
void HelpMenu::switch_to_second_screen()
HelpPageOne::~HelpPageOne()
{
/* Delete 3D models from the first screen */
ssgDeRefDelete(m_box); m_box = 0;
ssgDeRefDelete(m_silver_coin); m_silver_coin = 0;
ssgDeRefDelete(m_gold_coin); m_gold_coin = 0;
ssgDeRefDelete(m_banana); m_banana = 0;
widget_manager->reset();
/* Add the widgets */
const bool SHOW_RECT = true;
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML;
widget_manager->set_initial_rect_state( SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK );
widget_manager->set_initial_text_state( false, "", TEXT_SIZE );
if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL
&& m_banana != NULL )
{
ssgDeRefDelete(m_box);
ssgDeRefDelete(m_silver_coin);
ssgDeRefDelete(m_gold_coin);
ssgDeRefDelete(m_banana);
}
widget_manager->add_wgt(WTOK_MSG6, 100, 8);
widget_manager->set_wgt_text(WTOK_MSG6,
_("To help you win, there are certain collectables you can grab:"));
widget_manager->show_wgt_text( WTOK_MSG6 );
widget_manager->break_line();
delete m_context;
/* Collectable images and descriptions */
widget_manager->add_wgt(WTOK_ITEMIMG1, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG1,
collectable_manager->getIcon(COLLECT_MISSILE)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG1, WGT_WHITE);
widget_manager->show_wgt_texture(WTOK_ITEMIMG1);
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG1, WGT_AREA_NONE);
} // ~HelpPageOne
widget_manager->add_wgt(WTOK_ITEMTXT1, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT1,
_("Missile - fast stopper in a straight line"));
widget_manager->show_wgt_text( WTOK_ITEMTXT1 );
widget_manager->break_line();
//-----------------------------------------------------------------------------
void HelpPageOne::update(float dt)
{
m_clock += dt * 40.0f;
BaseGUI::update(dt);
widget_manager->add_wgt(WTOK_ITEMIMG2, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG2,
collectable_manager->getIcon(COLLECT_HOMING)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG2, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG2 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG2, WGT_AREA_NONE);
if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL
&& m_banana != NULL )
{
ssgContext* oldContext = ssgGetCurrentContext();
m_context -> makeCurrent();
widget_manager->add_wgt(WTOK_ITEMTXT2, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT2,
_("Homing missile - follows rivals, but is slower than the missile"));
widget_manager->show_wgt_text( WTOK_ITEMTXT2 );
widget_manager->break_line();
glClear(GL_DEPTH_BUFFER_BIT);
widget_manager->add_wgt(WTOK_ITEMIMG3, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG3,
collectable_manager->getIcon(COLLECT_SPARK)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG3, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG3 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG3, WGT_AREA_NONE);
#if 0
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
widget_manager->add_wgt(WTOK_ITEMTXT3, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT3,
_("Fuzzy blob/Spark - very slow, but bounces from walls"));
widget_manager->show_wgt_text( WTOK_ITEMTXT3 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG4, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG4,
collectable_manager->getIcon(COLLECT_ZIPPER)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG4, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG4 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG4, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT4, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT4,
_("Zipper - speed boost"));
widget_manager->show_wgt_text( WTOK_ITEMTXT4 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG5, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG5,
collectable_manager->getIcon(COLLECT_PARACHUTE)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG5, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG5 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG5, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT5, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT5,
_("Parachute - slows down all karts in a better position!"));
widget_manager->show_wgt_text( WTOK_ITEMTXT5 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG6, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG6,
collectable_manager->getIcon(COLLECT_ANVIL)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG6, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG6 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG6, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT6, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT6,
_("Anvil - slows down greatly the kart in the first position"));
widget_manager->show_wgt_text( WTOK_ITEMTXT6 );
widget_manager->break_line();
#ifdef USE_MAGNETS
//Magnets are currently disabled.
glViewport ( 0, 0, viewport[2], viewport[3]);
m_context -> setFOV ( 45.0f, 45.0f * viewport[2]/viewport[3] ) ;
m_context -> setNearFar ( 0.05f, 1000.0f ) ;
#endif
/*Buttons at the bottom*/
widget_manager->add_wgt(WTOK_FIRST_PAGE, 25, 7);
widget_manager->set_wgt_text(WTOK_FIRST_PAGE, _("Previous screen"));
widget_manager->show_wgt_text( WTOK_FIRST_PAGE );
widget_manager->activate_wgt(WTOK_FIRST_PAGE);
widget_manager->break_line();
sgCoord cam_pos;
sgSetCoord(&cam_pos, 0, 0, 0, 0, 0, 0);
m_context -> setCamera ( &cam_pos ) ;
widget_manager->add_wgt(WTOK_QUIT, 40, 7);
widget_manager->set_wgt_text(WTOK_QUIT, _("Go back to the main menu"));
widget_manager->show_wgt_text( WTOK_QUIT );
widget_manager->activate_wgt(WTOK_QUIT);
glEnable (GL_DEPTH_TEST);
sgCoord trans;
sgSetCoord(&trans, -4, 10, 1.85f, m_clock, 0, 0);
m_box->setTransform (&trans);
widget_manager->layout( WGT_AREA_TOP );
sgSetCoord(&trans, -2, 8, 1.5f, m_clock, 0, 0);
m_silver_coin->setTransform (&trans);
sgSetCoord(&trans, -1, 8, 1.5f, m_clock, 0, 0);
m_gold_coin->setTransform (&trans);
sgSetCoord(&trans, 5, 15, 3, m_clock, 0, 0);
m_banana->setTransform (&trans);
//glShadeModel(GL_SMOOTH);
ssgCullAndDraw ( m_box ) ;
ssgCullAndDraw ( m_silver_coin ) ;
ssgCullAndDraw ( m_gold_coin ) ;
ssgCullAndDraw ( m_banana ) ;
glViewport ( 0, 0, user_config->m_width, user_config->m_height ) ;
glDisable (GL_DEPTH_TEST);
oldContext->makeCurrent();
}
}
//-----------------------------------------------------------------------------
void HelpMenu::select()
void HelpPageOne::select()
{
switch ( widget_manager->get_selected_wgt() )
{
case WTOK_FIRST_PAGE:
widget_manager->reset();
switch_to_first_screen();
break;
case WTOK_SECOND_PAGE:
widget_manager->reset();
switch_to_second_screen();
menu_manager->pushMenu(MENUID_HELP2);
break;
case WTOK_QUIT:

View File

@ -17,17 +17,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_HELPMENU_H
#define HEADER_HELPMENU_H
#ifndef HEADER_HELPPAGEONE_H
#define HEADER_HELPPAGEONE_H
#include <string>
#include "base_gui.hpp"
//#include "player.hpp"
class ssgTransform;
class ssgContext;
class HelpMenu: public BaseGUI
class HelpPageOne: public BaseGUI
{
private:
ssgContext* m_context;
@ -38,11 +37,9 @@ private:
float m_clock;
public:
HelpMenu();
~HelpMenu();
HelpPageOne();
~HelpPageOne();
void select ();
void switch_to_first_screen();
void switch_to_second_screen();
void update(float dt);
};

179
src/gui/help_page_two.cpp Normal file
View File

@ -0,0 +1,179 @@
// $Id: help_menu.cpp 812 2006-10-07 11:43:57Z hiker $
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2006 Joerg Henrichs
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "help_page_two.hpp"
#include "widget_manager.hpp"
#include "race_manager.hpp"
#include "menu_manager.hpp"
#include "user_config.hpp"
#include "player.hpp"
#include "collectable_manager.hpp"
#include "material.hpp"
#include "translation.hpp"
enum WidgetTokens
{
WTOK_MSG6,
WTOK_ITEMIMG1, WTOK_ITEMTXT1,
WTOK_ITEMIMG2, WTOK_ITEMTXT2,
WTOK_ITEMIMG3, WTOK_ITEMTXT3,
WTOK_ITEMIMG4, WTOK_ITEMTXT4,
WTOK_ITEMIMG5, WTOK_ITEMTXT5,
WTOK_ITEMIMG6, WTOK_ITEMTXT6,
WTOK_FIRST_PAGE,
WTOK_QUIT
};
HelpPageTwo::HelpPageTwo()
{
/* Add the widgets */
const bool SHOW_RECT = true;
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML;
widget_manager->set_initial_rect_state( SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK );
widget_manager->set_initial_text_state( false, "", TEXT_SIZE );
widget_manager->add_wgt(WTOK_MSG6, 100, 8);
widget_manager->set_wgt_text(WTOK_MSG6,
_("To help you win, there are certain collectables you can grab:"));
widget_manager->show_wgt_text( WTOK_MSG6 );
widget_manager->break_line();
/* Collectable images and descriptions */
widget_manager->add_wgt(WTOK_ITEMIMG1, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG1,
collectable_manager->getIcon(COLLECT_MISSILE)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG1, WGT_WHITE);
widget_manager->show_wgt_texture(WTOK_ITEMIMG1);
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG1, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT1, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT1,
_("Missile - fast stopper in a straight line"));
widget_manager->show_wgt_text( WTOK_ITEMTXT1 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG2, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG2,
collectable_manager->getIcon(COLLECT_HOMING)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG2, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG2 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG2, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT2, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT2,
_("Homing missile - follows rivals, but is slower than the missile"));
widget_manager->show_wgt_text( WTOK_ITEMTXT2 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG3, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG3,
collectable_manager->getIcon(COLLECT_SPARK)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG3, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG3 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG3, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT3, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT3,
_("Fuzzy blob/Spark - very slow, but bounces from walls"));
widget_manager->show_wgt_text( WTOK_ITEMTXT3 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG4, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG4,
collectable_manager->getIcon(COLLECT_ZIPPER)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG4, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG4 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG4, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT4, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT4,
_("Zipper - speed boost"));
widget_manager->show_wgt_text( WTOK_ITEMTXT4 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG5, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG5,
collectable_manager->getIcon(COLLECT_PARACHUTE)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG5, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG5 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG5, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT5, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT5,
_("Parachute - slows down all karts in a better position!"));
widget_manager->show_wgt_text( WTOK_ITEMTXT5 );
widget_manager->break_line();
widget_manager->add_wgt(WTOK_ITEMIMG6, 10, 13);
widget_manager->set_wgt_texture(WTOK_ITEMIMG6,
collectable_manager->getIcon(COLLECT_ANVIL)->getState()->getTextureHandle());
widget_manager->set_wgt_color(WTOK_ITEMIMG6, WGT_WHITE);
widget_manager->show_wgt_texture( WTOK_ITEMIMG6 );
widget_manager->set_wgt_round_corners(WTOK_ITEMIMG6, WGT_AREA_NONE);
widget_manager->add_wgt(WTOK_ITEMTXT6, 90, 13);
widget_manager->set_wgt_text( WTOK_ITEMTXT6,
_("Anvil - slows down greatly the kart in the first position"));
widget_manager->show_wgt_text( WTOK_ITEMTXT6 );
widget_manager->break_line();
#ifdef USE_MAGNETS
//Magnets are currently disabled.
#endif
/*Buttons at the bottom*/
widget_manager->add_wgt(WTOK_FIRST_PAGE, 25, 7);
widget_manager->set_wgt_text(WTOK_FIRST_PAGE, _("Previous screen"));
widget_manager->show_wgt_text( WTOK_FIRST_PAGE );
widget_manager->activate_wgt(WTOK_FIRST_PAGE);
widget_manager->break_line();
widget_manager->add_wgt(WTOK_QUIT, 40, 7);
widget_manager->set_wgt_text(WTOK_QUIT, _("Go back to the main menu"));
widget_manager->show_wgt_text( WTOK_QUIT );
widget_manager->activate_wgt(WTOK_QUIT);
widget_manager->layout( WGT_AREA_TOP );
} // HelpMenu
//-----------------------------------------------------------------------------
HelpPageTwo::~HelpPageTwo()
{
widget_manager->reset();
} // ~HelpMenu
//-----------------------------------------------------------------------------
void HelpPageTwo::select()
{
switch ( widget_manager->get_selected_wgt() )
{
case WTOK_FIRST_PAGE:
menu_manager->pushMenu(MENUID_HELP1);
break;
case WTOK_QUIT:
menu_manager->popMenu();
break;
}
} // select
/* EOF */

34
src/gui/help_page_two.hpp Normal file
View File

@ -0,0 +1,34 @@
// $Id: help_menu.hpp 694 2006-08-29 07:42:36Z hiker $
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2006 Joerg Henrichs
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_HELPPAGETWO_H
#define HEADER_HELPPAGETWO_H
#include <string>
#include "base_gui.hpp"
class HelpPageTwo: public BaseGUI
{
public:
HelpPageTwo();
~HelpPageTwo();
void select ();
};
#endif

View File

@ -82,36 +82,6 @@ MainMenu::~MainMenu()
//-----------------------------------------------------------------------------
void MainMenu::select()
{
#if 0
switch ( widgetSet -> get_token (widgetSet -> click()) )
{
case WTOK_SINGLE:
race_manager->setNumPlayers(1);
menu_manager->pushMenu(MENUID_GAMEMODE);
break;
case WTOK_MULTI:
menu_manager->pushMenu(MENUID_NUMPLAYERS);
break;
case WTOK_REPLAY:
//TODO
break;
case WTOK_OPTIONS:
menu_manager->pushMenu(MENUID_OPTIONS);
break;
case WTOK_QUIT:
menu_manager->pushMenu(MENUID_EXITGAME);
break;
case WTOK_HELP:
menu_manager->pushMenu(MENUID_HELP);
break;
case WTOK_CREDITS:
menu_manager->pushMenu(MENUID_CREDITS);
break;
}
#endif
switch ( widget_manager->get_selected_wgt() )
{
case WTOK_SINGLE:
@ -130,7 +100,7 @@ void MainMenu::select()
menu_manager->pushMenu(MENUID_EXITGAME);
break;
case WTOK_HELP:
menu_manager->pushMenu(MENUID_HELP);
menu_manager->pushMenu(MENUID_HELP1);
break;
case WTOK_CREDITS:
menu_manager->pushMenu(MENUID_CREDITS);
@ -144,9 +114,7 @@ void MainMenu::handle(GameAction ga, int value)
switch ( ga )
{
case GA_LEAVE:
if(!value)
break;
if(!value) break;
menu_manager->pushMenu(MENUID_EXITGAME);
break;

View File

@ -42,7 +42,8 @@
#include "race_manager.hpp"
#include "game_manager.hpp"
#include "race_menu.hpp"
#include "help_menu.hpp"
#include "help_page_one.hpp"
#include "help_page_two.hpp"
#include "credits_menu.hpp"
#include "grand_prix_select.hpp"
#include "sound_manager.hpp"
@ -202,8 +203,11 @@ void MenuManager::update()
case MENUID_CONFIG_SOUND:
m_current_menu= new ConfigSound();
break;
case MENUID_HELP:
m_current_menu = new HelpMenu();
case MENUID_HELP1:
m_current_menu = new HelpPageOne();
break;
case MENUID_HELP2:
m_current_menu = new HelpPageTwo();
break;
case MENUID_CREDITS:
m_current_menu = new CreditsMenu();

View File

@ -36,9 +36,6 @@ enum MenuManagerIDs
MENUID_GAMEMODE,
MENUID_RACERESULT,
MENUID_GRANDPRIXEND,
#if 0 // no needed yet
MENUID_NEXTRACE,
#endif
MENUID_RACEMENU,
MENUID_TRACKSEL,
MENUID_NUMLAPS,
@ -57,7 +54,8 @@ enum MenuManagerIDs
MENUID_CONFIG_P4,
// help and credit menu
MENUID_HELP,
MENUID_HELP1,
MENUID_HELP2,
MENUID_CREDITS,
// race gui
MENUID_RACE,

View File

@ -87,21 +87,6 @@ NumLaps::NumLaps() : laps(3)
widget_manager->set_wgt_text(WTOK_QUIT, _("Press <ESC> to go back"));
widget_manager->activate_wgt(WTOK_QUIT);
/* m_menu_id = widgetSet -> varray(0);
widgetSet -> label(m_menu_id, _("Choose number of laps"), GUI_LRG, GUI_ALL, 0, 0 );
widgetSet -> space(m_menu_id);
lap_label_id = widgetSet -> label(m_menu_id, _("Laps: 3"));
widgetSet -> space(m_menu_id);
widgetSet -> state(m_menu_id, _("Less"), GUI_MED, 10);
widgetSet -> state(m_menu_id, _("More"), GUI_MED, 20);
widgetSet -> space(m_menu_id);
widgetSet -> start(m_menu_id, _("Start Race"), GUI_SML, 30);
widgetSet -> state(m_menu_id, _("Press <ESC> to go back"), GUI_SML, -1);
widgetSet -> space(m_menu_id);
widgetSet -> layout(m_menu_id, 0, 0);*/
widget_manager->layout(WGT_AREA_ALL);
}
@ -115,9 +100,6 @@ NumLaps::~NumLaps()
void NumLaps::select()
{
const int WGT = widget_manager->get_selected_wgt();
/* const int id = widgetSet->click();
const int n = widgetSet->get_token(id);*/
//TEMP
switch (WGT)
{
case WTOK_LESS:

View File

@ -32,27 +32,6 @@ enum WidgetTokens {
Options::Options()
{
/* m_menu_id = widgetSet -> varray(0);
widgetSet -> space(m_menu_id);
widgetSet -> space(m_menu_id);
widgetSet -> label(m_menu_id, _("Options"), GUI_LRG, GUI_ALL, 0, 0);
widgetSet -> start(m_menu_id, _("Player Config"), GUI_MED, WTOK_CONTROLS);
#ifndef WIN32
// Don't display the fullscreen menu when called from within the race.
// (Windows only)
// The fullscreen mode will reload all textures, reload the models,
// ... basically creating a big mess!! (and all of this only thanks
// to windows, who discards all textures, ...)
widgetSet -> state(m_menu_id, _("Display"), GUI_MED, WTOK_DISPLAY);
#endif
widgetSet -> state(m_menu_id, _("Sound"), GUI_MED, WTOK_SOUND);
widgetSet -> space(m_menu_id);
widgetSet -> state(m_menu_id, _("Press <ESC> to go back"), GUI_SML, WTOK_BACK);
widgetSet -> layout(m_menu_id, 0, 0);*/
widget_manager->add_wgt(WTOK_TITLE, 35, 7);
widget_manager->show_wgt_rect( WTOK_TITLE );
widget_manager->set_wgt_text( WTOK_TITLE, _("Options") );

View File

@ -177,33 +177,6 @@ void RaceGUI::drawFPS ()
font_race->PrintShadow(m_fps_string,48, 0, user_config->m_height-50);
} // drawFPS
//-----------------------------------------------------------------------------
#if 0
//This is not being used..
void RaceGUI::drawTexture(const GLuint texture, int w, int h,
int red, int green, int blue, int x, int y)
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glColor3ub ( red, green, blue ) ;
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(x, (float)h+y);
glTexCoord2f(1, 0);
glVertex2f((float)w+x, (float)h+y);
glTexCoord2f(1, 1);
glVertex2f((float)w+x, y);
glTexCoord2f(0, 1);
glVertex2f(x, y);
glEnd();
glDisable(GL_TEXTURE_2D);
} // drawTexture
#endif
//-----------------------------------------------------------------------------
void RaceGUI::drawTimer ()
{
@ -248,10 +221,6 @@ void RaceGUI::drawMap ()
world -> m_track->glVtx ( c->xyz, (float)xLeft-2, (float)yTop+3);
world -> m_track->glVtx ( c->xyz, (float)xLeft-2, (float)yTop-2);
world -> m_track->glVtx ( c->xyz, (float)xLeft+3, (float)yTop-2);
/* world -> m_track->glVtx ( c->xyz, xLeft , yTop-4);
world -> m_track->glVtx ( c->xyz, xLeft+4, yTop );
world -> m_track->glVtx ( c->xyz, xLeft , yTop+4);
world -> m_track->glVtx ( c->xyz, xLeft-4, yTop ); */
}
else
{

View File

@ -120,7 +120,7 @@ void RaceMenu::select()
break;
case WTOK_HELP:
menu_manager->pushMenu(MENUID_HELP);
menu_manager->pushMenu(MENUID_HELP1);
break;
case WTOK_QUIT:

View File

@ -179,7 +179,6 @@ RaceResultsGUI::RaceResultsGUI()
RaceResultsGUI::~RaceResultsGUI()
{
widget_manager->reset();
//widgetSet -> delete_widget(m_menu_id) ;
delete[] m_score;
delete[] m_highscores;
} // ~RaceResultsGUI

View File

@ -79,22 +79,6 @@ TrackSel::TrackSel()
}
//FIXME: Right now, the image and the author's name is not controlled by the widget manager.
#if 0
widget_manager->set_initial_rect_state(false, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->set_initial_text_state(false, "", WGT_FNT_MED );
widget_manager->set_initial_activation_state(false);
widget_manager->add_wgt( WidgetManager::WGT_NONE, 100, 5);
widget_manager->break_line();
widget_manager->set_initial_rect_state(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_WHITE);
widget_manager->add_wgt( WTOK_IMG0, 40, 30);
widget_manager->add_wgt( WidgetManager::WGT_NONE, 5, 30);
widget_manager->add_wgt( WTOK_IMG0, 40, 30);
widget_manager->break_line();
widget_manager->add_wgt( WTOK_AUTHOR, 100, 10);
widget_manager->show_wgt_text( WTOK_AUTHOR );
#endif
widget_manager->layout(WGT_AREA_TOP);
}
@ -112,7 +96,6 @@ void TrackSel::update(float dt)
glClear(GL_DEPTH_BUFFER_BIT);
// draw a track preview of the currently highlighted track menu entry
// const int CLICKED_TOKEN = widgetSet->get_token(widgetSet->click());
const int CLICKED_TOKEN = widget_manager->get_selected_wgt();
const Track* TRACK = track_manager->getTrack(CLICKED_TOKEN - WTOK_TRACK0);
@ -186,7 +169,6 @@ void TrackSel::update(float dt)
void TrackSel::select()
{
const int CLICKED_TOKEN = widget_manager->get_selected_wgt();
//const int CLICKED_TOKEN = widgetSet->get_token(widgetSet->click());
const Track* TRACK = track_manager->getTrack(CLICKED_TOKEN - WTOK_TRACK0);
race_manager->setTrack(TRACK->getIdent());

View File

@ -24,8 +24,6 @@
class TrackSel: public BaseGUI
{
/*protected:
int m_rect;*/
public:
TrackSel();
~TrackSel();