mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 17:22:12 +00:00
Create V_DrawCenteredSmallString() for new "small-center" option in v.drawString()
This commit is contained in:
parent
37cef69c95
commit
df15ad82d2
3 changed files with 13 additions and 0 deletions
|
@ -115,6 +115,7 @@ enum align {
|
||||||
align_fixed,
|
align_fixed,
|
||||||
align_small,
|
align_small,
|
||||||
align_smallfixed,
|
align_smallfixed,
|
||||||
|
align_smallcenter,
|
||||||
align_smallright,
|
align_smallright,
|
||||||
align_thin,
|
align_thin,
|
||||||
align_thinfixed,
|
align_thinfixed,
|
||||||
|
@ -127,6 +128,7 @@ static const char *const align_opt[] = {
|
||||||
"fixed",
|
"fixed",
|
||||||
"small",
|
"small",
|
||||||
"small-fixed",
|
"small-fixed",
|
||||||
|
"small-center",
|
||||||
"small-right",
|
"small-right",
|
||||||
"thin",
|
"thin",
|
||||||
"thin-fixed",
|
"thin-fixed",
|
||||||
|
@ -740,6 +742,9 @@ static int libd_drawString(lua_State *L)
|
||||||
case align_smallfixed:
|
case align_smallfixed:
|
||||||
V_DrawSmallStringAtFixed(x, y, flags, str);
|
V_DrawSmallStringAtFixed(x, y, flags, str);
|
||||||
break;
|
break;
|
||||||
|
case align_smallcenter:
|
||||||
|
V_DrawCenteredSmallString(x, y, flags, str);
|
||||||
|
break;
|
||||||
case align_smallright:
|
case align_smallright:
|
||||||
V_DrawRightAlignedSmallString(x, y, flags, str);
|
V_DrawRightAlignedSmallString(x, y, flags, str);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2299,6 +2299,13 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
|
{
|
||||||
|
x -= V_SmallStringWidth(string, option)/2;
|
||||||
|
V_DrawSmallString(x, y, option, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
{
|
{
|
||||||
x -= V_SmallStringWidth(string, option);
|
x -= V_SmallStringWidth(string, option);
|
||||||
|
|
|
@ -205,6 +205,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
|
||||||
|
|
||||||
// draw a string using the hu_font, 0.5x scale
|
// draw a string using the hu_font, 0.5x scale
|
||||||
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||||
|
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||||
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||||
|
|
||||||
// draw a string using the tny_font
|
// draw a string using the tny_font
|
||||||
|
|
Loading…
Reference in a new issue