summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-03-07 11:31:56 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-03-07 11:31:56 -0500
commit4e2e9f00ec0c67a577639df399fef9851c3ae78d (patch)
treeae9a2031d3628d857e4caf02f5a91a43858ea447 /main.c
parent0ccd4de98d9f432053552edde65691888b564fdf (diff)
resizable build window
Diffstat (limited to 'main.c')
-rw-r--r--main.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/main.c b/main.c
index 1fe6266..3bfd5f0 100644
--- a/main.c
+++ b/main.c
@@ -791,7 +791,32 @@ int main(int argc, char **argv) {
}
if (ted->build_shown) {
float y2 = y;
- y -= 0.3f * ted->window_height;
+ y -= ted->build_output_height * ted->window_height;
+ if (ted->build_output_height == 0) {
+ // hasn't been initialized yet
+ ted->build_output_height = 0.25f;
+ }
+ if (ted->resizing_build_output) {
+ if (ted->mouse_state & SDL_BUTTON_LMASK) {
+ // resize it
+ ted->build_output_height = clampf((y2 - ted->mouse_pos.y) / ted->window_height, 0.05f, 0.8f);
+ } else {
+ // stop resizing build output
+ ted->resizing_build_output = false;
+ }
+ ted->cursor = ted->cursor_resize_v;
+ } else {
+ Rect gap = rect4(x1, y - padding, x2, y);
+ for (uint i = 0; i < ted->nmouse_clicks[SDL_BUTTON_LEFT]; ++i) {
+ if (rect_contains_point(gap, ted->mouse_clicks[SDL_BUTTON_LEFT][i])) {
+ // start resizing build output
+ ted->resizing_build_output = true;
+ }
+ }
+ if (rect_contains_point(gap, ted->mouse_pos)) {
+ ted->cursor = ted->cursor_resize_v;
+ }
+ }
build_frame(ted, x1, y, x2, y2);
y -= padding;
}