summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-01-16 15:05:27 +0100
committerSergeanur <s.anureev@yandex.ua>2021-01-16 15:05:27 +0100
commitcaa7d3177c691a83ba3642737eb58c1fe5eb600f (patch)
tree2180837b05f7f333215cf851514ebc215e9d0419 /src/render
parentFix typo (diff)
downloadre3-caa7d3177c691a83ba3642737eb58c1fe5eb600f.tar
re3-caa7d3177c691a83ba3642737eb58c1fe5eb600f.tar.gz
re3-caa7d3177c691a83ba3642737eb58c1fe5eb600f.tar.bz2
re3-caa7d3177c691a83ba3642737eb58c1fe5eb600f.tar.lz
re3-caa7d3177c691a83ba3642737eb58c1fe5eb600f.tar.xz
re3-caa7d3177c691a83ba3642737eb58c1fe5eb600f.tar.zst
re3-caa7d3177c691a83ba3642737eb58c1fe5eb600f.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Font.cpp159
-rw-r--r--src/render/Font.h78
2 files changed, 172 insertions, 65 deletions
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index 8c183641..7eed0933 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -34,7 +34,7 @@ UnicodeStrlen(const wchar *str)
}
CFontDetails CFont::Details;
-int16 CFont::NewLine;
+bool16 CFont::NewLine;
CSprite2d CFont::Sprite[MAX_FONTS];
#ifdef MORE_LANGUAGES
@@ -454,7 +454,7 @@ CFont::InitPerFrame(void)
CSprite2d::GetBank(15, Sprite[3].m_pTexture);
#endif
SetDropShadowPosition(0);
- NewLine = 0;
+ NewLine = false;
#ifdef BUTTON_ICONS
PS2Symbol = BUTTON_NONE;
#endif
@@ -1048,7 +1048,6 @@ CFont::PrintString(float x, float y, wchar *start, wchar *end, float spwidth)
}
#endif
-#ifdef XBOX_SUBTITLES
void
CFont::PrintStringFromBottom(float x, float y, wchar *str)
{
@@ -1061,6 +1060,7 @@ CFont::PrintStringFromBottom(float x, float y, wchar *str)
PrintString(x, y, str);
}
+#ifdef XBOX_SUBTITLES
void
CFont::PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor)
{
@@ -1263,7 +1263,6 @@ CFont::GetStringWidth(wchar *s, bool spaces)
return w;
}
-
#ifdef MORE_LANGUAGES
float
CFont::GetStringWidth_Jap(wchar* s)
@@ -1384,7 +1383,7 @@ CFont::ParseToken(wchar *s, wchar*)
switch(*s){
case 'N':
case 'n':
- NewLine = 1;
+ NewLine = true;
break;
case 'b': SetColor(CRGBA(128, 167, 243, 255)); break;
case 'g': SetColor(CRGBA(95, 160, 106, 255)); break;
@@ -1430,14 +1429,6 @@ CFont::DrawFonts(void)
#endif
}
-wchar
-CFont::character_code(uint8 c)
-{
- if(c < 128)
- return c;
- return foreign_table[c-128];
-}
-
void
CFont::SetScale(float x, float y)
@@ -1453,9 +1444,16 @@ CFont::SetScale(float x, float y)
}
void
-CFont::SetBackgroundColor(CRGBA col)
+CFont::SetSlantRefPoint(float x, float y)
{
- Details.backgroundColor = col;
+ Details.slantRefX = x;
+ Details.slantRefY = y;
+}
+
+void
+CFont::SetSlant(float s)
+{
+ Details.slant = s;
}
void
@@ -1467,9 +1465,140 @@ CFont::SetColor(CRGBA col)
}
void
+CFont::SetJustifyOn(void)
+{
+ Details.justify = true;
+ Details.centre = false;
+ Details.rightJustify = false;
+}
+
+void
+CFont::SetJustifyOff(void)
+{
+ Details.justify = false;
+ Details.rightJustify = false;
+}
+
+void
+CFont::SetCentreOn(void)
+{
+ Details.centre = true;
+ Details.justify = false;
+ Details.rightJustify = false;
+}
+
+void
+CFont::SetCentreOff(void)
+{
+ Details.centre = false;
+}
+
+void
+CFont::SetWrapx(float x)
+{
+ Details.wrapX = x;
+}
+
+void
+CFont::SetCentreSize(float s)
+{
+ Details.centreSize = s;
+}
+
+void
+CFont::SetBackgroundOn(void)
+{
+ Details.background = true;
+}
+
+void
+CFont::SetBackgroundOff(void)
+{
+ Details.background = false;
+}
+
+void
+CFont::SetBackgroundColor(CRGBA col)
+{
+ Details.backgroundColor = col;
+}
+
+void
+CFont::SetBackGroundOnlyTextOn(void)
+{
+ Details.backgroundOnlyText = true;
+}
+
+void
+CFont::SetBackGroundOnlyTextOff(void)
+{
+ Details.backgroundOnlyText = false;
+}
+
+void
+CFont::SetRightJustifyOn(void)
+{
+ Details.rightJustify = true;
+ Details.justify = false;
+ Details.centre = false;
+}
+
+void
+CFont::SetRightJustifyOff(void)
+{
+ Details.rightJustify = false;
+ Details.justify = false;
+ Details.centre = false;
+}
+
+void
+CFont::SetPropOn(void)
+{
+ Details.proportional = true;
+}
+
+void
+CFont::SetPropOff(void)
+{
+ Details.proportional = false;
+}
+
+void
+CFont::SetFontStyle(int16 style)
+{
+ Details.style = style;
+}
+
+void
+CFont::SetRightJustifyWrap(float wrap)
+{
+ Details.rightJustifyWrap = wrap;
+}
+
+void
+CFont::SetAlphaFade(float fade)
+{
+ Details.alphaFade = fade;
+}
+
+void
CFont::SetDropColor(CRGBA col)
{
Details.dropColor = col;
if (Details.alphaFade < 255.0f)
Details.dropColor.a *= Details.alphaFade / 255.0f;
}
+
+void
+CFont::SetDropShadowPosition(int16 pos)
+{
+ Details.dropShadowPosition = pos;
+}
+
+wchar
+CFont::character_code(uint8 c)
+{
+ if(c < 128)
+ return c;
+ return foreign_table[c-128];
+} \ No newline at end of file
diff --git a/src/render/Font.h b/src/render/Font.h
index bd7e98bb..a7a4b487 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -13,12 +13,12 @@ struct CFontDetails
float slant;
float slantRefX;
float slantRefY;
- bool justify;
- bool centre;
- bool rightJustify;
- bool background;
- bool backgroundOnlyText;
- bool proportional;
+ bool8 justify;
+ bool8 centre;
+ bool8 rightJustify;
+ bool8 background;
+ bool8 backgroundOnlyText;
+ bool8 proportional;
float alphaFade;
CRGBA backgroundColor;
float wrapX;
@@ -97,7 +97,7 @@ class CFont
#else
static int16 Size[MAX_FONTS][193];
#endif
- static int16 NewLine;
+ static bool16 NewLine;
public:
static CSprite2d Sprite[MAX_FONTS];
static CFontDetails Details;
@@ -116,8 +116,8 @@ public:
static void InitPerFrame(void);
static void PrintChar(float x, float y, wchar c);
static void PrintString(float x, float y, wchar *s);
-#ifdef XBOX_SUBTITLES
static void PrintStringFromBottom(float x, float y, wchar *str);
+#ifdef XBOX_SUBTITLES
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);
@@ -142,49 +142,27 @@ public:
static void DrawFonts(void);
static uint16 character_code(uint8 c);
- static CFontDetails GetDetails() { return Details; }
static void SetScale(float x, float y);
- static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; }
- static void SetSlant(float s) { Details.slant = s; }
- static void SetJustifyOn(void) {
- Details.justify = true;
- Details.centre = false;
- Details.rightJustify = false;
- }
- static void SetJustifyOff(void) {
- Details.justify = false;
- Details.rightJustify = false;
- }
- static void SetRightJustifyOn(void) {
- Details.rightJustify = true;
- Details.justify = false;
- Details.centre = false;
- }
- static void SetRightJustifyOff(void) {
- Details.rightJustify = false;
- Details.justify = false;
- Details.centre = false;
- }
- static void SetCentreOn(void) {
- Details.centre = true;
- Details.justify = false;
- Details.rightJustify = false;
- }
- static void SetCentreOff(void) {
- Details.centre = false;
- }
- static void SetWrapx(float x) { Details.wrapX = x; }
- static void SetCentreSize(float s) { Details.centreSize = s; }
- static void SetBackgroundOn(void) { Details.background = true; }
- static void SetBackgroundOff(void) { Details.background = false; }
- static void SetBackGroundOnlyTextOn(void) { Details.backgroundOnlyText = true; }
- static void SetBackGroundOnlyTextOff(void) { Details.backgroundOnlyText = false; }
- static void SetPropOn(void) { Details.proportional = true; }
- static void SetPropOff(void) { Details.proportional = false; }
- static void SetFontStyle(int16 style) { Details.style = style; }
- static void SetRightJustifyWrap(float wrap) { Details.rightJustifyWrap = wrap; }
- static void SetAlphaFade(float fade) { Details.alphaFade = fade; }
- static void SetDropShadowPosition(int16 pos) { Details.dropShadowPosition = pos; }
+ static void SetSlantRefPoint(float x, float y);
+ static void SetSlant(float s);
+ static void SetJustifyOn(void);
+ static void SetJustifyOff(void);
+ static void SetRightJustifyOn(void);
+ static void SetRightJustifyOff(void);
+ static void SetCentreOn(void);
+ static void SetCentreOff(void);
+ static void SetWrapx(float x);
+ static void SetCentreSize(float s);
+ static void SetBackgroundOn(void);
+ static void SetBackgroundOff(void);
+ static void SetBackGroundOnlyTextOn(void);
+ static void SetBackGroundOnlyTextOff(void);
+ static void SetPropOn(void);
+ static void SetPropOff(void);
+ static void SetFontStyle(int16 style);
+ static void SetRightJustifyWrap(float wrap);
+ static void SetAlphaFade(float fade);
+ static void SetDropShadowPosition(int16 pos);
static void SetBackgroundColor(CRGBA col);
static void SetColor(CRGBA col);
static void SetDropColor(CRGBA col);