mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Create V_DrawRightAlignedStringAtFixed() for new "fixed-right" option in v.drawString()
This commit is contained in:
parent
426ccc9203
commit
dc1871a74f
3 changed files with 14 additions and 0 deletions
|
@ -113,6 +113,7 @@ enum align {
|
|||
align_center,
|
||||
align_right,
|
||||
align_fixed,
|
||||
align_fixedright,
|
||||
align_small,
|
||||
align_smallfixed,
|
||||
align_smallcenter,
|
||||
|
@ -127,6 +128,7 @@ static const char *const align_opt[] = {
|
|||
"center",
|
||||
"right",
|
||||
"fixed",
|
||||
"fixed-right",
|
||||
"small",
|
||||
"small-fixed",
|
||||
"small-center",
|
||||
|
@ -737,6 +739,9 @@ static int libd_drawString(lua_State *L)
|
|||
case align_fixed:
|
||||
V_DrawStringAtFixed(x, y, flags, str);
|
||||
break;
|
||||
case align_fixedright:
|
||||
V_DrawRightAlignedStringAtFixed(x, y, flags, str);
|
||||
break;
|
||||
// hu_font, 0.5x scale
|
||||
case align_small:
|
||||
V_DrawSmallString(x, y, flags, str);
|
||||
|
|
|
@ -2524,6 +2524,12 @@ void V_DrawStringAtFixed(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)
|
||||
{
|
||||
x -= V_StringWidth(string, option)<<FRACBITS;
|
||||
V_DrawStringAtFixed(x, y, option, string);
|
||||
}
|
||||
|
||||
// Draws a small string at a fixed_t location.
|
||||
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
|
|
|
@ -213,7 +213,10 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
|||
void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the hu_font at fixed_t coordinates
|
||||
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedStringAtFixed(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
|
|
Loading…
Reference in a new issue