diff options
Diffstat (limited to 'src/renderer/Font.h')
-rw-r--r-- | src/renderer/Font.h | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/src/renderer/Font.h b/src/renderer/Font.h index 9316ed34..02e7df3b 100644 --- a/src/renderer/Font.h +++ b/src/renderer/Font.h @@ -6,6 +6,7 @@ void AsciiToUnicode(const char *src, wchar *dst); void UnicodeStrcpy(wchar *dst, const wchar *src); void UnicodeStrcat(wchar *dst, wchar *append); int UnicodeStrlen(const wchar *str); +void UnicodeMakeUpperCase(wchar *dst, const wchar *src); struct CFontDetails { @@ -21,27 +22,54 @@ struct CFontDetails bool8 background; bool8 backgroundOnlyText; bool8 proportional; + bool8 bIsShadow; + bool8 bFlash; + bool8 bBold; float alphaFade; CRGBA backgroundColor; float wrapX; float centreSize; float rightJustifyWrap; int16 style; - int32 bank; + bool8 bFontHalfTexture; + uint32 bank; int16 dropShadowPosition; CRGBA dropColor; + bool8 bFlashState; + int nFlashTimer; + bool8 anonymous_23; + uint32 anonymous_25; +}; + +struct CFontRenderState +{ + uint32 anonymous_0; + float fTextPosX; + float fTextPosY; + float scaleX; + float scaleY; + CRGBA color; + float fExtraSpace; + float slant; + float slantRefX; + float slantRefY; + bool8 bIsShadow; + bool8 bFontHalfTexture; + bool8 proportional; + bool8 anonymous_14; + int16 style; }; class CSprite2d; enum { FONT_BANK, - FONT_PAGER, + FONT_STANDARD, FONT_HEADING, #ifdef MORE_LANGUAGES FONT_JAPANESE, #endif - MAX_FONTS + MAX_FONTS = FONT_HEADING }; enum { @@ -69,12 +97,10 @@ enum enum { BUTTON_NONE = -1, -#if 0 // unused BUTTON_UP, BUTTON_DOWN, BUTTON_LEFT, BUTTON_RIGHT, -#endif BUTTON_CROSS, BUTTON_CIRCLE, BUTTON_SQUARE, @@ -85,6 +111,10 @@ enum BUTTON_R1, BUTTON_R2, BUTTON_R3, + BUTTON_RSTICK_UP, + BUTTON_RSTICK_DOWN, + BUTTON_RSTICK_LEFT, + BUTTON_RSTICK_RIGHT, MAX_BUTTON_ICONS }; #endif // BUTTON_ICONS @@ -93,22 +123,23 @@ enum class CFont { #ifdef MORE_LANGUAGES - static int16 Size[LANGSET_MAX][MAX_FONTS][193]; + static int16 Size[LANGSET_MAX][MAX_FONTS][210]; static uint8 LanguageSet; static int32 Slot; #else - static int16 Size[MAX_FONTS][193]; + static int16 Size[MAX_FONTS][210]; #endif static bool16 NewLine; public: static CSprite2d Sprite[MAX_FONTS]; static CFontDetails Details; + static CFontRenderState RenderState; #ifdef BUTTON_ICONS static int32 ButtonsSlot; static CSprite2d ButtonSprite[MAX_BUTTON_ICONS]; static int PS2Symbol; - + static void LoadButtons(const char *txdPath); static void DrawButton(float x, float y); #endif // BUTTON_ICONS @@ -119,17 +150,18 @@ public: static void InitPerFrame(void); static void PrintChar(float x, float y, wchar c); static void PrintString(float x, float y, wchar *s); - static void PrintStringFromBottom(float x, float y, wchar *str); #ifdef XBOX_SUBTITLES + static void PrintStringFromBottom(float x, float y, wchar *str); static void PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor); #endif static int GetNumberLines(float xstart, float ystart, wchar *s); static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s); -#ifdef MORE_LANGUAGES - static bool PrintString(float x, float y, wchar *start, wchar* &end, float spwidth, float japX); -#else - static void PrintString(float x, float y, wchar *start, wchar *end, float spwidth); -#endif +//#ifdef MORE_LANGUAGES +// static bool PrintString(float x, float y, wchar *start, wchar* &end, float spwidth, float japX); +//#else + static void PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth); +//#endif + static void PrintStringFromBottom(float x, float y, wchar *str); static float GetCharacterWidth(wchar c); static float GetCharacterSize(wchar c); static float GetStringWidth(wchar *s, bool spaces = false); @@ -137,12 +169,14 @@ public: static float GetStringWidth_Jap(wchar* s); #endif static uint16 *GetNextSpace(wchar *s); -#ifdef MORE_LANGUAGES - static uint16 *ParseToken(wchar *s, wchar*, bool japShit = false); -#else - static uint16 *ParseToken(wchar *s, wchar*); -#endif +//#ifdef MORE_LANGUAGES +// static uint16 *ParseToken(wchar *s, bool japShit = false); +//#else + static uint16 *ParseToken(wchar *s); + static uint16 *ParseToken(wchar *s, CRGBA &color, bool &flash, bool &bold); +//#endif static void DrawFonts(void); + static void RenderFontBuffer(void); static uint16 character_code(uint8 c); static void SetScale(float x, float y); @@ -169,7 +203,8 @@ public: static void SetBackgroundColor(CRGBA col); static void SetColor(CRGBA col); static void SetDropColor(CRGBA col); - + static wchar FindNewCharacter(wchar c); + static void FilterOutTokensFromString(wchar*); #ifdef MORE_LANGUAGES static void ReloadFonts(uint8 set); @@ -177,6 +212,6 @@ public: static bool IsAnsiCharacter(wchar* s); static bool IsJapanesePunctuation(wchar* str); static bool IsJapanese() { return LanguageSet == FONT_LANGSET_JAPANESE; } - static bool IsJapaneseFont() { return IsJapanese() && (Details.style == FONT_JAPANESE || Details.style == FONT_PAGER); } + static bool IsJapaneseFont() { return IsJapanese() && (Details.style == FONT_JAPANESE); } #endif }; |