mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
Fix incorrect positioning of centered strings when scaling is applied.
This partially address issue #87.
This commit is contained in:
parent
0a8d332da2
commit
fc33d5df64
1 changed files with 6 additions and 4 deletions
|
@ -253,6 +253,8 @@ SCR_DrawCenterString(void)
|
||||||
int x, y;
|
int x, y;
|
||||||
int remaining;
|
int remaining;
|
||||||
float scale;
|
float scale;
|
||||||
|
const int char_unscaled_width = 8;
|
||||||
|
const int char_unscaled_height = 8;
|
||||||
|
|
||||||
/* the finale prints the characters one at a time */
|
/* the finale prints the characters one at a time */
|
||||||
remaining = 9999;
|
remaining = 9999;
|
||||||
|
@ -282,10 +284,10 @@ SCR_DrawCenterString(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x = ((viddef.width - l * 8) / 2) / scale;
|
x = ((viddef.width / scale) - (l * char_unscaled_width)) / 2;
|
||||||
SCR_AddDirtyPoint(x, y);
|
SCR_AddDirtyPoint(x, y);
|
||||||
|
|
||||||
for (j = 0; j < l; j++, x += 8)
|
for (j = 0; j < l; j++, x += char_unscaled_width)
|
||||||
{
|
{
|
||||||
Draw_CharScaled(x * scale, y * scale, start[j], scale);
|
Draw_CharScaled(x * scale, y * scale, start[j], scale);
|
||||||
|
|
||||||
|
@ -295,9 +297,9 @@ SCR_DrawCenterString(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCR_AddDirtyPoint(x, y + 8);
|
SCR_AddDirtyPoint(x, y + char_unscaled_height);
|
||||||
|
|
||||||
y += 8;
|
y += char_unscaled_height;
|
||||||
|
|
||||||
while (*start && *start != '\n')
|
while (*start && *start != '\n')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue