From d30a475631c4f8b4cf9d818a711be018d23fef0d Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Wed, 27 Sep 2023 06:00:55 +0200 Subject: two rolls --- source/saw/main.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/saw/main.c b/source/saw/main.c index ea9fcb2..2ccda66 100644 --- a/source/saw/main.c +++ b/source/saw/main.c @@ -183,12 +183,10 @@ static void saw_audio(ma_device *device, void *void_out_, #endif static void saw_ui_roll(saw_roll_t *roll, i64 x0, i64 y0, i64 width, - i64 height) { - // Piano roll - // - + i64 height, str_t title) { i32 frame_height = sapp_height(); + i32 text_height = 35; i32 pianokey_height = 35; i32 pianokey_width = 100; i32 roll_border = 2; @@ -196,6 +194,17 @@ static void saw_ui_roll(saw_roll_t *roll, i64 x0, i64 y0, i64 width, i32 sheet_offset = 40; i32 sheet_scale = 20; + // Title text + // + + nvgBeginPath(saw_nvg); + nvgRect(saw_nvg, x0, frame_height - y0 - height, w, text_height); + nvgFillColor(saw_nvg, nvgRGBA(100, 60, 50, 180)); + nvgFill(saw_nvg); + + // Piano roll + // + i8 hover_any = 0; for (i32 pitch = 0; pitch < ROLL_SIZE; pitch++) { @@ -207,7 +216,7 @@ static void saw_ui_roll(saw_roll_t *roll, i64 x0, i64 y0, i64 width, if (y > frame_height - y0) continue; - if (y < frame_height - y0 - height) + if (y < frame_height - y0 - height + text_height) break; nvgBeginPath(saw_nvg); @@ -263,7 +272,7 @@ static void saw_ui_roll(saw_roll_t *roll, i64 x0, i64 y0, i64 width, if (y > frame_height - y0) continue; - if (y < frame_height - y0 - height) + if (y < frame_height - y0 - height + text_height) break; i32 h = pianokey_height; -- cgit v1.2.3