From 81131aedb9c5a9054acf3c50dad645a2052f85b8 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 27 Jun 2024 22:22:06 +0200 Subject: [PATCH] refactored draw_side_shade --- dialogs.cpp | 95 +++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/dialogs.cpp b/dialogs.cpp index 9be9b940..d9986702 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -652,6 +652,54 @@ EX namespace dialog { quickqueue(); } + EX void draw_side_shade() { + int steps = menu_darkening - darken; + + color_t col = (backcolor << 8) | (255 - (255 >> steps)); + + if(svg::in || !(auraNOGL || vid.usingGL)) { + flat_model_enabler fme; + initquickqueue(); + ld pix = 1 / (2 * cgi.hcrossf / cgi.crossf); + curvepoint(hyperpoint(vid.xres-dwidth, -10, 1, 1)); + curvepoint(hyperpoint(vid.xres + 10, -10, 1, 1)); + curvepoint(hyperpoint(vid.xres + 10, vid.yres + 10, 1, 1)); + curvepoint(hyperpoint(vid.xres-dwidth, vid.yres + 10, 1, 1)); + curvepoint(hyperpoint(vid.xres-dwidth, -10, 1, 1)); + shiftmatrix V = shiftless(atscreenpos(0, 0, pix)); + queuecurve(V, 0, col, PPR::LINE); + quickqueue(); + } + + #if CAP_GL + else { + auto full = part(col, 0); + static vector auravertices; + auravertices.clear(); + ld width = vid.xres / 100; + for(int i=4; ixcenter, by - current_display->ycenter, 0, 1), col); + } + } + glflush(); + current_display->next_shader_flags = GF_VARCOLOR; + dynamicval m(pmodel, mdPixel); + current_display->set_all(0, 0); + glhr::id_modelview(); + glhr::prepare(auravertices); + glhr::set_depthtest(false); + glDrawArrays(GL_TRIANGLES, 0, isize(auravertices)); + } + #endif + } + EX void display() { callhooks(hooks_display_dialog); @@ -698,52 +746,7 @@ EX namespace dialog { list_skip = 0; } - if(current_display->sidescreen && darken < menu_darkening) { - int steps = menu_darkening - darken; - color_t col = (backcolor << 8) | (255 - (255 >> steps)); - - if(svg::in || !(auraNOGL || vid.usingGL)) { - flat_model_enabler fme; - initquickqueue(); - ld pix = 1 / (2 * cgi.hcrossf / cgi.crossf); - curvepoint(hyperpoint(vid.xres-dwidth, -10, 1, 1)); - curvepoint(hyperpoint(vid.xres + 10, -10, 1, 1)); - curvepoint(hyperpoint(vid.xres + 10, vid.yres + 10, 1, 1)); - curvepoint(hyperpoint(vid.xres-dwidth, vid.yres + 10, 1, 1)); - curvepoint(hyperpoint(vid.xres-dwidth, -10, 1, 1)); - shiftmatrix V = shiftless(atscreenpos(0, 0, pix)); - queuecurve(V, 0, col, PPR::LINE); - quickqueue(); - } - - #if CAP_GL - else { - auto full = part(col, 0); - static vector auravertices; - auravertices.clear(); - ld width = vid.xres / 100; - for(int i=4; ixcenter, by - current_display->ycenter, 0, 1), col); - } - } - glflush(); - current_display->next_shader_flags = GF_VARCOLOR; - dynamicval m(pmodel, mdPixel); - current_display->set_all(0, 0); - glhr::id_modelview(); - glhr::prepare(auravertices); - glhr::set_depthtest(false); - glDrawArrays(GL_TRIANGLES, 0, isize(auravertices)); - } - #endif - } + if(current_display->sidescreen && darken < menu_darkening) draw_side_shade(); bool inlist = false; int need_to_skip = 0;