Console: use CTRL_+ and CTRL_- to change font size

This commit is contained in:
James R 2024-02-27 06:26:06 -08:00
parent b7652413e5
commit 90361d703d

View file

@ -895,6 +895,31 @@ static void CON_InputDelChar(void)
// ----
//
static void AdjustTextSize(INT32 n)
{
INT32 range = max(vid.dupx, vid.dupy);
if (range < 3) // make bigger jumps if the resolution is small
n *= 4 - range;
// 1-3 ascending is larger
// but 0 is special and is the largest
INT32 cur = (cv_constextsize.value & V_SCALEPATCHMASK) >> V_SCALEPATCHSHIFT;
if (!cur) // reverse direction at 0
{
if (n < 0)
cur = 4 + n;
else
return;
}
else
cur += n;
if (cur < 1) // min: V_NOSCALEPATCH
cur = 1;
if (cur > 4) // max: 4 & 3 = 0
cur = 4;
CV_SetValue(&cv_constextsize, (cur << V_SCALEPATCHSHIFT) & V_SCALEPATCHMASK);
}
// Handles console key input
//
boolean CON_Responder(event_t *ev)
@ -1138,6 +1163,18 @@ boolean CON_Responder(event_t *ev)
return true;
}
// Zoom
if (key == '=')
{
AdjustTextSize(1);
return true;
}
else if (key == '-')
{
AdjustTextSize(-1);
return true;
}
// ...why shouldn't it eat the key? if it doesn't, it just means you
// can control Sonic from the console, which is silly
return true;//return false;