From 0c7931b30f5afa7f9abaf07ad82da07cf2aac846 Mon Sep 17 00:00:00 2001 From: KKNecmi Date: Sun, 8 Mar 2026 07:29:43 +0300 Subject: [PATCH] added float draw & edited some variables to look better on screen --- Minecraft.Client/ChatScreen.cpp | 4 ++-- Minecraft.Client/Font.cpp | 19 +++++++++++++++++++ Minecraft.Client/Font.h | 2 ++ Minecraft.Client/Gui.cpp | 11 +++++------ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Minecraft.Client/ChatScreen.cpp b/Minecraft.Client/ChatScreen.cpp index 651be5e86..668d8ae93 100644 --- a/Minecraft.Client/ChatScreen.cpp +++ b/Minecraft.Client/ChatScreen.cpp @@ -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; diff --git a/Minecraft.Client/Font.cpp b/Minecraft.Client/Font.cpp index 3f556c774..f3853667b 100644 --- a/Minecraft.Client/Font.cpp +++ b/Minecraft.Client/Font.cpp @@ -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(x); + yPos = static_cast(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; diff --git a/Minecraft.Client/Font.h b/Minecraft.Client/Font.h index 54a4d6120..83e7d340f 100644 --- a/Minecraft.Client/Font.h +++ b/Minecraft.Client/Font.h @@ -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); /** diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index dbad98569..0a23f6ba1 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -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(); } }