* Rename iV_DrawText to iV_DrawTextRotated and create a static inline function iV_DrawText which calls iV_DrawTextRotated with rotation=0.f
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2480 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
1d877d50cd
commit
a8bfacf6ed
|
@ -51,7 +51,11 @@ enum {
|
||||||
|
|
||||||
extern UDWORD iV_DrawFormattedText(const char* String, UDWORD x, UDWORD y, UDWORD Width, UDWORD Justify);
|
extern UDWORD iV_DrawFormattedText(const char* String, UDWORD x, UDWORD y, UDWORD Width, UDWORD Justify);
|
||||||
|
|
||||||
extern void iV_DrawText(const char* string, UDWORD x, UDWORD y);
|
extern void iV_DrawTextRotated(const char* string, float x, float y, float rotation);
|
||||||
extern void iV_DrawTextRotated(const char* string, unsigned int XPos, unsigned int YPos, float rotation);
|
|
||||||
|
static inline void iV_DrawText(const char* string, float x, float y)
|
||||||
|
{
|
||||||
|
iV_DrawTextRotated(string, x, y, 0.f);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // _INCLUDED_TEXTDRAW_
|
#endif // _INCLUDED_TEXTDRAW_
|
||||||
|
|
|
@ -401,14 +401,18 @@ UDWORD iV_DrawFormattedText(const char* String, UDWORD x, UDWORD y, UDWORD Width
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void iV_DrawText(const char *string, UDWORD x, UDWORD y)
|
void iV_DrawTextRotated(const char* string, float x, float y, float rotation)
|
||||||
{
|
{
|
||||||
IVIS_FONT *Font = &iVFonts[ActiveFontID];
|
IVIS_FONT *Font = &iVFonts[ActiveFontID];
|
||||||
|
|
||||||
|
// Move to the correct position and rotation for text rendering
|
||||||
|
glTranslatef(x, y, 0.f);
|
||||||
|
glRotatef(rotation, 0.f, 0.f, 1.f);
|
||||||
|
|
||||||
/* Colour selection */
|
/* Colour selection */
|
||||||
pie_BeginTextRender(Font->FontColourIndex);
|
pie_BeginTextRender(Font->FontColourIndex);
|
||||||
|
|
||||||
for (; *string != 0; ++string)
|
for (unsigned int curX = 0; *string != 0; ++string)
|
||||||
{
|
{
|
||||||
unsigned int Index = (unsigned char)*string;
|
unsigned int Index = (unsigned char)*string;
|
||||||
UWORD ImageID;
|
UWORD ImageID;
|
||||||
|
@ -436,7 +440,7 @@ void iV_DrawText(const char *string, UDWORD x, UDWORD y)
|
||||||
}
|
}
|
||||||
else if (Index == ASCII_SPACE)
|
else if (Index == ASCII_SPACE)
|
||||||
{
|
{
|
||||||
x += Font->FontSpaceSize;
|
curX += Font->FontSpaceSize;
|
||||||
|
|
||||||
// Don't draw this character
|
// Don't draw this character
|
||||||
continue;
|
continue;
|
||||||
|
@ -444,21 +448,11 @@ void iV_DrawText(const char *string, UDWORD x, UDWORD y)
|
||||||
|
|
||||||
// Draw the character
|
// Draw the character
|
||||||
ImageID = Font->AsciiTable[Index];
|
ImageID = Font->AsciiTable[Index];
|
||||||
pie_TextRender(Font->FontFile, ImageID, x, y);
|
pie_TextRender(Font->FontFile, ImageID, curX, 0);
|
||||||
|
|
||||||
// Advance the drawing position
|
// Advance the drawing position
|
||||||
x += iV_GetImageWidth(Font->FontFile, ImageID) + 1;
|
curX += iV_GetImageWidth(Font->FontFile, ImageID) + 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void iV_DrawTextRotated(const char* string, unsigned int XPos, unsigned int YPos, float rotation)
|
|
||||||
{
|
|
||||||
glTranslatef((float)XPos, (float)YPos, 0.f);
|
|
||||||
glRotatef(rotation, 0.f, 0.f, 1.f);
|
|
||||||
|
|
||||||
// Now call iV_DrawText at position (0,0) of the translated matrix
|
|
||||||
iV_DrawText(string, 0, 0);
|
|
||||||
|
|
||||||
// Reset the tranlation matrix
|
// Reset the tranlation matrix
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
Loading…
Reference in New Issue