diff options
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); +} + |
