From 74a9c396508816f690eb61f7c362fae672780753 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sun, 11 Feb 2024 12:33:45 +0800 Subject: [PATCH] Document `DoEditBox()` --- src/game/client/ui.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/game/client/ui.h b/src/game/client/ui.h index 89a19c048..85e132855 100644 --- a/src/game/client/ui.h +++ b/src/game/client/ui.h @@ -514,7 +514,36 @@ public: void DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {}, int StrLen = -1, const CTextCursor *pReadCursor = nullptr) const; void DoLabelStreamed(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {}, int StrLen = -1, const CTextCursor *pReadCursor = nullptr) const; + /** + * Creates an input field. + * + * @see DoClearableEditBox + * + * @param pLineInput This pointer will be stored and written to on next user input. + * So you can not pass in a pointer that goes out of scope such as a local variable. + * Pass in either a member variable of the current class or a static variable. + * For example ```static CLineInputBuffered s_MyInput;``` + * @param pRect the UI rect it will attach to with a 2.0f margin + * @param FontSize Size of the font (`10.0f`, `12.0f` and `14.0f` are commonly used here) + * @param Corners Number of corners (default: `IGraphics::CORNER_ALL`) + * @param vColorSplits Sets color splits of the `CTextCursor` to allow multicolored text + */ bool DoEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners = IGraphics::CORNER_ALL, const std::vector &vColorSplits = {}); + + /** + * Creates an input field with a clear [x] button attached to it. + * + * @see DoEditBox + * + * @param pLineInput This pointer will be stored and written to on next user input. + * So you can not pass in a pointer that goes out of scope such as a local variable. + * Pass in either a member variable of the current class or a static variable. + * For example ```static CLineInputBuffered s_MyInput;``` + * @param pRect the UI rect it will attach to + * @param FontSize Size of the font (`10.0f`, `12.0f` and `14.0f` are commonly used here) + * @param Corners Number of corners (default: `IGraphics::CORNER_ALL`) + * @param vColorSplits Sets color splits of the `CTextCursor` to allow multicolored text + */ bool DoClearableEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners = IGraphics::CORNER_ALL, const std::vector &vColorSplits = {}); int DoButton_Menu(CUIElement &UIElement, const CButtonContainer *pID, const std::function &GetTextLambda, const CUIRect *pRect, const SMenuButtonProperties &Props = {});