| 1 | #ifndef GAME_CLIENT_COMPONENTS_MENUS_INGAME_TOUCH_CONTROLS_H |
| 2 | #define |
| 3 | #include <game/client/component.h> |
| 4 | #include <game/client/components/touch_controls.h> |
| 5 | #include <game/client/ui.h> |
| 6 | |
| 7 | #include <memory> |
| 8 | |
| 9 | class : public CComponentInterfaces |
| 10 | { |
| 11 | public: |
| 12 | static constexpr const float = 700.0f; |
| 13 | enum class |
| 14 | { |
| 15 | , |
| 16 | , |
| 17 | , |
| 18 | |
| 19 | }; |
| 20 | |
| 21 | enum class |
| 22 | { |
| 23 | , |
| 24 | , |
| 25 | , |
| 26 | , |
| 27 | , |
| 28 | , |
| 29 | , |
| 30 | , |
| 31 | , |
| 32 | , |
| 33 | |
| 34 | }; |
| 35 | |
| 36 | // Which menu is selected. |
| 37 | enum class |
| 38 | { |
| 39 | , |
| 40 | , |
| 41 | , |
| 42 | , |
| 43 | |
| 44 | }; |
| 45 | EMenuType = EMenuType::MENU_FILE; |
| 46 | |
| 47 | enum class |
| 48 | { |
| 49 | , |
| 50 | , |
| 51 | , |
| 52 | , |
| 53 | , |
| 54 | |
| 55 | }; |
| 56 | ESortType = ESortType::LABEL; |
| 57 | |
| 58 | enum class |
| 59 | { |
| 60 | , |
| 61 | , |
| 62 | , |
| 63 | |
| 64 | }; |
| 65 | EElementType = EElementType::LAYOUT; |
| 66 | |
| 67 | enum class |
| 68 | { |
| 69 | , |
| 70 | , |
| 71 | , |
| 72 | |
| 73 | }; |
| 74 | std::array<EVisibilityType, (size_t)CTouchControls::EButtonVisibility::NUM_VISIBILITIES> ; // 0:-, 1:+, 2:Ignored. |
| 75 | |
| 76 | // Mainly for passing values in popups. |
| 77 | CTouchControls::CTouchButton * = nullptr; |
| 78 | CTouchControls::CTouchButton * = nullptr; |
| 79 | |
| 80 | // Storing everything you are editing. |
| 81 | CLineInputNumber ; |
| 82 | CLineInputNumber ; |
| 83 | CLineInputNumber ; |
| 84 | CLineInputNumber ; |
| 85 | CTouchControls::EButtonShape ; |
| 86 | |
| 87 | EBehaviorType = EBehaviorType::BIND; |
| 88 | EPredefinedType = EPredefinedType::EXTRA_MENU; |
| 89 | int = 0; |
| 90 | |
| 91 | class |
| 92 | { |
| 93 | public: |
| 94 | CLineInputBuffered<1024> m_InputCommand; |
| 95 | CLineInputBuffered<1024> ; |
| 96 | CTouchControls::CBindToggleTouchButtonBehavior::CCommand m_CachedCommands; |
| 97 | CButtonContainer ; |
| 98 | CButtonContainer ; |
| 99 | CButtonContainer [(int)CTouchControls::CButtonLabel::EType::NUM_TYPES]; |
| 100 | |
| 101 | () noexcept; |
| 102 | (CBehaviorElements &&Other) noexcept; |
| 103 | (); |
| 104 | CBehaviorElements &(CBehaviorElements &&Other) noexcept; |
| 105 | |
| 106 | CBehaviorElements &(const CBehaviorElements &) = delete; |
| 107 | (const CBehaviorElements &Other) = delete; |
| 108 | |
| 109 | std::string (const char *pLabel) const; |
| 110 | void (); |
| 111 | void () { m_CachedCommands.m_Label = ParseLabel(pLabel: m_InputLabel.GetString()); } |
| 112 | void UpdateCommand() { m_CachedCommands.m_Command = m_InputCommand.GetString(); } |
| 113 | void (); |
| 114 | }; |
| 115 | std::vector<std::unique_ptr<CBehaviorElements>> ; |
| 116 | |
| 117 | unsigned = 0; |
| 118 | unsigned = 0; |
| 119 | |
| 120 | // Used for creating ui elements. |
| 121 | std::array<CButtonContainer, (unsigned)CTouchControls::EButtonVisibility::NUM_VISIBILITIES> = {}; |
| 122 | std::array<CButtonContainer, (unsigned)ESortType::NUM_SORTS> = {}; |
| 123 | std::array<CButtonContainer, (unsigned)EElementType::NUM_ELEMENTS> = {}; |
| 124 | |
| 125 | // Functional variables. |
| 126 | bool = true; // Execute something when first opening the editor. |
| 127 | bool = false; // Decide if closing menu after the popup confirm. |
| 128 | bool = true; // Whether to reload the button being previewed. |
| 129 | bool = true; // Whether to sort all previewed buttons. |
| 130 | bool = false; // Whether to exclude some buttons from preview. |
| 131 | std::vector<CTouchControls::CTouchButton *> ; |
| 132 | std::vector<CTouchControls::CTouchButton *> ; |
| 133 | CLineInputBuffered<1024> ; |
| 134 | int = -1; |
| 135 | |
| 136 | void (CUIRect MainView); |
| 137 | bool (CUIRect Block); |
| 138 | bool (CUIRect Block); |
| 139 | bool (CUIRect Block); |
| 140 | void (CUIRect MainView); |
| 141 | void (CUIRect MainView); |
| 142 | |
| 143 | void (CUIRect SelectingTab); |
| 144 | void (CUIRect MainView); |
| 145 | void (CUIRect MainView); |
| 146 | void (CUIRect MainView); |
| 147 | |
| 148 | // Confirm, Cancel only decide if saving cached settings. |
| 149 | void (CTouchControls::CPopupParam ); |
| 150 | void () const; |
| 151 | void () const; |
| 152 | void (); |
| 153 | |
| 154 | // Getter and setters. |
| 155 | bool () const; |
| 156 | void (bool UnsavedChanges); |
| 157 | |
| 158 | // Convenient functions. |
| 159 | bool () const; |
| 160 | void (); |
| 161 | void (CTouchControls::CTouchButton *pTargetButton); |
| 162 | void (CTouchControls::CTouchButton *pTargetButton) const; |
| 163 | void (CTouchControls::CUnitRect MyRect); |
| 164 | void (CLineInputNumber *pInput); |
| 165 | void (); |
| 166 | void (); |
| 167 | void (); |
| 168 | void (); |
| 169 | int (const char *pType) const; |
| 170 | std::string DetermineTouchButtonCommandLabel(CTouchControls::CTouchButton *pButton) const; |
| 171 | const char **() const; |
| 172 | const char **() const; |
| 173 | |
| 174 | class |
| 175 | { |
| 176 | public: |
| 177 | const char *; |
| 178 | std::function<std::unique_ptr<CTouchControls::CPredefinedTouchButtonBehavior>()> ; |
| 179 | }; |
| 180 | |
| 181 | static const CBehaviorFactoryEditor [10]; |
| 182 | }; |
| 183 | |
| 184 | #endif |
| 185 | |