diff options
| author | iamcheeseman <[email protected]> | 2026-05-13 22:55:02 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-05-13 22:55:02 -0400 |
| commit | 46de6d936395b1063a729b9e40cfca290033482b (patch) | |
| tree | 513537db0085df334855a95401ed038b00b07219 /teensy/teensy_ui.c | |
| parent | 8d2793e9ef7cf7f742ec23e77c44ac21a624d01f (diff) | |
resize windows
Diffstat (limited to 'teensy/teensy_ui.c')
| -rw-r--r-- | teensy/teensy_ui.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/teensy/teensy_ui.c b/teensy/teensy_ui.c index af3e78f..c8369a5 100644 --- a/teensy/teensy_ui.c +++ b/teensy/teensy_ui.c @@ -47,7 +47,7 @@ typedef struct { static tyui_Style default_style = { .fg_normal = ty_color(200, 200, 200), - .bg_normal = ty_color(64, 64, 64), + .bg_normal = ty_color(20, 20, 20), .fg_hover = ty_color(255, 255, 255), .bg_hover = ty_color(100, 100, 100), .win_bg = ty_color(48, 48, 48), @@ -224,18 +224,33 @@ bool tyui_begin_window_ex( if (win->flags & TYUI_WIN_INVISIBLE) goto done; - ty_Recti title_rect = win->rect; - title_rect.h = TEXT_HEIGHT; - ty_Vec2i mouse_pos = ty_mouse_pos(); ty_Vec2i md = mouse_delta(); mouse_pos.x -= md.x; mouse_pos.y -= md.y; + // Grabbing resizer? + ty_Vec2i win_end = ty_recti_end(win->rect); + ty_Recti resize_rect = ty_recti( + win_end.x - 10, win_end.y - 10 + TITLE_BAR_HEIGHT, + 10, 10 + ); + if (ty_button_down(TY_BTN_DB_LMB) && + ty_pointi_in_recti(mouse_pos, resize_rect) + ) { + win->rect.w += md.x; + win->rect.h += md.y; + ty_free_image(win->content); + win->content = ty_create_image(win->rect.w, win->rect.h, NULL); + } + + ty_Recti title_rect = win->rect; + title_rect.h = TEXT_HEIGHT; + + // Grabbing title bar? if (ty_button_down(TY_BTN_DB_LMB) && ty_pointi_in_recti(mouse_pos, title_rect) ) { - ty_Vec2i md = mouse_delta(); win->rect.x += md.x; win->rect.y += md.y; @@ -249,6 +264,7 @@ bool tyui_begin_window_ex( ty_Recti body_rect = win->rect; body_rect.y += TEXT_HEIGHT; rect_cmd(body_rect, uictx.style.win_bg); + rect_cmd(resize_rect, uictx.style.bg_normal); target_cmd(&win->content); |
