summaryrefslogtreecommitdiff
path: root/src/ui_elements/UI.h
diff options
context:
space:
mode:
authorPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-07-08 21:12:00 +0500
committerPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-07-08 21:12:00 +0500
commitd9b6fb98ab3f53598d79a183195964b0306c91c7 (patch)
tree852ad366fc2a8f393f6868f61d56443d09c51071 /src/ui_elements/UI.h
parent586942c66f7d4aa71f0b60bb5de9ae19266f0cad (diff)
keyboard comm
Diffstat (limited to 'src/ui_elements/UI.h')
-rw-r--r--src/ui_elements/UI.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ui_elements/UI.h b/src/ui_elements/UI.h
index 5868efe..4c94bf7 100644
--- a/src/ui_elements/UI.h
+++ b/src/ui_elements/UI.h
@@ -1,9 +1,41 @@
#include <raylib.h>
+#include <stddef.h>
#ifndef UI_ELEMENTS_H
#define UI_ELEMENTS_H
void DrawRecBordered(Rectangle rec, Color bg, Color border_color, int border_width);
void DrawTextInRec(Rectangle rec, char *text, Font *font, int height, Color color, float padding, int *scroll);
+float MeasureChar(Font *font, int height, char symbol);
+
+// ========== TEXT EDITOR ==========
+
+static const size_t DEFAULT_TEXT_NODE_SIZE = 256;
+
+typedef struct {
+ void *PrevNode;
+ void *NextNode;
+ char *text;
+ size_t cap;
+} TextNode;
+
+typedef struct {
+ TextNode *StartNode;
+ /// For the quick access
+ TextNode *CurrentNode;
+ size_t NodeLenth;
+
+ Vector2 CursorPosition;
+} TextArea;
+
+TextArea *CreateTextArea();
+void FreeTextArea(TextArea *ta);
+void DrawTextArea(TextArea *ta, Rectangle rec, Font *font, int height, int spacing);
+void InsertChar(TextArea *ta, char new_char);
+void DeleteChar(TextArea *ta);
+
+void HandleKeyboard(TextArea *ta);
+void MoveCursorRight(TextArea *ta);
+void MoveCursorLeft(TextArea *ta);
#endif // UI_ELEMENTS_H