| 1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
| 2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
| 3 | #ifndef GAME_CLIENT_COMPONENTS_MENUS_SETTINGS_CONTROLS_H |
| 4 | #define |
| 5 | |
| 6 | #include <game/client/component.h> |
| 7 | #include <game/client/components/binds.h> |
| 8 | #include <game/client/lineinput.h> |
| 9 | #include <game/client/ui.h> |
| 10 | #include <game/client/ui_scrollregion.h> |
| 11 | |
| 12 | #include <vector> |
| 13 | |
| 14 | enum class EBindOptionGroup |
| 15 | { |
| 16 | MOVEMENT, |
| 17 | WEAPON, |
| 18 | VOTING, |
| 19 | CHAT, |
| 20 | DUMMY, |
| 21 | MISCELLANEOUS, |
| 22 | CUSTOM, |
| 23 | NUM, |
| 24 | }; |
| 25 | |
| 26 | class CBindSlotUiElement |
| 27 | { |
| 28 | public: |
| 29 | CBindSlot m_Bind; |
| 30 | CButtonContainer m_KeyReaderButton; |
| 31 | CButtonContainer m_KeyResetButton; |
| 32 | bool m_ToBeDeleted = false; |
| 33 | |
| 34 | bool operator<(const CBindSlotUiElement &Other) const; |
| 35 | }; |
| 36 | |
| 37 | class CBindOption |
| 38 | { |
| 39 | public: |
| 40 | EBindOptionGroup m_Group; |
| 41 | const char *m_pLabel; |
| 42 | std::string m_Command; |
| 43 | std::vector<CBindSlotUiElement> m_vCurrentBinds; |
| 44 | CButtonContainer m_AddBindButtonContainer; |
| 45 | char m_TooltipButtonId; |
| 46 | bool m_AddNewBind = false; |
| 47 | bool m_AddNewBindActivate = false; |
| 48 | bool m_ToBeDeleted = false; |
| 49 | |
| 50 | std::vector<CBindSlotUiElement>::iterator GetBindSlotElement(const CBindSlot &BindSlot); |
| 51 | bool MatchesSearch(const char *pSearch) const; |
| 52 | }; |
| 53 | |
| 54 | class : public CComponentInterfaces |
| 55 | { |
| 56 | public: |
| 57 | void (CGameClient *pClient) override; |
| 58 | void (CUIRect MainView); |
| 59 | |
| 60 | private: |
| 61 | bool m_aBindGroupExpanded[(int)EBindOptionGroup::NUM]; |
| 62 | CButtonContainer m_aBindGroupExpandButtons[(int)EBindOptionGroup::NUM]; |
| 63 | std::vector<CBindOption> ; |
| 64 | size_t ; |
| 65 | void (); |
| 66 | |
| 67 | CScrollRegion ; |
| 68 | CButtonContainer ; |
| 69 | CLineInputBuffered<128> ; |
| 70 | int = 0; |
| 71 | std::vector<int> ; |
| 72 | bool = false; |
| 73 | void (); |
| 74 | |
| 75 | void (float Height, CUIRect *pParentRect, const char *pTitle, |
| 76 | bool *pExpanded, CButtonContainer *pExpandButton, const std::function<void(CUIRect Rect)> &RenderContentFunction); |
| 77 | |
| 78 | void (EBindOptionGroup Group, CUIRect *pParentRect, const char *pTitle); |
| 79 | float (EBindOptionGroup Group) const; |
| 80 | void (EBindOptionGroup Group, CUIRect View); |
| 81 | |
| 82 | float () const; |
| 83 | void (CUIRect View); |
| 84 | |
| 85 | std::vector<CButtonContainer> = {{}, {}}; |
| 86 | char [NUM_JOYSTICK_AXES][2]; // 2 for X and Y buttons |
| 87 | CScrollRegion ; |
| 88 | CUi::SDropDownState ; |
| 89 | float () const; |
| 90 | void (CUIRect View); |
| 91 | void (CUIRect View); |
| 92 | void (const CUIRect *pRect, float Current, float Tolerance, bool Active); |
| 93 | }; |
| 94 | |
| 95 | #endif |
| 96 | |