diff options
| author | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-08-27 19:34:49 +0500 |
|---|---|---|
| committer | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-08-27 19:34:49 +0500 |
| commit | 52ab86e5f55b189aea4198fe4d15a29c4d3c9d57 (patch) | |
| tree | b37655113dcb04255fba127291eff05a92807881 /src/ui_elements/UI.c | |
| parent | 40d500949686c3b2ea229eb3c7fe4e2f252785af (diff) | |
distraction scene init
Diffstat (limited to 'src/ui_elements/UI.c')
| -rw-r--r-- | src/ui_elements/UI.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ui_elements/UI.c b/src/ui_elements/UI.c index 502944c..e3a0048 100644 --- a/src/ui_elements/UI.c +++ b/src/ui_elements/UI.c @@ -78,3 +78,31 @@ void DrawTextInRec(Rectangle rec, char *text, Font *font, int height, Color colo } EndScissorMode(); } + +void GetPanesSplit(Rectangle *pane1, Rectangle *pane2, Rectangle body, float proportion_h, float proportion_v) { + if (body.height >= body.width) { + // vertical split + pane1->x = body.x; + pane1->y = body.y; + pane1->width = body.width; + pane1->height = (body.height - PADDING) * proportion_v; + + pane2->x = body.x; + pane2->y = body.y + pane1->height + PADDING; + pane2->width = body.width; + pane2->height = (body.height - PADDING) * (1 - proportion_v); + return; + } + + // horizontal split + pane1->x = body.x; + pane1->y = body.y; + pane1->height = body.height; + pane1->width = (body.width - PADDING) * proportion_h; + + pane2->y = body.y; + pane2->x = body.x + pane1->width + PADDING; + pane2->height = body.height; + pane2->width = (body.width - PADDING) * (1 - proportion_h); +} + |
