mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 15:22:08 +00:00
Scale the console itself as specified by con_scaletext
This commit is contained in:
parent
6414e01354
commit
d2f8fc63fc
2 changed files with 102 additions and 24 deletions
|
@ -846,9 +846,13 @@ void C_DrawConsole (bool hw2d)
|
||||||
static int oldbottom = 0;
|
static int oldbottom = 0;
|
||||||
int lines, left, offset;
|
int lines, left, offset;
|
||||||
|
|
||||||
|
int textScale = con_uiscale();
|
||||||
|
if (textScale == 0)
|
||||||
|
textScale = CleanXfac;
|
||||||
|
|
||||||
left = LEFTMARGIN;
|
left = LEFTMARGIN;
|
||||||
lines = (ConBottom-ConFont->GetHeight()*2)/ConFont->GetHeight();
|
lines = (ConBottom/textScale-ConFont->GetHeight()*2)/ConFont->GetHeight();
|
||||||
if (-ConFont->GetHeight() + lines*ConFont->GetHeight() > ConBottom - ConFont->GetHeight()*7/2)
|
if (-ConFont->GetHeight() + lines*ConFont->GetHeight() > ConBottom/textScale - ConFont->GetHeight()*7/2)
|
||||||
{
|
{
|
||||||
offset = -ConFont->GetHeight()/2;
|
offset = -ConFont->GetHeight()/2;
|
||||||
lines--;
|
lines--;
|
||||||
|
@ -894,16 +898,26 @@ void C_DrawConsole (bool hw2d)
|
||||||
|
|
||||||
if (ConBottom >= 12)
|
if (ConBottom >= 12)
|
||||||
{
|
{
|
||||||
|
if (textScale == 1)
|
||||||
screen->DrawText (ConFont, CR_ORANGE, SCREENWIDTH - 8 -
|
screen->DrawText (ConFont, CR_ORANGE, SCREENWIDTH - 8 -
|
||||||
ConFont->StringWidth (GetVersionString()),
|
ConFont->StringWidth (GetVersionString()),
|
||||||
ConBottom - ConFont->GetHeight() - 4,
|
ConBottom / textScale - ConFont->GetHeight() - 4,
|
||||||
GetVersionString(), TAG_DONE);
|
GetVersionString(), TAG_DONE);
|
||||||
|
else
|
||||||
|
screen->DrawText(ConFont, CR_ORANGE, SCREENWIDTH / textScale - 8 -
|
||||||
|
ConFont->StringWidth(GetVersionString()),
|
||||||
|
ConBottom / textScale - ConFont->GetHeight() - 4,
|
||||||
|
GetVersionString(),
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
if (TickerMax)
|
if (TickerMax)
|
||||||
{
|
{
|
||||||
char tickstr[256];
|
char tickstr[256];
|
||||||
const int tickerY = ConBottom - ConFont->GetHeight() - 4;
|
const int tickerY = ConBottom / textScale - ConFont->GetHeight() - 4;
|
||||||
size_t i;
|
size_t i;
|
||||||
int tickend = ConCols - SCREENWIDTH / 90 - 6;
|
int tickend = ConCols / textScale - SCREENWIDTH / textScale / 90 - 6;
|
||||||
int tickbegin = 0;
|
int tickbegin = 0;
|
||||||
|
|
||||||
if (TickerLabel)
|
if (TickerLabel)
|
||||||
|
@ -926,11 +940,23 @@ void C_DrawConsole (bool hw2d)
|
||||||
{
|
{
|
||||||
tickstr[tickend+3] = 0;
|
tickstr[tickend+3] = 0;
|
||||||
}
|
}
|
||||||
|
if (textScale == 1)
|
||||||
screen->DrawText (ConFont, CR_BROWN, LEFTMARGIN, tickerY, tickstr, TAG_DONE);
|
screen->DrawText (ConFont, CR_BROWN, LEFTMARGIN, tickerY, tickstr, TAG_DONE);
|
||||||
|
else
|
||||||
|
screen->DrawText (ConFont, CR_BROWN, LEFTMARGIN, tickerY, tickstr,
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
// Draw the marker
|
// Draw the marker
|
||||||
i = LEFTMARGIN+5+tickbegin*8 + Scale (TickerAt, (SDWORD)(tickend - tickbegin)*8, TickerMax);
|
i = LEFTMARGIN+5+tickbegin*8 + Scale (TickerAt, (SDWORD)(tickend - tickbegin)*8, TickerMax);
|
||||||
|
if (textScale == 1)
|
||||||
screen->DrawChar (ConFont, CR_ORANGE, (int)i, tickerY, 0x13, TAG_DONE);
|
screen->DrawChar (ConFont, CR_ORANGE, (int)i, tickerY, 0x13, TAG_DONE);
|
||||||
|
else
|
||||||
|
screen->DrawChar(ConFont, CR_ORANGE, (int)i, tickerY, 0x13,
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
TickerVisible = true;
|
TickerVisible = true;
|
||||||
}
|
}
|
||||||
|
@ -966,19 +992,29 @@ void C_DrawConsole (bool hw2d)
|
||||||
if (lines > 0)
|
if (lines > 0)
|
||||||
{
|
{
|
||||||
// No more enqueuing because adding new text to the console won't touch the actual print data.
|
// No more enqueuing because adding new text to the console won't touch the actual print data.
|
||||||
conbuffer->FormatText(ConFont, ConWidth);
|
conbuffer->FormatText(ConFont, ConWidth / textScale);
|
||||||
unsigned int consolelines = conbuffer->GetFormattedLineCount();
|
unsigned int consolelines = conbuffer->GetFormattedLineCount();
|
||||||
FBrokenLines **blines = conbuffer->GetLines();
|
FBrokenLines **blines = conbuffer->GetLines();
|
||||||
FBrokenLines **printline = blines + consolelines - 1 - RowAdjust;
|
FBrokenLines **printline = blines + consolelines - 1 - RowAdjust;
|
||||||
|
|
||||||
int bottomline = ConBottom - ConFont->GetHeight()*2 - 4;
|
int bottomline = ConBottom / textScale - ConFont->GetHeight()*2 - 4;
|
||||||
|
|
||||||
ConsoleDrawing = true;
|
ConsoleDrawing = true;
|
||||||
|
|
||||||
for(FBrokenLines **p = printline; p >= blines && lines > 0; p--, lines--)
|
for(FBrokenLines **p = printline; p >= blines && lines > 0; p--, lines--)
|
||||||
|
{
|
||||||
|
if (textScale == 1)
|
||||||
{
|
{
|
||||||
screen->DrawText(ConFont, CR_TAN, LEFTMARGIN, offset + lines * ConFont->GetHeight(), (*p)->Text, TAG_DONE);
|
screen->DrawText(ConFont, CR_TAN, LEFTMARGIN, offset + lines * ConFont->GetHeight(), (*p)->Text, TAG_DONE);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screen->DrawText(ConFont, CR_TAN, LEFTMARGIN, offset + lines * ConFont->GetHeight(), (*p)->Text,
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ConsoleDrawing = false;
|
ConsoleDrawing = false;
|
||||||
|
|
||||||
|
@ -992,6 +1028,8 @@ void C_DrawConsole (bool hw2d)
|
||||||
FString command((char *)&CmdLine[2+CmdLine[259]]);
|
FString command((char *)&CmdLine[2+CmdLine[259]]);
|
||||||
int cursorpos = CmdLine[1] - CmdLine[259];
|
int cursorpos = CmdLine[1] - CmdLine[259];
|
||||||
|
|
||||||
|
if (textScale == 1)
|
||||||
|
{
|
||||||
screen->DrawChar(ConFont, CR_ORANGE, left, bottomline, '\x1c', TAG_DONE);
|
screen->DrawChar(ConFont, CR_ORANGE, left, bottomline, '\x1c', TAG_DONE);
|
||||||
screen->DrawText(ConFont, CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline,
|
screen->DrawText(ConFont, CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline,
|
||||||
command, TAG_DONE);
|
command, TAG_DONE);
|
||||||
|
@ -1002,11 +1040,40 @@ void C_DrawConsole (bool hw2d)
|
||||||
bottomline, '\xb', TAG_DONE);
|
bottomline, '\xb', TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screen->DrawChar(ConFont, CR_ORANGE, left, bottomline, '\x1c',
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
|
screen->DrawText(ConFont, CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline,
|
||||||
|
command,
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
|
if (cursoron)
|
||||||
|
{
|
||||||
|
screen->DrawChar(ConFont, CR_YELLOW, left + ConFont->GetCharWidth(0x1c) + cursorpos * ConFont->GetCharWidth(0xb),
|
||||||
|
bottomline, '\xb',
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (RowAdjust && ConBottom >= ConFont->GetHeight()*7/2)
|
if (RowAdjust && ConBottom >= ConFont->GetHeight()*7/2)
|
||||||
{
|
{
|
||||||
// Indicate that the view has been scrolled up (10)
|
// Indicate that the view has been scrolled up (10)
|
||||||
// and if we can scroll no further (12)
|
// and if we can scroll no further (12)
|
||||||
|
if (textScale == 1)
|
||||||
screen->DrawChar (ConFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, TAG_DONE);
|
screen->DrawChar (ConFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, TAG_DONE);
|
||||||
|
else
|
||||||
|
screen->DrawChar(ConFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10,
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
#include "r_data/voxels.h"
|
#include "r_data/voxels.h"
|
||||||
|
|
||||||
|
int con_uiscale();
|
||||||
|
|
||||||
FRenderer *Renderer;
|
FRenderer *Renderer;
|
||||||
|
|
||||||
|
@ -857,10 +858,20 @@ void DFrameBuffer::DrawRateStuff ()
|
||||||
int chars;
|
int chars;
|
||||||
int rate_x;
|
int rate_x;
|
||||||
|
|
||||||
|
int textScale = con_uiscale();
|
||||||
|
if (textScale == 0)
|
||||||
|
textScale = CleanXfac;
|
||||||
|
|
||||||
chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2u ms (%3u fps)", howlong, LastCount);
|
chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2u ms (%3u fps)", howlong, LastCount);
|
||||||
rate_x = Width - ConFont->StringWidth(&fpsbuff[0]);
|
rate_x = Width / textScale - ConFont->StringWidth(&fpsbuff[0]);
|
||||||
Clear (rate_x, 0, Width, ConFont->GetHeight(), GPalette.BlackIndex, 0);
|
Clear (rate_x * textScale, 0, Width, ConFont->GetHeight() * textScale, GPalette.BlackIndex, 0);
|
||||||
|
if (textScale == 1)
|
||||||
DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], TAG_DONE);
|
DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], TAG_DONE);
|
||||||
|
else
|
||||||
|
DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0],
|
||||||
|
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||||
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
DWORD thisSec = ms/1000;
|
DWORD thisSec = ms/1000;
|
||||||
if (LastSec < thisSec)
|
if (LastSec < thisSec)
|
||||||
|
|
Loading…
Reference in a new issue