summaryrefslogtreecommitdiff
path: root/src/ui_elements/UI.h
diff options
context:
space:
mode:
authorPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-07-11 17:57:38 +0500
committerPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-07-11 17:57:38 +0500
commit64e23a3455ef1e71786c4b3a835a91954e08ab79 (patch)
tree266d56ed56a7bedea6a2187689fac522dab95db9 /src/ui_elements/UI.h
parent55ef21312888cbfb9d449eee8f7958b74f85ac7c (diff)
Editor position work
Diffstat (limited to 'src/ui_elements/UI.h')
-rw-r--r--src/ui_elements/UI.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/ui_elements/UI.h b/src/ui_elements/UI.h
index eaf17e8..9f126c3 100644
--- a/src/ui_elements/UI.h
+++ b/src/ui_elements/UI.h
@@ -7,6 +7,9 @@
static const float SCROLL_SENC = 10;
static const float TAB_WIDTH = 4;
+static const int MIN_FONT_SIZE = 10;
+static const int MAX_FONT_SIZE = 100;
+
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);
@@ -24,6 +27,21 @@ typedef struct {
size_t cap;
} TextNode;
+
+typedef struct {
+ Font *font;
+ int font_size;
+ int spacing;
+
+ int scroll_h;
+ int scroll_v;
+
+ /// DO NOT MODIFY THAT! It's for internal use only
+ int _area_width;
+ /// DO NOT MODIFY THAT! It's for internal use only
+ int _area_height;
+} TextAreaDisplayParams;
+
typedef struct {
TextNode *StartNode;
/// For the quick access
@@ -31,17 +49,15 @@ typedef struct {
size_t NodeLenth;
Vector2 CursorPosition;
+ TextAreaDisplayParams *DisplayParams;
} TextArea;
-TextArea *CreateTextArea();
-void FreeTextArea(TextArea *ta);
-void DrawTextArea(TextArea *ta, Rectangle rec, Font *font, int height, int spacing, int *scroll);
+TextArea *CreateTextArea(TextAreaDisplayParams *DisplayParams);
+void DrawTextArea(TextArea *ta, Rectangle rec);
void InsertChar(TextArea *ta, char new_char);
void DeleteChar(TextArea *ta);
void HandleKeyboard(TextArea *ta);
-void MoveCursorRight(TextArea *ta);
-void MoveCursorLeft(TextArea *ta);
-void MoveCursorDown(TextArea *ta);
+void FreeTextArea(TextArea *ta);
#endif // UI_ELEMENTS_H