mirror of https://github.com/OpenTTD/OpenTTD
(svn r5967) -Change: use right alignment for the year in the player's balance window instead of centering (about) 'string width' / 2 from the right edge
parent
5890ea5a71
commit
0c3093b25f
14
gfx.c
14
gfx.c
|
@ -352,12 +352,16 @@ int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawStringRightAligned(int x, int y, StringID str, uint16 color)
|
int DrawStringRightAligned(int x, int y, StringID str, uint16 color)
|
||||||
{
|
{
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
|
int w;
|
||||||
|
|
||||||
GetString(buffer, str);
|
GetString(buffer, str);
|
||||||
DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
|
w = GetStringWidth(buffer);
|
||||||
|
DoDrawString(buffer, x - w, y, color);
|
||||||
|
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw)
|
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw)
|
||||||
|
@ -368,6 +372,12 @@ void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, u
|
||||||
DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
|
DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color)
|
||||||
|
{
|
||||||
|
int w = DrawStringRightAligned(x, y, str, color);
|
||||||
|
GfxFillRect(x - w, y + 10, x, y + 10, _string_colorremap[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int DrawStringCentered(int x, int y, StringID str, uint16 color)
|
int DrawStringCentered(int x, int y, StringID str, uint16 color)
|
||||||
{
|
{
|
||||||
|
|
3
gfx.h
3
gfx.h
|
@ -67,8 +67,9 @@ int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw
|
||||||
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
|
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
|
||||||
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
|
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
|
||||||
|
|
||||||
void DrawStringRightAligned(int x, int y, StringID str, uint16 color);
|
int DrawStringRightAligned(int x, int y, StringID str, uint16 color);
|
||||||
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
|
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
|
||||||
|
void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color);
|
||||||
|
|
||||||
void GfxFillRect(int left, int top, int right, int bottom, int color);
|
void GfxFillRect(int left, int top, int right, int bottom, int color);
|
||||||
void GfxDrawLine(int left, int top, int right, int bottom, int color);
|
void GfxDrawLine(int left, int top, int right, int bottom, int color);
|
||||||
|
|
|
@ -48,7 +48,7 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
|
||||||
do {
|
do {
|
||||||
if (year >= BASE_YEAR + p->inaugurated_year) {
|
if (year >= BASE_YEAR + p->inaugurated_year) {
|
||||||
SetDParam(0, year);
|
SetDParam(0, year);
|
||||||
DrawStringCenterUnderline(x-17, 15, STR_7010, 0);
|
DrawStringRightAlignedUnderline(x, 15, STR_7010, 0);
|
||||||
sum = 0;
|
sum = 0;
|
||||||
for (i = 0; i != 13; i++) {
|
for (i = 0; i != 13; i++) {
|
||||||
/* draw one row in the price column */
|
/* draw one row in the price column */
|
||||||
|
|
Loading…
Reference in New Issue