From 64e23a3455ef1e71786c4b3a835a91954e08ab79 Mon Sep 17 00:00:00 2001 From: Physick <96335032+DegustatorPonos@users.noreply.github.com> Date: Sat, 11 Jul 2026 17:57:38 +0500 Subject: Editor position work --- src/ui_elements/UI.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/ui_elements/UI.h') 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 -- cgit v1.3