Back to index

supertuxkart  0.5+dfsg1
help_page_two.cpp
Go to the documentation of this file.
00001 //  $Id: help_menu.cpp 812 2006-10-07 11:43:57Z hiker $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2006 Joerg Henrichs
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #include "help_page_two.hpp"
00021 #include "widget_manager.hpp"
00022 #include "race_manager.hpp"
00023 #include "menu_manager.hpp"
00024 #include "user_config.hpp"
00025 #include "player.hpp"
00026 #include "collectable_manager.hpp"
00027 #include "material.hpp"
00028 #include "translation.hpp"
00029 
00030 enum WidgetTokens
00031 {
00032     WTOK_MSG,
00033 
00034     WTOK_IMG1, WTOK_TXT1,
00035     WTOK_IMG2, WTOK_TXT2,
00036     WTOK_IMG3, WTOK_TXT3,
00037     WTOK_IMG4, WTOK_TXT4,
00038     WTOK_IMG5, WTOK_TXT5,
00039     WTOK_IMG6, WTOK_TXT6,
00040 
00041     WTOK_FIRST_PAGE,
00042     WTOK_THIRD_PAGE,
00043     WTOK_QUIT
00044 
00045 };
00046 
00047 HelpPageTwo::HelpPageTwo()
00048 {
00049     //FIXME: instead of using setInitialTextState, the gui & widget manager macros should improve it's design
00050     widget_manager->setInitialTextState
00051     (
00052         false,
00053         "",
00054         WGT_FNT_SML,
00055         WGT_FONT_GUI,
00056         WGT_WHITE,
00057         false
00058     );
00059 
00060     widget_manager->addTextWgt( WTOK_MSG, 100, 7,
00061         _("To help you win, there are certain collectables you can grab:"));
00062     widget_manager->breakLine();
00063 
00064     widget_manager->addImgWgt( WTOK_IMG1, 10, 12,
00065         collectable_manager->getIcon(COLLECT_MISSILE)->getState()->getTextureHandle());
00066 
00067     widget_manager->addTextWgt( WTOK_TXT1, 90, 12,
00068         _("Missile - fast stopper in a straight line"));
00069     widget_manager->setWgtRoundCorners( WTOK_TXT1, WGT_AREA_RGT );
00070     widget_manager->breakLine();
00071 
00072     widget_manager->addImgWgt(WTOK_IMG2, 10, 12,
00073         collectable_manager->getIcon(COLLECT_HOMING)->getState()->getTextureHandle());
00074 
00075     widget_manager->addTextWgt(WTOK_TXT2, 90, 12,
00076         _("Homing missile - follows rivals, but is slower than the missile"));
00077     widget_manager->setWgtRoundCorners( WTOK_TXT2, WGT_AREA_RGT );
00078     widget_manager->breakLine();
00079 
00080     widget_manager->addImgWgt(WTOK_IMG3, 10, 12,
00081         collectable_manager->getIcon(COLLECT_SPARK)->getState()->getTextureHandle());
00082 
00083     widget_manager->addTextWgt(WTOK_TXT3, 90, 12,
00084         _("Fuzzy blob/Spark - very slow, but bounces from walls"));
00085     widget_manager->setWgtRoundCorners( WTOK_TXT3, WGT_AREA_RGT );
00086     widget_manager->breakLine();
00087 
00088     widget_manager->addImgWgt(WTOK_IMG4, 10, 12,
00089         collectable_manager->getIcon(COLLECT_ZIPPER)->getState()->getTextureHandle());
00090 
00091     widget_manager->addTextWgt(WTOK_TXT4, 90, 12,
00092         _("Zipper - speed boost"));
00093     widget_manager->setWgtRoundCorners(WTOK_TXT4, WGT_AREA_RGT);
00094     widget_manager->breakLine();
00095 
00096     widget_manager->addImgWgt(WTOK_IMG5, 10, 12,
00097         collectable_manager->getIcon(COLLECT_PARACHUTE)->getState()->getTextureHandle());
00098 
00099     widget_manager->addTextWgt(WTOK_TXT5, 90, 12,
00100         _("Parachute - slows down all karts in a better position!"));
00101     widget_manager->setWgtRoundCorners(WTOK_TXT5, WGT_AREA_RGT);
00102     widget_manager->breakLine();
00103 
00104     widget_manager->addImgWgt(WTOK_IMG6, 10, 12,
00105         collectable_manager->getIcon(COLLECT_ANVIL)->getState()->getTextureHandle());
00106 
00107     widget_manager->addTextWgt(WTOK_TXT6, 90, 12,
00108         _("Anvil - slows down greatly the kart in the first position"));
00109     widget_manager->setWgtRoundCorners(WTOK_TXT6, WGT_AREA_RGT);
00110     widget_manager->breakLine();
00111 
00112     /*Buttons at the bottom*/
00113     widget_manager->addTextButtonWgt(WTOK_FIRST_PAGE, 40, 7,
00114         _("Previous screen"));
00115     widget_manager->breakLine();
00116 
00117     widget_manager->addTextButtonWgt(WTOK_THIRD_PAGE, 40, 7,
00118         _("Next help screen"));
00119     widget_manager->breakLine();
00120 
00121     widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7,
00122         _("Back to the menu"));
00123 
00124     widget_manager->layout( WGT_AREA_TOP );
00125 }   // HelpMenu
00126 
00127 //-----------------------------------------------------------------------------
00128 HelpPageTwo::~HelpPageTwo()
00129 {
00130     widget_manager->reset();
00131 }   // ~HelpMenu
00132 
00133 //-----------------------------------------------------------------------------
00134 void HelpPageTwo::select()
00135 {
00136     switch ( widget_manager->getSelectedWgt() )
00137     {
00138         case WTOK_FIRST_PAGE:
00139             menu_manager->popMenu();
00140             menu_manager->pushMenu(MENUID_HELP1);
00141             break;
00142 
00143         case WTOK_THIRD_PAGE:
00144             menu_manager->popMenu();
00145             menu_manager->pushMenu(MENUID_HELP3);
00146             break;
00147 
00148         case WTOK_QUIT:
00149             menu_manager->popMenu();
00150             break;
00151     }
00152 }   // select
00153 
00154 /* EOF */