diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-09-27 06:00:55 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-09-27 06:00:55 +0200 |
commit | d30a475631c4f8b4cf9d818a711be018d23fef0d (patch) | |
tree | bbf384c8edae34956f854242f03498a36bce7621 | |
parent | e537c6f078de479ea9c380529b4117f510286516 (diff) | |
download | saw-d30a475631c4f8b4cf9d818a711be018d23fef0d.zip |
two rolls
-rw-r--r-- | source/saw/main.c | 21 |
1 files changed, 15 insertions, 6 deletions
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; |