From 578a3732c0815223b9f394e02c7b476c0c48f2ef Mon Sep 17 00:00:00 2001 From: LoadingPleaseWait Date: Fri, 28 Oct 2016 02:47:36 -0500 Subject: [PATCH] Add help page with icons for banana penalties --- data/gui/help1.stkgui | 2 + data/gui/help2.stkgui | 2 + data/gui/help3.stkgui | 2 + data/gui/help4.stkgui | 2 + data/gui/help5.stkgui | 49 ++++++++++++++++ sources.cmake | 4 +- src/states_screens/help_screen_1.cpp | 5 +- src/states_screens/help_screen_2.cpp | 3 + src/states_screens/help_screen_3.cpp | 3 + src/states_screens/help_screen_4.cpp | 3 + src/states_screens/help_screen_5.cpp | 83 ++++++++++++++++++++++++++++ src/states_screens/help_screen_5.hpp | 49 ++++++++++++++++ 12 files changed, 204 insertions(+), 3 deletions(-) create mode 100644 data/gui/help5.stkgui create mode 100644 src/states_screens/help_screen_5.cpp create mode 100644 src/states_screens/help_screen_5.hpp diff --git a/data/gui/help1.stkgui b/data/gui/help1.stkgui index 7db3d345b..7dab679db 100644 --- a/data/gui/help1.stkgui +++ b/data/gui/help1.stkgui @@ -13,6 +13,8 @@ I18N="Tab in help menu" text="Game Modes"/> + diff --git a/data/gui/help2.stkgui b/data/gui/help2.stkgui index 688b876ef..f5708bf1a 100644 --- a/data/gui/help2.stkgui +++ b/data/gui/help2.stkgui @@ -13,6 +13,8 @@ I18N="Tab in help menu" text="Game Modes"/> + diff --git a/data/gui/help3.stkgui b/data/gui/help3.stkgui index 100226da6..168346f0c 100644 --- a/data/gui/help3.stkgui +++ b/data/gui/help3.stkgui @@ -13,6 +13,8 @@ I18N="Tab in help menu" text="Game Modes"/> + diff --git a/data/gui/help4.stkgui b/data/gui/help4.stkgui index 5d090b883..60c919543 100644 --- a/data/gui/help4.stkgui +++ b/data/gui/help4.stkgui @@ -13,6 +13,8 @@ I18N="Tab in help menu" text="Game Modes"/> + diff --git a/data/gui/help5.stkgui b/data/gui/help5.stkgui new file mode 100644 index 000000000..62c4ee0bd --- /dev/null +++ b/data/gui/help5.stkgui @@ -0,0 +1,49 @@ + + +
+
+ + + + + + + + + + + + +
+ + +
diff --git a/sources.cmake b/sources.cmake index f484b15d5..d4f28ae4d 100644 --- a/sources.cmake +++ b/sources.cmake @@ -1,5 +1,5 @@ -# Modify this file to change the last-modified date when you add/remove a file. -# This will then trigger a new cmake run automatically. +# Modify this file to change the last-modified date when you add/remove a file. +# This will then trigger a new cmake run automatically. file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp") file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp") file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*") diff --git a/src/states_screens/help_screen_1.cpp b/src/states_screens/help_screen_1.cpp index dab7e54f2..08accdf54 100644 --- a/src/states_screens/help_screen_1.cpp +++ b/src/states_screens/help_screen_1.cpp @@ -31,6 +31,7 @@ #include "states_screens/help_screen_2.hpp" #include "states_screens/help_screen_3.hpp" #include "states_screens/help_screen_4.hpp" +#include "states_screens/help_screen_5.hpp" #include "states_screens/state_manager.hpp" using namespace GUIEngine; @@ -101,6 +102,8 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i screen = HelpScreen3::getInstance(); else if (selection == "page4") screen = HelpScreen4::getInstance(); + else if (selection == "page5") + screen = HelpScreen5::getInstance(); if(screen) StateManager::get()->replaceTopMostScreen(screen); } @@ -118,7 +121,7 @@ void HelpScreen1::init() RibbonWidget* w = this->getWidget("category"); ButtonWidget* tutorial = getWidget("startTutorial"); - tutorial->setActive(StateManager::get()->getGameState() != + tutorial->setActive(StateManager::get()->getGameState() != GUIEngine::INGAME_MENU); if (w != NULL) w->select( "page1", PLAYER_ID_GAME_MASTER ); diff --git a/src/states_screens/help_screen_2.cpp b/src/states_screens/help_screen_2.cpp index a5707f964..a140ca298 100644 --- a/src/states_screens/help_screen_2.cpp +++ b/src/states_screens/help_screen_2.cpp @@ -22,6 +22,7 @@ #include "states_screens/help_screen_1.hpp" #include "states_screens/help_screen_3.hpp" #include "states_screens/help_screen_4.hpp" +#include "states_screens/help_screen_5.hpp" #include "states_screens/state_manager.hpp" using namespace GUIEngine; @@ -57,6 +58,8 @@ void HelpScreen2::eventCallback(Widget* widget, const std::string& name, const i screen = HelpScreen3::getInstance(); else if (selection == "page4") screen = HelpScreen4::getInstance(); + else if (selection == "page5") + screen = HelpScreen5::getInstance(); if(screen) StateManager::get()->replaceTopMostScreen(screen); } diff --git a/src/states_screens/help_screen_3.cpp b/src/states_screens/help_screen_3.cpp index 9118a37cb..722f7e092 100644 --- a/src/states_screens/help_screen_3.cpp +++ b/src/states_screens/help_screen_3.cpp @@ -23,6 +23,7 @@ #include "states_screens/help_screen_1.hpp" #include "states_screens/help_screen_2.hpp" #include "states_screens/help_screen_4.hpp" +#include "states_screens/help_screen_5.hpp" #include "states_screens/state_manager.hpp" using namespace GUIEngine; @@ -59,6 +60,8 @@ void HelpScreen3::eventCallback(Widget* widget, const std::string& name, const i // screen = HelpScreen3::getInstance(); else if (selection == "page4") screen = HelpScreen4::getInstance(); + else if (selection == "page5") + screen = HelpScreen5::getInstance(); if(screen) StateManager::get()->replaceTopMostScreen(screen); } diff --git a/src/states_screens/help_screen_4.cpp b/src/states_screens/help_screen_4.cpp index aceb1e5c5..7b1aa20ab 100644 --- a/src/states_screens/help_screen_4.cpp +++ b/src/states_screens/help_screen_4.cpp @@ -23,6 +23,7 @@ #include "states_screens/help_screen_1.hpp" #include "states_screens/help_screen_2.hpp" #include "states_screens/help_screen_3.hpp" +#include "states_screens/help_screen_5.hpp" #include "states_screens/state_manager.hpp" using namespace GUIEngine; @@ -59,6 +60,8 @@ void HelpScreen4::eventCallback(Widget* widget, const std::string& name, const i screen = HelpScreen3::getInstance(); //else if (selection == "page4") // screen = HelpScreen4::getInstance(); + else if (selection == "page5") + screen = HelpScreen5::getInstance(); if(screen) StateManager::get()->replaceTopMostScreen(screen); } diff --git a/src/states_screens/help_screen_5.cpp b/src/states_screens/help_screen_5.cpp new file mode 100644 index 000000000..83aa9d8e4 --- /dev/null +++ b/src/states_screens/help_screen_5.cpp @@ -0,0 +1,83 @@ +// SuperTuxKart - a fun racing game with go-kart +// Copyright (C) 2016 C. Michael Murphey +// +// 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 3 +// 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 "states_screens/help_screen_5.hpp" + +#include "guiengine/widget.hpp" +#include "guiengine/widgets/ribbon_widget.hpp" +#include "states_screens/help_screen_1.hpp" +#include "states_screens/help_screen_2.hpp" +#include "states_screens/help_screen_3.hpp" +#include "states_screens/help_screen_4.hpp" +#include "states_screens/state_manager.hpp" + +using namespace GUIEngine; + +DEFINE_SCREEN_SINGLETON( HelpScreen5 ); + +// ----------------------------------------------------------------------------- + +HelpScreen5::HelpScreen5() : Screen("help5.stkgui") +{ +} // HelpScreen5 + +// ----------------------------------------------------------------------------- + +void HelpScreen5::loadedFromFile() +{ +} // loadedFromFile + +// ----------------------------------------------------------------------------- + +void HelpScreen5::eventCallback(Widget* widget, const std::string& name, const int playerID) +{ + if (name == "category") + { + + std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER); + + Screen *screen = NULL; + if (selection == "page1") + screen = HelpScreen1::getInstance(); + else if (selection == "page2") + screen = HelpScreen2::getInstance(); + else if (selection == "page3") + screen = HelpScreen3::getInstance(); + else if (selection == "page4") + screen = HelpScreen4::getInstance(); + //else if (selection == "page5") + // screen = HelpScreen5::getInstance(); + if(screen) + StateManager::get()->replaceTopMostScreen(screen); + } + else if (name == "back") + { + StateManager::get()->escapePressed(); + } +} // eventCallback + +// ----------------------------------------------------------------------------- + +void HelpScreen5::init() +{ + Screen::init(); + RibbonWidget* w = this->getWidget("category"); + + if (w != NULL) w->select( "page5", PLAYER_ID_GAME_MASTER ); +} // init + +// ----------------------------------------------------------------------------- diff --git a/src/states_screens/help_screen_5.hpp b/src/states_screens/help_screen_5.hpp new file mode 100644 index 000000000..705feb2c6 --- /dev/null +++ b/src/states_screens/help_screen_5.hpp @@ -0,0 +1,49 @@ +// SuperTuxKart - a fun racing game with go-kart +// Copyright (C) 2016 C. Michael Murphey +// +// 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 3 +// 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_HELP_SCREEN_5_HPP +#define HEADER_HELP_SCREEN_5_HPP + +#include "guiengine/screen.hpp" + +namespace GUIEngine { class Widget; } + +/** + * \brief Help screen, part 5 + * \ingroup states_screens + */ +class HelpScreen5 : public GUIEngine::Screen, public GUIEngine::ScreenSingleton +{ + friend class GUIEngine::ScreenSingleton; + + HelpScreen5(); + +public: + + /** \brief implement callback from parent class GUIEngine::Screen */ + virtual void loadedFromFile() OVERRIDE; + + /** \brief implement callback from parent class GUIEngine::Screen */ + virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, + const int playerID) OVERRIDE; + + /** \brief implement callback from parent class GUIEngine::Screen */ + virtual void init() OVERRIDE; + +}; + +#endif