(svn r15785) -Codechange: remove the *Truncated part of the old text drawing API.

This commit is contained in:
rubidium
2009-03-21 20:12:12 +00:00
parent 9fcff01850
commit 45f189fdca
20 changed files with 67 additions and 153 deletions

View File

@@ -483,20 +483,6 @@ int DrawString(int left, int right, int top, StringID str, TextColour colour, St
return DrawString(left, right, top, buffer, lastof(buffer), colour, align, underline);
}
/**
* Draw string, possibly truncated to make it fit in its allocated space
*
* @param x X position to start drawing
* @param y Y position to start drawing
* @param str String to draw
* @param colour Colour used for drawing the string, see DoDrawString() for details
* @param maxw Maximal width of the string
*/
int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
{
return DrawString(x, x + maxw, y, str, colour, SA_LEFT, false);
}
/**
* Draw string right-aligned.
*
@@ -510,20 +496,6 @@ int DrawStringRightAligned(int x, int y, StringID str, TextColour colour)
return DrawString(0, x, y, str, colour, SA_RIGHT, false);
}
/**
* Draw string right-aligned, possibly truncated to make it fit in its allocated space
*
* @param x Right-most x position to start drawing
* @param y Y position to start drawing
* @param str String to draw
* @param colour Colour used for drawing the string, see DoDrawString() for details
* @param maxw Maximal width of the string
*/
int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
{
return DrawString(x - maxw, x, y, str, colour, SA_RIGHT, false);
}
/**
* Draw string right-aligned with a line underneath it.
*
@@ -553,22 +525,6 @@ int DrawStringCentered(int x, int y, StringID str, TextColour colour)
return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, SA_CENTER);
}
/**
* Draw string centered, possibly truncated to fit in the assigned space.
*
* @param xl Left-most x position
* @param xr Right-most x position
* @param y Y position of the string
* @param str String to draw
* @param colour Colour used for drawing the string, see DoDrawString() for details
*
* @return Width of the drawn string in pixels
*/
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, TextColour colour)
{
return DrawString(xl, xr, y, str, colour, SA_CENTER, false);
}
/**
* Draw string centered.
*
@@ -602,20 +558,6 @@ int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour)
return DrawString(x - w, y + w, y, buffer, lastof(buffer), colour, SA_CENTER, true);
}
/**
* Draw string centered possibly truncated, with additional line underneath it
*
* @param xl Left x position of the string
* @param xr Right x position of the string
* @param y Y position of center of the string
* @param str String to draw
* @param colour Colour used for drawing the string, see DoDrawString() for details
*/
int DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour)
{
return DrawString(xl, xr, y, str, colour, SA_CENTER, true);
}
/**
* 'Correct' a string to a maximum length. Longer strings will be cut into
* additional lines at whitespace characters if possible. The string parameter
@@ -1007,26 +949,6 @@ skip_cont:;
}
}
/**
* Draw the string of the character buffer, starting at position (x,y) with a given maximal width.
* String is truncated if it is too long.
*
* @param str Character buffer containing the string
* @param x Left-most x coordinate to start drawing
* @param y Y coordinate to draw the string
* @param colour Colour to use, see DoDrawString() for details.
* @param maxw Maximal width in pixels that may be used for drawing
*
* @return Right-most x position after drawing the (possibly truncated) string
*/
int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw)
{
char buffer[DRAW_STRING_BUFFER];
strecpy(buffer, str, lastof(buffer));
TruncateString(buffer, maxw);
return DoDrawString(buffer, x, y, colour);
}
/**
* Draw a sprite.
* @param img Image number to draw