1 /////////////////////////////////////////////////////////////////////////////// 2 // Copyright (C) 2017 by Bertram (Valyria Tear) 3 // All Rights Reserved 4 // 5 // This code is licensed under the GNU GPL version 2. It is free software 6 // and you may modify it and/or redistribute it under the terms of this license. 7 // See https://www.gnu.org/copyleft/gpl.html for details. 8 /////////////////////////////////////////////////////////////////////////////// 9 10 /** **************************************************************************** 11 *** \brief Header file for map mode escape points handler. 12 *** *****************************************************************************/ 13 14 #ifndef __MAP_ESCAPE_HEADER__ 15 #define __MAP_ESCAPE_HEADER__ 16 17 #include "map_location.h" 18 19 #include "common/gui/menu_window.h" 20 #include "common/gui/option.h" 21 #include "common/gui/textbox.h" 22 23 namespace vt_map 24 { 25 26 namespace private_map 27 { 28 29 /** **************************************************************************** 30 *** \brief A supervisor for the UI linked to escape circles. 31 *** 32 *** Escape circles permits to go back to a safe location instantly. 33 *** ***************************************************************************/ 34 35 class EscapeSupervisor 36 { 37 public: 38 EscapeSupervisor(); 39 ~EscapeSupervisor(); 40 41 /** \brief Initializes the escape supervisor and shows the escape window. 42 *** \param map_coordinates The coordinates where to make the characters escape. 43 *** Can be invalid. 44 **/ 45 void Initialize(const vt_map::MapLocation& map_location); 46 47 //! \brief Processes input events from the user and updates the showing/hiding progress of the window 48 void Update(); 49 50 /** \brief Draws the window to the screen 51 *** \note If the Initialize method has not been called with a valid treasure pointer beforehand, this 52 *** method will print a warning and it will not draw anything to the screen. 53 **/ 54 void Draw(); 55 56 //! \brief Hides the window and cancel the action. 57 void Cancel(); 58 59 //! \brief Hides the window and potentially make the characters escape 60 void Finish(); 61 62 private: 63 //! \brief Map coordinates where to make the characters escape, if the cooirdinates are valid. 64 vt_map::MapLocation _map_location; 65 66 //! \brief Lists all of the drunes and inventory objects contained in the treasure 67 vt_gui::MenuWindow _escape_window; 68 69 //! \brief The available actions that a user can currently take. 70 vt_gui::OptionBox _action_options; 71 72 //! \brief A rendering of the name for the escape window 73 vt_video::TextImage _window_title; 74 75 //! \brief The TextImages used to render the map hud names and subnames 76 vt_video::TextImage _map_hud_name; 77 vt_video::TextImage _map_hud_subname; 78 79 //! \brief Freestyle art image of the current map 80 vt_video::StillImage _location_image; 81 82 //! \brief Stores whether the location is valid 83 bool _location_valid; 84 85 // ---------- Private methods 86 87 //! \brief Loads the current map location preview 88 bool _LoadMapLocationPreview(); 89 90 }; // class EscapeSupervisor 91 92 } // namespace private_map 93 94 } // namespace vt_map 95 96 #endif // __MAP_ESCAPE_HEADER__ 97