Create V_DrawRightAlignedSmallStringAtFixed() for new "small-fixed-right" option in v.drawString()

This commit is contained in:
GoldenTails 2019-09-09 19:49:04 -05:00
parent f7085fc171
commit 5f56d19a43
3 changed files with 13 additions and 0 deletions

View file

@ -117,6 +117,7 @@ enum align {
align_fixedright,
align_small,
align_smallfixed,
align_smallfixedright,
align_smallcenter,
align_smallright,
align_smallthin,
@ -136,6 +137,7 @@ static const char *const align_opt[] = {
"fixed-right",
"small",
"small-fixed",
"small-fixed-right",
"small-center",
"small-right",
"small-thin",
@ -760,6 +762,9 @@ static int libd_drawString(lua_State *L)
case align_smallfixed:
V_DrawSmallStringAtFixed(x, y, flags, str);
break;
case align_smallfixedright:
V_DrawRightAlignedSmallStringAtFixed(x, y, flags, str);
break;
case align_smallcenter:
V_DrawCenteredSmallString(x, y, flags, str);
break;

View file

@ -2746,6 +2746,12 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st
}
}
void V_DrawRightAlignedSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
{
x -= V_SmallStringWidth(string, option)<<FRACBITS;
V_DrawSmallStringAtFixed(x, y, option, string);
}
// Draws a thin string at a fixed_t location.
void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
{

View file

@ -221,7 +221,9 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
// draw a string using the hu_font at fixed_t coordinates, 0.5x scale
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
void V_DrawRightAlignedSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
// draw a string using the tny_font at fixed_t coordinates
void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);