1 //////////////////////////////////////////////////////////////////////////////// 2 // Copyright (C) 2004-2011 by The Allacrost Project 3 // Copyright (C) 2012-2018 by Bertram (Valyria Tear) 4 // All Rights Reserved 5 // 6 // This code is licensed under the GNU GPL version 2. It is free software and 7 // you may modify it and/or redistribute it under the terms of this license. 8 // See https://www.gnu.org/copyleft/gpl.html for details. 9 //////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef __BATTLE_DEFEAT_HEADER__ 12 #define __BATTLE_DEFEAT_HEADER__ 13 14 #include "battle_finish.h" 15 16 #include "common/gui/menu_window.h" 17 #include "common/gui/option.h" 18 #include "common/gui/textbox.h" 19 20 namespace vt_battle 21 { 22 23 namespace private_battle 24 { 25 26 //! \brief Enums for the various states that the FinishWindow class may be in 27 enum DEFEAT_STATE { 28 DEFEAT_INVALID = -1, 29 DEFEAT_SELECT = 0, //!< Player selects what to do after defeat (go to main menu, exit game, etc.) 30 DEFEAT_CONFIRM = 1, //!< Player confirms defeat selection 31 DEFEAT_END = 3, //!< Short sequence of hiding finish GUI objects 32 }; 33 34 /** **************************************************************************** 35 *** \brief Represents a collection of GUI objects drawn when the player loses the battle 36 *** 37 *** This class assists the FinishSupervisor class. It is only utilized when the 38 *** player's characters are defeated in battle and presents the player with a 39 *** number of options. 40 *** ***************************************************************************/ 41 class BattleDefeat : public BattleFinish 42 { 43 public: 44 BattleDefeat(); 45 46 virtual ~BattleDefeat(); 47 48 virtual void Initialize() override; 49 50 //! \brief Processes user input and updates the GUI controls 51 virtual void Update() override; 52 53 //! \brief Draws the finish window and GUI contents to the screen 54 virtual void Draw() override; 55 56 private: 57 //! \brief A reference to where the state of the finish GUI menus is maintained 58 DEFEAT_STATE _state; 59 60 //! \brief Used to announce the battle's outcome 61 vt_gui::TextBox _outcome_text; 62 63 //! \brief The window that the defeat message and options are displayed upon 64 vt_gui::MenuWindow _options_window; 65 66 //! \brief The window that the defeat message and options are displayed upon 67 vt_gui::MenuWindow _tooltip_window; 68 69 //! \brief The list of options that the player may choose from when they lose the battle 70 vt_gui::OptionBox _defeat_options; 71 72 //! \brief A simple "yes/no" confirmation to the selected option 73 vt_gui::OptionBox _confirm_options; 74 75 //! \brief Tooltip text explaining the currently selected option 76 vt_gui::TextBox _tooltip; 77 78 //! \brief Changes the text displayed by the tooltip based on the current state and selected option 79 void _SetTooltipText(); 80 }; 81 82 } // namespace private_battle 83 84 } // namespace vt_battle 85 86 #endif // __BATTLE_DEFEAT_HEADER__ 87