From 38a4c359b2d14b914398324890def535b0b639bd Mon Sep 17 00:00:00 2001 From: cosmosninja Date: Wed, 12 Dec 2007 21:30:30 +0000 Subject: [PATCH] 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 --- src/Makefile.am | 3 +- src/gui/base_gui.cpp | 4 - src/gui/char_sel.cpp | 5 +- src/gui/config_controls.cpp | 29 -- src/gui/config_controls.hpp | 1 - src/gui/config_display.cpp | 14 - src/gui/config_display.hpp | 1 - src/gui/config_sound.cpp | 1 - src/gui/credits_menu.hpp | 2 - src/gui/font.hpp | 23 -- src/gui/{help_menu.cpp => help_page_one.cpp} | 263 +++++-------------- src/gui/{help_menu.hpp => help_page_one.hpp} | 13 +- src/gui/help_page_two.cpp | 179 +++++++++++++ src/gui/help_page_two.hpp | 34 +++ src/gui/main_menu.cpp | 36 +-- src/gui/menu_manager.cpp | 10 +- src/gui/menu_manager.hpp | 6 +- src/gui/num_laps.cpp | 18 -- src/gui/options.cpp | 21 -- src/gui/race_gui.cpp | 31 --- src/gui/race_menu.cpp | 2 +- src/gui/race_results_gui.cpp | 1 - src/gui/track_sel.cpp | 18 -- src/gui/track_sel.hpp | 2 - 24 files changed, 293 insertions(+), 424 deletions(-) rename src/gui/{help_menu.cpp => help_page_one.cpp} (55%) rename src/gui/{help_menu.hpp => help_page_one.hpp} (85%) create mode 100644 src/gui/help_page_two.cpp create mode 100644 src/gui/help_page_two.hpp diff --git a/src/Makefile.am b/src/Makefile.am index fc7999de9..dbeb8eb8c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/gui/base_gui.cpp b/src/gui/base_gui.cpp index 678837802..b6faa4244 100644 --- a/src/gui/base_gui.cpp +++ b/src/gui/base_gui.cpp @@ -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 //----------------------------------------------------------------------------- diff --git a/src/gui/char_sel.cpp b/src/gui/char_sel.cpp index c7d34d482..425b5ee75 100644 --- a/src/gui/char_sel.cpp +++ b/src/gui/char_sel.cpp @@ -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; diff --git a/src/gui/config_controls.cpp b/src/gui/config_controls.cpp index 9a684c2b8..c4e144109 100644 --- a/src/gui/config_controls.cpp +++ b/src/gui/config_controls.cpp @@ -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 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() { diff --git a/src/gui/config_controls.hpp b/src/gui/config_controls.hpp index e18329c61..c5cec8066 100644 --- a/src/gui/config_controls.hpp +++ b/src/gui/config_controls.hpp @@ -28,7 +28,6 @@ public: ConfigControls(); ~ConfigControls(); -// void update(float dt); void select(); }; diff --git a/src/gui/config_display.cpp b/src/gui/config_display.cpp index d933123ce..5a21e9b8a 100644 --- a/src/gui/config_display.cpp +++ b/src/gui/config_display.cpp @@ -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")); diff --git a/src/gui/config_display.hpp b/src/gui/config_display.hpp index d3c478918..d0b45648d 100644 --- a/src/gui/config_display.hpp +++ b/src/gui/config_display.hpp @@ -31,7 +31,6 @@ public: ConfigDisplay(); ~ConfigDisplay(); -// void update(float dt); void select(); private: diff --git a/src/gui/config_sound.cpp b/src/gui/config_sound.cpp index 30204f7df..bd048b787 100644 --- a/src/gui/config_sound.cpp +++ b/src/gui/config_sound.cpp @@ -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(); diff --git a/src/gui/credits_menu.hpp b/src/gui/credits_menu.hpp index a93cdb948..579f318e9 100644 --- a/src/gui/credits_menu.hpp +++ b/src/gui/credits_menu.hpp @@ -21,8 +21,6 @@ #define HEADER_CREDITSMENU_H #include "base_gui.hpp" -//#include "player.hpp" - class CreditsMenu: public BaseGUI { diff --git a/src/gui/font.hpp b/src/gui/font.hpp index 13c49271e..ed664e3c9 100644 --- a/src/gui/font.hpp +++ b/src/gui/font.hpp @@ -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(); diff --git a/src/gui/help_menu.cpp b/src/gui/help_page_one.cpp similarity index 55% rename from src/gui/help_menu.cpp rename to src/gui/help_page_one.cpp index 2638e8656..c09fee48a 100644 --- a/src/gui/help_menu.cpp +++ b/src/gui/help_page_one.cpp @@ -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: diff --git a/src/gui/help_menu.hpp b/src/gui/help_page_one.hpp similarity index 85% rename from src/gui/help_menu.hpp rename to src/gui/help_page_one.hpp index ae39a873c..871503acd 100644 --- a/src/gui/help_menu.hpp +++ b/src/gui/help_page_one.hpp @@ -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 #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); }; diff --git a/src/gui/help_page_two.cpp b/src/gui/help_page_two.cpp new file mode 100644 index 000000000..8b43eb5ed --- /dev/null +++ b/src/gui/help_page_two.cpp @@ -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 */ diff --git a/src/gui/help_page_two.hpp b/src/gui/help_page_two.hpp new file mode 100644 index 000000000..cb0789054 --- /dev/null +++ b/src/gui/help_page_two.hpp @@ -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 +#include "base_gui.hpp" + +class HelpPageTwo: public BaseGUI +{ +public: + HelpPageTwo(); + ~HelpPageTwo(); + void select (); +}; + +#endif diff --git a/src/gui/main_menu.cpp b/src/gui/main_menu.cpp index 3d7b5e5cc..dd7768003 100644 --- a/src/gui/main_menu.cpp +++ b/src/gui/main_menu.cpp @@ -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; diff --git a/src/gui/menu_manager.cpp b/src/gui/menu_manager.cpp index 3deaa6e3b..e3f0754fb 100644 --- a/src/gui/menu_manager.cpp +++ b/src/gui/menu_manager.cpp @@ -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(); diff --git a/src/gui/menu_manager.hpp b/src/gui/menu_manager.hpp index daa8ee92f..2f8c38f16 100644 --- a/src/gui/menu_manager.hpp +++ b/src/gui/menu_manager.hpp @@ -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, diff --git a/src/gui/num_laps.cpp b/src/gui/num_laps.cpp index 825a31c5d..a32be6442 100644 --- a/src/gui/num_laps.cpp +++ b/src/gui/num_laps.cpp @@ -87,21 +87,6 @@ NumLaps::NumLaps() : laps(3) widget_manager->set_wgt_text(WTOK_QUIT, _("Press 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 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: diff --git a/src/gui/options.cpp b/src/gui/options.cpp index 438cfb7dd..d05e6218b 100644 --- a/src/gui/options.cpp +++ b/src/gui/options.cpp @@ -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 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") ); diff --git a/src/gui/race_gui.cpp b/src/gui/race_gui.cpp index 473c9ce31..99f9206a1 100644 --- a/src/gui/race_gui.cpp +++ b/src/gui/race_gui.cpp @@ -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 { diff --git a/src/gui/race_menu.cpp b/src/gui/race_menu.cpp index 7d34eb37f..44012eb58 100644 --- a/src/gui/race_menu.cpp +++ b/src/gui/race_menu.cpp @@ -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: diff --git a/src/gui/race_results_gui.cpp b/src/gui/race_results_gui.cpp index 952556933..52262ce36 100644 --- a/src/gui/race_results_gui.cpp +++ b/src/gui/race_results_gui.cpp @@ -179,7 +179,6 @@ RaceResultsGUI::RaceResultsGUI() RaceResultsGUI::~RaceResultsGUI() { widget_manager->reset(); - //widgetSet -> delete_widget(m_menu_id) ; delete[] m_score; delete[] m_highscores; } // ~RaceResultsGUI diff --git a/src/gui/track_sel.cpp b/src/gui/track_sel.cpp index e14f26931..da8869aaf 100644 --- a/src/gui/track_sel.cpp +++ b/src/gui/track_sel.cpp @@ -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()); diff --git a/src/gui/track_sel.hpp b/src/gui/track_sel.hpp index c3cc64f8d..fb149256e 100644 --- a/src/gui/track_sel.hpp +++ b/src/gui/track_sel.hpp @@ -24,8 +24,6 @@ class TrackSel: public BaseGUI { -/*protected: - int m_rect;*/ public: TrackSel(); ~TrackSel();