Skip to content

Commit

Permalink
Refactor: Dropped the "initial count" argument from the font renderer's
Browse files Browse the repository at this point in the history
draw-text-fragment argument list. Callers should not be manipulating
this value; the engine will do so according to the current state of
each text object come render time.
  • Loading branch information
danij-deng committed Jun 12, 2011
1 parent afd697f commit df9171f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
2 changes: 0 additions & 2 deletions doomsday/engine/api/dd_bitmapfont.h
Expand Up @@ -117,11 +117,9 @@ int FR_TextHeight(const char* string, fontid_t defFont);
*/
void FR_DrawTextFragment(const char* string, int x, int y);
void FR_DrawTextFragment2(const char* string, int x, int y, short flags);
void FR_DrawTextFragment3(const char* string, int x, int y, short flags, int initialCount);

// Utility routines:
void FR_TextFragmentDimensions(int* width, int* height, const char* string);

int FR_TextFragmentWidth(const char* string);
int FR_TextFragmentHeight(const char* string);

Expand Down
3 changes: 1 addition & 2 deletions doomsday/engine/api/doomsday.def
@@ -1,7 +1,7 @@
; Doomsday Engine API (Routines exported from Doomsday.exe).
;
; Highest ordinal is currently: --> 515 <--
; Other free ordinals: 200
; Other free ordinals: 121 200

NAME "DOOMSDAY"
EXPORTS
Expand Down Expand Up @@ -521,7 +521,6 @@ EXPORTS

FR_DrawTextFragment @118 NONAME
FR_DrawTextFragment2 @120 NONAME
FR_DrawTextFragment3 @121 NONAME

FR_DrawChar @202 NONAME
FR_DrawChar2 @203 NONAME
Expand Down
12 changes: 3 additions & 9 deletions doomsday/engine/portable/src/gl_font.c
Expand Up @@ -797,8 +797,7 @@ static void drawTextFragment(const char* string, int x, int y, short flags,
}
}

void FR_DrawTextFragment3(const char* string, int x, int y, short flags,
int initialCount)
void FR_DrawTextFragment2(const char* string, int x, int y, short flags)
{
if(!inited)
Con_Error("Bitmap font system not yet initialized.");
Expand All @@ -816,12 +815,7 @@ void FR_DrawTextFragment3(const char* string, int x, int y, short flags,
#endif
return;
}
drawTextFragment(string, x, y, flags, initialCount);
}

void FR_DrawTextFragment2(const char* string, int x, int y, short flags)
{
FR_DrawTextFragment3(string, x, y, flags, DEFAULT_INITIALCOUNT);
drawTextFragment(string, x, y, flags, DEFAULT_INITIALCOUNT);
}

void FR_DrawTextFragment(const char* string, int x, int y)
Expand Down Expand Up @@ -1365,7 +1359,7 @@ void FR_DrawText(const char* inString, int x, int y, fontid_t defFont,

// Draw it.
glColor4fv(state.color);
FR_DrawTextFragment3(temp, 0, 0, fragmentFlags, state.typeIn ? (int) charCount : 0);
drawTextFragment(temp, 0, 0, fragmentFlags, state.typeIn ? (int) charCount : DEFAULT_INITIALCOUNT);
charCount += strlen(temp);

// Advance the current position?
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/ui_main.c
Expand Up @@ -1881,7 +1881,7 @@ void UI_TextOutEx2(const char* text, int x, int y, ui_color_t* color, float alph
alpha *= uiAlpha;
if(alpha <= 0) return;
UI_SetColorA(color, alpha);
FR_DrawTextFragment3(text, x, y, flags, DEFAULT_INITIALCOUNT);
FR_DrawTextFragment2(text, x, y, flags);
}

void UI_TextOutEx(const char* text, int x, int y, ui_color_t* color, float alpha)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/hu_lib.c
Expand Up @@ -570,7 +570,7 @@ void MN_DrawText2(const char* string, int x, int y, short flags)
if(NULL == string || !string[0]) return;

flags = MN_MergeMenuEffectWithDrawTextFlags(flags);
FR_DrawTextFragment3(string, x, y, flags, 0);
FR_DrawTextFragment2(string, x, y, flags);
}

void MN_DrawText(const char* string, int x, int y)
Expand Down

0 comments on commit df9171f

Please sign in to comment.