diff options
-rw-r--r-- | source/saw/main.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/source/saw/main.c b/source/saw/main.c index 7147fd2..4c36b75 100644 --- a/source/saw/main.c +++ b/source/saw/main.c @@ -1558,7 +1558,6 @@ static void saw_project_print_to_file(str_t file_name) { // TODO // - UI library and tests. // - Grid widget. -// - Prefer nvgRGBAf instead of nvgRGBA. // // ================================================================ @@ -1974,7 +1973,7 @@ static void saw_ui_compose(f64 x0, f64 y0, f64 width, f64 height) { track_height * .2 - border * 2.); nvgRect(saw_nvg, x0, y0 + border + track_height * .8, width, track_height * .2 - border * 2.); - nvgFillColor(saw_nvg, nvgRGBA(180, 140, 120, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.7f, .6f, .5f, .65f)); nvgFill(saw_nvg); // Tracks @@ -2032,10 +2031,11 @@ static void saw_ui_compose(f64 x0, f64 y0, f64 width, f64 height) { nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x + border, y + border, w - border * 2., h - border * 2.); - nvgFillColor(saw_nvg, is_choosen ? nvgRGBA(240, 230, 200, 255) - : is_playing ? nvgRGBA(240, 210, 180, 240) - : has_cursor ? nvgRGBA(210, 210, 255, 255) - : nvgRGBA(180, 180, 180, 220)); + nvgFillColor(saw_nvg, is_choosen ? nvgRGBAf(.9f, .8f, .7f, 1.f) + : is_playing ? nvgRGBAf(.9f, .8f, .7f, .9f) + : has_cursor + ? nvgRGBAf(.8f, .8f, 1.f, 1.f) + : nvgRGBAf(.7f, .6f, .6f, .8f)); nvgFill(saw_nvg); if (has_cursor) { @@ -2289,7 +2289,7 @@ static void saw_ui_compose(f64 x0, f64 y0, f64 width, f64 height) { if (x >= x0 - border * 2 && x < x0 + width) { nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x, y0, w, height); - nvgFillColor(saw_nvg, nvgRGBA(240, 240, 80, 180)); + nvgFillColor(saw_nvg, nvgRGBAf(.9f, .9f, .1f, .8f)); nvgFill(saw_nvg); } @@ -2316,7 +2316,7 @@ static void saw_ui_compose(f64 x0, f64 y0, f64 width, f64 height) { nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x + border, y + border, w - border * 2, track_height - border * 2); - nvgFillColor(saw_nvg, nvgRGBA(180, 160, 140, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.8f, .7f, .6f, .7f)); nvgFill(saw_nvg); } } @@ -2334,7 +2334,7 @@ static void saw_ui_compose(f64 x0, f64 y0, f64 width, f64 height) { nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x - w / 2, y0, w, height); - nvgFillColor(saw_nvg, nvgRGBA(80, 80, 240, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.2f, .2f, .9f, .6f)); nvgFill(saw_nvg); } } @@ -2426,7 +2426,7 @@ static void saw_ui_oscillator(saw_oscillator_t *osc, f64 x0, f64 y0, nvgFontSize(saw_nvg, text_height); nvgFontFaceId(saw_nvg, saw_font_text); - nvgFillColor(saw_nvg, nvgRGBA(255, 255, 255, 255)); + nvgFillColor(saw_nvg, nvgRGBAf(1.f, 1.f, 1.f, 1.f)); nvgTextAlign(saw_nvg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE); nvgText(saw_nvg, x, y0 + text_height * 6.5, "Envelope", 0); @@ -2562,7 +2562,7 @@ static void saw_ui_sampler(saw_sampler_t *sampler, f64 x0, f64 y0, nvgFontSize(saw_nvg, text_height); nvgFontFaceId(saw_nvg, saw_font_text); - nvgFillColor(saw_nvg, nvgRGBA(255, 255, 255, 255)); + nvgFillColor(saw_nvg, nvgRGBAf(1.f, 1.f, 1.f, 1.f)); nvgTextAlign(saw_nvg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE); nvgText(saw_nvg, x, y0 + sample_height + text_height * 6.5, "Envelope", NULL); @@ -2590,7 +2590,7 @@ static void saw_ui_track(saw_track_t *track, f64 x0, f64 y0, nvgFontSize(saw_nvg, text_height - border); nvgFontFaceId(saw_nvg, saw_font_text); nvgTextAlign(saw_nvg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE); - nvgFillColor(saw_nvg, nvgRGBA(255, 255, 255, 255)); + nvgFillColor(saw_nvg, nvgRGBAf(1.f, 1.f, 1.f, 1.f)); nvgText(saw_nvg, x0 + border * 2., y0 + text_height - border * 2., title.values, title.values + title.size); @@ -2608,9 +2608,9 @@ static void saw_ui_track(saw_track_t *track, f64 x0, f64 y0, nvgFontFaceId(saw_nvg, saw_font_icons); if (has_cursor) - nvgFillColor(saw_nvg, nvgRGBA(240, 200, 100, 255)); + nvgFillColor(saw_nvg, nvgRGBAf(.9f, .8f, .3f, 1.f)); else - nvgFillColor(saw_nvg, nvgRGBA(240, 200, 100, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.9f, .8f, .3f, .6f)); nvgText(saw_nvg, x + border, y0 + s - border, xmark, xmark + (sizeof xmark - 1)); @@ -2658,14 +2658,14 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x0, y0, width, text_height); - nvgFillColor(saw_nvg, nvgRGBA(80, 60, 50, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.3f, .2f, .25f, .6f)); nvgFill(saw_nvg); nvgBeginPath(saw_nvg); nvgFontSize(saw_nvg, text_height); nvgFontFaceId(saw_nvg, saw_font_text); nvgTextAlign(saw_nvg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE); - nvgFillColor(saw_nvg, nvgRGBA(255, 255, 255, 255)); + nvgFillColor(saw_nvg, nvgRGBAf(1.f, 1.f, 1.f, 1.f)); nvgText(saw_nvg, x0 + border * 2., y0 + text_height - border * 2, title.values, title.values + title.size); nvgFill(saw_nvg); @@ -2707,9 +2707,9 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, nvgFontSize(saw_nvg, header_height - border * 2.); nvgFontFaceId(saw_nvg, saw_font_icons); if (roll->loop_duration == 0) - nvgFillColor(saw_nvg, nvgRGBA(80, 80, 80, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.3f, .3f, .3f, .5f)); else - nvgFillColor(saw_nvg, nvgRGBA(180, 80, 40, 200)); + nvgFillColor(saw_nvg, nvgRGBAf(.7f, .3f, .35f, .8f)); nvgTextAlign(saw_nvg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE); nvgText(saw_nvg, x - header_height / 2 - border, y + header_height / 2, repeat, @@ -2731,7 +2731,7 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x + rx, y, rw, h); nvgRect(saw_nvg, x + rx, y + h * 4., rw, h); - nvgFillColor(saw_nvg, nvgRGBA(180, 80, 40, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.7f, .4f, .3f, .6f)); nvgFill(saw_nvg); } @@ -2742,7 +2742,7 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, } nvgRect(saw_nvg, x + rx + rw, y, w - rx - rw, h); nvgRect(saw_nvg, x + rx + rw, y + h * 4., w - rx - rw, h); - nvgFillColor(saw_nvg, nvgRGBA(80, 80, 80, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.3f, .3f, .3f, .6f)); nvgFill(saw_nvg); if (saw_mouse_x >= x && saw_mouse_y >= y && saw_mouse_x < x + w && @@ -2789,10 +2789,10 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x, y, w, h); nvgFillColor(saw_nvg, roll->pitch_turned_off[pitch] - ? nvgRGBA(220, 220, 220, 160) + ? nvgRGBAf(.8f, .8f, .8f, .6f) : has_cursor - ? nvgRGBA(200, 200, 255, 255) - : nvgRGBA(220, 220, 220, 255)); + ? nvgRGBAf(.7f, .7f, 1.f, 1.f) + : nvgRGBAf(.8f, .8f, .8f, 1.f)); nvgFill(saw_nvg); nvgFontSize(saw_nvg, h * .5); @@ -2937,10 +2937,10 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, saw_mouse_x < x + w && saw_mouse_y >= y && saw_mouse_y < y + h; - nvgFillColor(saw_nvg, turned_off ? nvgRGBA(160, 150, 120, 100) + nvgFillColor(saw_nvg, turned_off ? nvgRGBAf(.5f, .4f, .3f, .4f) : has_cursor - ? nvgRGBA(180, 180, 220, 160) - : nvgRGBA(170, 160, 140, 150)); + ? nvgRGBAf(.7f, .7f, .8f, .6f) + : nvgRGBAf(.65f, .6f, .6f, .5f)); nvgFill(saw_nvg); // Empty cell input @@ -3027,9 +3027,10 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, nvgRect(saw_nvg, x + border, y + border, w - border * 2., h - border * 2.); - nvgFillColor(saw_nvg, is_playing ? nvgRGBA(255, 230, 200, 255) - : has_cursor ? nvgRGBA(190, 190, 230, 255) - : nvgRGBA(180, 180, 180, 255)); + nvgFillColor(saw_nvg, is_playing ? nvgRGBAf(1.f, .9f, .8f, 1.f) + : has_cursor + ? nvgRGBAf(.7f, .7f, .9f, 1.f) + : nvgRGBAf(.65f, .65f, .65f, 1.f)); nvgFill(saw_nvg); // Note input @@ -3113,7 +3114,7 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, x < x0 + width) { nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x, y0 + text_height, w, height - text_height); - nvgFillColor(saw_nvg, nvgRGBA(240, 240, 80, 180)); + nvgFillColor(saw_nvg, nvgRGBAf(.9f, .9f, .2f, .7f)); nvgFill(saw_nvg); } } @@ -3132,7 +3133,7 @@ static void saw_ui_roll(saw_roll_t *roll, f64 x0, f64 y0, f64 width, nvgBeginPath(saw_nvg); nvgRect(saw_nvg, x - w * .5, y0 + text_height, w, height - text_height); - nvgFillColor(saw_nvg, nvgRGBA(80, 80, 240, 160)); + nvgFillColor(saw_nvg, nvgRGBAf(.2f, .2f, .8f, .7f)); nvgFill(saw_nvg); } } |