]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
console: improve default text legibility and background alpha behaviour
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 2 May 2024 21:59:11 +0000 (07:59 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 3 May 2024 06:44:49 +0000 (16:44 +1000)
With the Quake font and some mod fonts the text was too dim and hard to
read by default.

Makes the dropdown console always have the configured alpha (even at the
menu with no demos playing).

Uses a tiny bit of alpha by default.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cl_screen.c
console.c
console.h
gl_draw.c

index 191cd70a53a950e36f8deaa91d7494d055faf1c4..27e603b574528e8f82de6d3a9d7fa597b70cce86 100644 (file)
@@ -18,7 +18,7 @@
 
 cvar_t scr_viewsize = {CF_CLIENT | CF_ARCHIVE, "viewsize","100", "how large the view should be, 110 disables inventory bar, 120 disables status bar"};
 cvar_t scr_fov = {CF_CLIENT | CF_ARCHIVE, "fov","90", "field of vision, 1-170 degrees, default 90, some players use 110-130"};
-cvar_t scr_conalpha = {CF_CLIENT | CF_ARCHIVE, "scr_conalpha", "1", "opacity of console background gfx/conback"};
+cvar_t scr_conalpha = {CF_CLIENT | CF_ARCHIVE, "scr_conalpha", "0.9", "opacity of console background gfx/conback (when console isn't forced fullscreen)"};
 cvar_t scr_conalphafactor = {CF_CLIENT | CF_ARCHIVE, "scr_conalphafactor", "1", "opacity of console background gfx/conback relative to scr_conalpha; when 0, gfx/conback is not drawn"};
 cvar_t scr_conalpha2factor = {CF_CLIENT | CF_ARCHIVE, "scr_conalpha2factor", "0", "opacity of console background gfx/conback2 relative to scr_conalpha; when 0, gfx/conback2 is not drawn"};
 cvar_t scr_conalpha3factor = {CF_CLIENT | CF_ARCHIVE, "scr_conalpha3factor", "0", "opacity of console background gfx/conback3 relative to scr_conalpha; when 0, gfx/conback3 is not drawn"};
@@ -744,10 +744,10 @@ void SCR_DrawConsole (void)
        if (key_consoleactive & KEY_CONSOLEACTIVE_FORCED)
        {
                // full screen
-               Con_DrawConsole (vid_conheight.integer - scr_con_margin_bottom);
+               Con_DrawConsole (vid_conheight.integer - scr_con_margin_bottom, true);
        }
        else if (scr_con_current)
-               Con_DrawConsole (min(scr_con_current, vid_conheight.integer - scr_con_margin_bottom));
+               Con_DrawConsole (min(scr_con_current, vid_conheight.integer - scr_con_margin_bottom), false);
        else
                con_vislines = 0;
 }
index 21782f7f439e1edbb6db6a99fd9bf821cd492db0..a33264c19affe9e785083dde3b0aa96cd066f266 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1975,7 +1975,7 @@ Draws the console with the solid background
 The typing input line at the bottom should only be drawn if typing is allowed
 ================
 */
-void Con_DrawConsole (int lines)
+void Con_DrawConsole (int lines, qbool forcedfullscreen)
 {
        float alpha, alpha0;
        double sx, sy;
@@ -1997,7 +1997,7 @@ void Con_DrawConsole (int lines)
        r_draw2d_force = true;
 
 // draw the background
-       alpha0 = cls.signon == SIGNONS ? scr_conalpha.value : 1.0f; // always full alpha when not in game
+       alpha0 = forcedfullscreen ? 1.0f : scr_conalpha.value; // always full alpha when not forced fullscreen
        if((alpha = alpha0 * scr_conalphafactor.value) > 0)
        {
                sx = scr_conscroll_x.value;
index 10da88f0866f236122abef253d6c4b36a499ed12..8eaabbe2b84803a79cd95f1f2afd2f878438c2cb 100644 (file)
--- a/console.h
+++ b/console.h
@@ -43,7 +43,7 @@ void Con_CheckResize (void);
 void Con_Init (void);
 void Con_Init_Commands (void);
 void Con_Shutdown (void);
-void Con_DrawConsole (int lines);
+void Con_DrawConsole (int lines, qbool forcedfullscreen);
 
 /// Prints to a chosen console target
 void Con_MaskPrint(unsigned additionalmask, const char *msg);
index 8eaf3932a91b859ab6600c0ade017c4ec9c17984..3eb4c131c9b2dce2c27089634d7bb2bef4aec17a 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -51,8 +51,8 @@ dp_fonts_t dp_fonts;
 static mempool_t *fonts_mempool = NULL;
 
 cvar_t r_textshadow = {CF_CLIENT | CF_ARCHIVE, "r_textshadow", "0", "draws a shadow on all text to improve readability (note: value controls offset, 1 = 1 pixel, 1.5 = 1.5 pixels, etc)"};
-cvar_t r_textbrightness = {CF_CLIENT | CF_ARCHIVE, "r_textbrightness", "0", "additional brightness for text color codes (0 keeps colors as is, 1 makes them all white)"};
-cvar_t r_textcontrast = {CF_CLIENT | CF_ARCHIVE, "r_textcontrast", "1", "additional contrast for text color codes (1 keeps colors as is, 0 makes them all black)"};
+cvar_t r_textbrightness = {CF_CLIENT | CF_ARCHIVE, "r_textbrightness", "0.25", "additional brightness for text color codes (0 keeps colors as is, 1 makes them all white)"};
+cvar_t r_textcontrast = {CF_CLIENT | CF_ARCHIVE, "r_textcontrast", "1.25", "additional contrast for text color codes (1 keeps colors as is, 0 makes them all black)"};
 
 cvar_t r_font_postprocess_blur = {CF_CLIENT | CF_ARCHIVE, "r_font_postprocess_blur", "0", "font blur amount"};
 cvar_t r_font_postprocess_outline = {CF_CLIENT | CF_ARCHIVE, "r_font_postprocess_outline", "0", "font outline amount"};