Software: Make constants char_width and char_height private in RasterFont

This commit is contained in:
Lioncash
2014-08-10 20:48:28 -04:00
parent a141819241
commit b050657322
2 changed files with 9 additions and 9 deletions

View File

@ -161,7 +161,7 @@ void RasterFont::printString(const char *s, double x, double y, double z)
void RasterFont::printCenteredString(const char *s, double y, int screen_width, double z)
{
int length = (int)strlen(s);
int x = (int)(screen_width/2.0 - (length/2.0)*char_width);
int x = (int)(screen_width/2.0 - (length/2.0) * CHAR_WIDTH);
printString(s, x, y, z);
}
@ -177,7 +177,7 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
{
*t = 0;
printString(temp, x, y, z);
y -= char_height * 2.0f / bbHeight;
y -= CHAR_HEIGHT * 2.0f / bbHeight;
x = start_x;
t = temp;
}
@ -187,12 +187,12 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
}
else if (*text == '\t')
{
//todo: add tabs every something like 4*char_width
//todo: add tabs every something like 4 * CHAR_WIDTH
*t = 0;
int cpos = (int)strlen(temp);
int newpos = (cpos + 4) & (~3);
printString(temp, x, y, z);
x = start_x + (char_width*newpos) * 2.0f / bbWidth;
x = start_x + (CHAR_WIDTH * newpos) * 2.0f / bbWidth;
t = temp;
*t++ = ' ';
}