diff options
| author | physick <mynameisgennadiy@vk.com> | 2026-08-29 14:12:24 +0500 |
|---|---|---|
| committer | physick <mynameisgennadiy@vk.com> | 2026-08-29 14:12:24 +0500 |
| commit | d51d95b66dee211ef654693fb23238d5a234f48c (patch) | |
| tree | f225999b981091944a1e7442e22fb0a0af2f4003 /src/ui_elements | |
| parent | 52ab86e5f55b189aea4198fe4d15a29c4d3c9d57 (diff) | |
merged branches
Diffstat (limited to 'src/ui_elements')
| -rw-r--r-- | src/ui_elements/UI.c | 30 | ||||
| -rw-r--r-- | src/ui_elements/UI.h | 14 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/ui_elements/UI.c b/src/ui_elements/UI.c index e3a0048..9daed74 100644 --- a/src/ui_elements/UI.c +++ b/src/ui_elements/UI.c @@ -1,5 +1,6 @@ #include "UI.h" #include <raylib.h> +#include "../resources/resources.h" const int MAX_LINES = 8192; const int SPACING_H = 1; @@ -106,3 +107,32 @@ void GetPanesSplit(Rectangle *pane1, Rectangle *pane2, Rectangle body, float pro pane2->width = (body.width - PADDING) * (1 - proportion_h); } +void DrawPageView(int y, unsigned int pages, unsigned int current_page) { + if (pages == 0) return; + float width = 2 * PAGE_DOTS_PADDING + + PAGE_DOTS_RADIUS * 2 * pages + + PAGE_DOTS_SPACING * (pages - 1); + + Rectangle rec = { + .x = (GetScreenWidth() - width) / 2, // TODO + .y = y, + .height = PAGE_DOTS_RADIUS * 2 + 2 * PAGE_DOTS_PADDING, + .width = width, + }; + + Color color = { + .r = COLORSCHEME_WHITE.r, + .g = COLORSCHEME_WHITE.g, + .b = COLORSCHEME_WHITE.b, + .a = COLORSCHEME_WHITE.a & PAGE_DOTS_TRANSPARENCY }; + + DrawRectangleRounded(rec, 0.15f, 8, color); + + int x_pos = (int)rec.x + PAGE_DOTS_PADDING + PAGE_DOTS_RADIUS; + int y_pos = (int)rec.y + PAGE_DOTS_PADDING + PAGE_DOTS_RADIUS; + for (int i = 0; i < pages; ++i) { + Color color = i == current_page ? COLORSCHEME_ORANGE : COLORSCHEME_BROWN; + DrawCircle(x_pos, y_pos, PAGE_DOTS_RADIUS, color); + x_pos += PAGE_DOTS_SPACING + PAGE_DOTS_RADIUS * 2; + } +} diff --git a/src/ui_elements/UI.h b/src/ui_elements/UI.h index d3af014..8754329 100644 --- a/src/ui_elements/UI.h +++ b/src/ui_elements/UI.h @@ -9,6 +9,11 @@ static const float SCROLL_SENC = 10; static const float TAB_WIDTH = 4; static const int PADDING = 10; +static const int HEADER_FONT_SIZE = 50; +static const int EDITOR_PADDING = 3; +static const int BORDER = 2; +static const int FOOTER_HEIGHT = 30; + // Sure about this value static const int MIN_FONT_SIZE = 10; // Unsure about this value @@ -32,6 +37,15 @@ typedef struct { void UpdateButton(Button *btn); void DrawButton(Button *btn, Rectangle *location); +// ========== PAGE VIEW ========== + +static const int PAGE_DOTS_SPACING = 15; +static const int PAGE_DOTS_PADDING = 15; +static const int PAGE_DOTS_RADIUS = 3; +static const char PAGE_DOTS_TRANSPARENCY = (char)192; + +void DrawPageView(int y, unsigned int pages, unsigned int current_page); + // ========== TEXT EDITOR ========== static const size_t DEFAULT_TEXT_NODE_SIZE = 256; |
