-
Notifications
You must be signed in to change notification settings - Fork 0
TextInput
TechnologicalTurtle edited this page Jul 20, 2026
·
13 revisions
Wrapper for LibGui::DynamicText, that adds text editing.
// load font
LibGui::DT_TextureAtlas roboto("roboto.ttf");
// initialize textinput
LibGui::TextInput MyInput(roboto);
// or initialize textinput with window
LibGui::TextInput MyInput(MyWindow, roboto);
// its good to set some properties
MyInput.minSize = {100, 64};First initialize the text input, then just Update() it in while loop.
// initialize textinput
LibGui::TextInput MyInput(MyWindow, roboto);
// its good to set some properties
MyInput.minSize = {100, 64};
while (!MyWindow.ShouldClose())
{
MyWindow.Draw();
MyInput.Update();
MyWindow.PushDraw();
}Updates input, if render_afterwards is true, it calls Render() to render.
Renders TextInput.
Returns if user mouse is on TextInput. Ignore anchor parameter, as the function is override for RectangleInput::Rect_OnMouseEnter().
| Type | Name | Description |
|---|---|---|
bool |
active |
Can user interact with TextInput? |
string |
text |
Text in this TextInput |
| function pointer | string(*preprocessText)(const string&) |
Pointer to function that can process text before rendering. (useful f. e. for syntax highlighting) |
float |
fontSize |
Text input's text size |
| Vec2 | minSize |
Minimum background size. Set any axis to -1 to have no minimum size |
| Vec2 | maxSize |
Maximum background size. Set any axis to -1 to have no maximum size |
| Color | textColor |
text color |
| Color | backColor |
background color |
| Vec2i | pos |
Position of upper left corner |
int |
cursor_pos |
Index of character, where is currently text cursor. |
float |
textCursorTickRate |
text cursor blink length |
Features