diff options
Diffstat (limited to 'src/ui_elements')
| -rw-r--r-- | src/ui_elements/Button.c | 2 | ||||
| -rw-r--r-- | src/ui_elements/UI.c | 8 | ||||
| -rw-r--r-- | src/ui_elements/UI.h | 5 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/ui_elements/Button.c b/src/ui_elements/Button.c index e7293c8..a12e3a7 100644 --- a/src/ui_elements/Button.c +++ b/src/ui_elements/Button.c @@ -2,7 +2,7 @@ #include <raylib.h> void UpdateButton(Button *btn) { - if (IsMouseInRec(btn->previousFramePosition) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { + if (IsMouseInRec(btn->previousFramePosition) && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) { btn->OnClick(btn->parent); } } diff --git a/src/ui_elements/UI.c b/src/ui_elements/UI.c index ea3463a..f9b7527 100644 --- a/src/ui_elements/UI.c +++ b/src/ui_elements/UI.c @@ -139,6 +139,7 @@ void GetPanesSplit(Rectangle *pane1, Rectangle *pane2, Rectangle body, float pro pane2->width = (body.width - PADDING) * (1 - proportion_h); } +// !! Not used anywhere at this moment void DrawPageView(int y, unsigned int pages, unsigned int current_page) { if (pages == 0) return; float width = 2 * PAGE_DOTS_PADDING @@ -168,3 +169,10 @@ void DrawPageView(int y, unsigned int pages, unsigned int current_page) { x_pos += PAGE_DOTS_SPACING + PAGE_DOTS_RADIUS * 2; } } + +void PrintTime(char *trg, size_t seconds) { + if (trg == NULL) return; + size_t disp_minutes = seconds / 60; + size_t disp_seconds = seconds % 60; + sprintf(trg, "%02zu:%02zu", disp_minutes, disp_seconds); +} diff --git a/src/ui_elements/UI.h b/src/ui_elements/UI.h index e48804e..356c2f4 100644 --- a/src/ui_elements/UI.h +++ b/src/ui_elements/UI.h @@ -50,6 +50,7 @@ static const int PAGE_DOTS_RADIUS = 3; static const char PAGE_DOTS_TRANSPARENCY = (char)192; /// Draws the little dots that represent the page you are on +// !! Not used anywhere at this moment void DrawPageView(int y, unsigned int pages, unsigned int current_page); // ========== TEXT EDITOR ========== @@ -104,4 +105,8 @@ void FreeTextArea(TextArea *ta); /// and vertical orientation void GetPanesSplit(Rectangle *pane1, Rectangle *pane2, Rectangle body, float proportion_h, float proportion_v); +/// Prints the time in the format MM:SS to the trg. +/// It is expected that size of outp buffer is at least 16 bytes +void PrintTime(char *trg, size_t seconds); + #endif // UI_ELEMENTS_H |
