added float draw & edited some variables to look better on screen

This commit is contained in:
KKNecmi 2026-03-08 07:29:43 +03:00
parent 6472694cb4
commit 0c7931b30f
4 changed files with 28 additions and 8 deletions

View file

@ -154,7 +154,7 @@ void ChatScreen::render(int xm, int ym, float a)
{
textScale = textScale * 1.25f;
barTopOffset = 10;
barBottomOffset = 0;
barBottomOffset = -2;
textYOffset = 8;
yAdjust = 115;
widthsubtract = -210;
@ -170,7 +170,7 @@ void ChatScreen::render(int xm, int ym, float a)
}
else if (uiSetting == 2)
{
textScale = textScale * 0.75f;
textScale = textScale * 0.8f;
barTopOffset = 18;
barBottomOffset = 6;
textYOffset = 16;

View file

@ -257,6 +257,25 @@ void Font::drawShadowLiteralCustom(const wstring& str, int x, int y, int xplus,
drawLiteral(str, x, y, color);
}
void Font::drawShadowFloat(const wstring& str, float x, float y, float xplus, float yplus, int color, int shadowColor)
{
drawLiteralFloat(str, x + xplus, y + yplus, shadowColor);
drawLiteralFloat(str, x, y, color);
}
void Font::drawLiteralFloat(const wstring& str, float x, float y, int color)
{
if (str.empty()) return;
if ((color & 0xFC000000) == 0) color |= 0xFF000000;
textures->bindTexture(m_textureLocation);
glColor4f((color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F, (color >> 24 & 255) / 255.0F);
xPos = static_cast<float>(x);
yPos = static_cast<float>(y);
wstring cleanStr = sanitize(str);
for (size_t i = 0; i < cleanStr.length(); ++i)
renderCharacter(cleanStr.at(i));
}
void Font::drawLiteral(const wstring& str, int x, int y, int color)
{
if (str.empty()) return;

View file

@ -54,6 +54,8 @@ public:
void drawShadow(const wstring& str, int x, int y, int color);
void drawShadowLiteral(const wstring& str, int x, int y, int color); // draw without interpreting § codes
void drawShadowLiteralCustom(const wstring& str, int x, int y, int xplus, int yplus, int color, int shadowColor); // custom shadow color
void drawShadowFloat(const wstring &str, float x, float y, float xplus, float yplus, int color, int shadowColor); // Test Float Drawing
void drawLiteralFloat(const wstring& str, float x, float y, int color);
void drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h); // 4J Added h param
void draw(const wstring &str, int x, int y, int color);
/**

View file

@ -976,22 +976,20 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
float scaleFactor = 1.0f;
float textScale = 0.65f;
int backgroundtop = 13;
int bgfirsty = 2;
int bgsecondy = 9;
if (uiSetting == 0)
{
textScale = textScale * 1.5;
int backgroundtop = 10;
}
else if (uiSetting == 1)
{
textScale = textScale * 1;
int backgroundtop = 13;
}
else if (uiSetting == 2)
{
textScale = textScale * 0.75;
int backgroundtop = 16;
}
glPushMatrix();
@ -1024,13 +1022,14 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
wstring msg = guiMessages[iPad][i].string;
int bgColor = ((alpha / 2) << 24) | (0x404040);
this->fill(0, y - 3 - 1, screenWidth/fScaleFactorWidth, y + 10 - 1, bgColor);
this->fill(0, y - bgfirsty, screenWidth/fScaleFactorWidth, y + bgsecondy, bgColor);
glEnable(GL_BLEND);
glPushMatrix();
glTranslatef((float)(iSafezoneXHalf+4), (float)(y), 0);
glScalef(textScale, textScale, scaleFactor);
font->drawShadowLiteralCustom(msg, 0, 0, 1, 1, 0xffffff + (alpha << 24), 0x000000 + (alpha / 2 << 24));
font->drawShadowFloat(msg, 0, 0, 0.5, 0.5, 0xffffff + (alpha << 24), 0x000000 + (alpha / 2 << 24));
//font->drawShadowLiteralCustom(msg, 0, 0, 1, 1, 0xffffff + (alpha << 24), 0x000000 + (alpha / 2 << 24));
glPopMatrix();
}
}