From 9ce9ba9a6df659a4395717424373d13edd35994f Mon Sep 17 00:00:00 2001 From: Devinci Date: Tue, 2 Jun 2026 15:30:59 +0200 Subject: [PATCH 1/6] v1 --- include/client/menus/Menu.hpp | 1 - src/client/menus/Chat.cpp | 16 ++++++++-------- src/client/menus/DebugHUD.cpp | 4 ++-- src/client/menus/Menu.cpp | 3 +-- src/client/menus/PlayerListHUD.cpp | 6 +++--- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/client/menus/Menu.hpp b/include/client/menus/Menu.hpp index 5e5d280a..3cc65598 100644 --- a/include/client/menus/Menu.hpp +++ b/include/client/menus/Menu.hpp @@ -56,7 +56,6 @@ class Menu { int menuWidth = 0; int menuHeight = 0; float menuScale = 0; - float textScale = 1.0f; Typer textRenderer; Typer titleRenderer; diff --git a/src/client/menus/Chat.cpp b/src/client/menus/Chat.cpp index 1953e55f..dac15777 100644 --- a/src/client/menus/Chat.cpp +++ b/src/client/menus/Chat.cpp @@ -45,12 +45,12 @@ void Chat::goThroughChatLog(const int key) void Chat::onRender() { drawSimpleQuad(x, y, w, h, chatColor); - float offset = 10.0f * menuScale; - float charHeight = (48+10)*textScale*menuScale; //48 cause font is 48 and 10 is height offset + float offset = 10.0f * textRenderer.getScale(); + float charHeight = 48 * textRenderer.getScale(); textRenderer.renderText(currMsg, x + offset, y + offset, glm::vec3(0.5, 0.8f, 0.2f)); - int currHeight = offset + charHeight; + float currHeight = offset + charHeight; for (auto it = chatLog.rbegin(); it != chatLog.rend() && currHeight < (h - charHeight); ++it) { textRenderer.renderText(it->message.c_str(), x+offset, y+currHeight, glm::vec3(1.0f)); @@ -64,9 +64,9 @@ void Chat::renderRecentMessages() auto nowMs = std::chrono::duration_cast(timepoint.time_since_epoch()).count(); auto nowS = std::chrono::duration_cast(timepoint.time_since_epoch()).count(); - float offset = 10.0f * menuScale; - float charHeight = (48+10)*textScale; //48 cause font is 48 and 10 is height offset - int currHeight = offset + charHeight; + float offset = 10.0f * textRenderer.getScale(); + float charHeight = 48 * textRenderer.getScale(); + float currHeight = offset + charHeight; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -82,12 +82,12 @@ void Chat::renderRecentMessages() std::clamp(1.0 - age / (MESSAGE_LIFETIME * 1000), 0.0, 1.0) ); - drawSimpleQuad(x + offset, y + (currHeight - 4) * menuScale, textRenderer.getPixelSizeOfString(msg->message) + 2, charHeight, glm::vec4(0,0,0,alpha/2.0f)); + drawSimpleQuad(x + offset, y + currHeight - offset / 2.0f - 4, textRenderer.getPixelSizeOfString(msg->message) + 2, charHeight, glm::vec4(0,0,0,alpha/2.0f)); textRenderer.renderText( msg->message.c_str(), x + offset, - y + currHeight * menuScale, + y + currHeight, glm::vec3(1.0f), alpha ); diff --git a/src/client/menus/DebugHUD.cpp b/src/client/menus/DebugHUD.cpp index c13fb08a..a9dafe0d 100644 --- a/src/client/menus/DebugHUD.cpp +++ b/src/client/menus/DebugHUD.cpp @@ -20,13 +20,13 @@ void DebugHUD::build() void DebugHUD::onRender() { const float pad = 8.0f * menuScale; - const float lineH = 18.0f * menuScale * textScale * 3; + const float lineH = 18.0f * menuScale; const float bgPadX = 2.0f * menuScale; // horizontal inset inside each bg const glm::vec4 bgColor{ 0.0f, 0.0f, 0.0f, 0.0f }; const glm::vec3 white{ 1.0f, 1.0f, 1.0f }; const float textX = pad; - float textY = static_cast(fullscreenHeight) - pad - 4.0f * menuScale * textScale * 5; + float textY = static_cast(fullscreenHeight) - pad - 8.0f * menuScale; char buf[64]; diff --git a/src/client/menus/Menu.cpp b/src/client/menus/Menu.cpp index a143de47..b443e5a7 100644 --- a/src/client/menus/Menu.cpp +++ b/src/client/menus/Menu.cpp @@ -400,11 +400,10 @@ void Menu::resize(float width, float height) float scale = std::min(scaleX, scaleY); menuScale = scale; - this->menuWidth = DESIGN_WIDTH * scale; this->menuHeight = DESIGN_HEIGHT * scale; - textRenderer.setScale(textScale * scale); + textRenderer.setScale(scale / 2.0f); build(); } diff --git a/src/client/menus/PlayerListHUD.cpp b/src/client/menus/PlayerListHUD.cpp index 23ac242f..2383b811 100644 --- a/src/client/menus/PlayerListHUD.cpp +++ b/src/client/menus/PlayerListHUD.cpp @@ -45,10 +45,10 @@ void PlayerListHUD::onRender() if (m_players.empty()) return; const float s = menuScale; - const float panelW = 300.0f * s * textScale * 3; + const float panelW = 300.0f * s * menuScale; const float padX = 10.0f * s; - const float padY = 8.0f * s * textScale * 3; - const float lineH = 20.0f * s * textScale * 3; + const float padY = 8.0f * s * menuScale; + const float lineH = 20.0f * s * menuScale; const float iconSize = 12.0f * s; const float topGap = 10.0f * s; From 543b335a7feb00cdfd150c7f178b43162c4a3d1c Mon Sep 17 00:00:00 2001 From: Devinci Date: Tue, 2 Jun 2026 15:41:23 +0200 Subject: [PATCH 2/6] limited tp distance --- src/server/Server.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server/Server.cpp b/src/server/Server.cpp index c1dfe8dd..10d413c2 100644 --- a/src/server/Server.cpp +++ b/src/server/Server.cpp @@ -770,9 +770,14 @@ void Server::receiveMessage(NetMessage &pkt, const sockaddr_in &cliaddr) std::istringstream iss(pkt.message.substr(strlen("tp "))); float x, y, z; if (iss >> x >> y >> z) { - player->movement->setPosition(glm::vec3(x, y, z)); - player->movement->setVelocity(glm::vec3(0.0f)); - player->movement->accumulatedFallDistance = 0.0f; + if (abs(x) < 100000000 && abs(y) < 100000000 && abs(z) < 2000) + { + player->movement->setPosition(glm::vec3(x, y, z)); + player->movement->setVelocity(glm::vec3(0.0f)); + player->movement->accumulatedFallDistance = 0.0f; + } + else + player->targetedMessages.push_back("You can't tp that far!"); } else { player->targetedMessages.push_back("[server] Usage: /tp "); } From fc60873ece4996fd91da1a65d44cdae498ce6141 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 2 Jun 2026 16:44:18 +0200 Subject: [PATCH 3/6] v2-42pcs --- include/client/Typer.hpp | 2 +- src/client/menus/DebugHUD.cpp | 11 ++++++----- src/client/menus/Menu.cpp | 2 +- src/client/menus/PlayerListHUD.cpp | 9 +++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/client/Typer.hpp b/include/client/Typer.hpp index 9282ea9e..ca557e42 100644 --- a/include/client/Typer.hpp +++ b/include/client/Typer.hpp @@ -26,7 +26,7 @@ struct TypingCharacter { class Typer { private: - float scale = 0.3; + float scale = 1.0f; Shader shader; std::map Characters; unsigned int VAO, VBO; diff --git a/src/client/menus/DebugHUD.cpp b/src/client/menus/DebugHUD.cpp index a9dafe0d..7efe9ea2 100644 --- a/src/client/menus/DebugHUD.cpp +++ b/src/client/menus/DebugHUD.cpp @@ -19,20 +19,21 @@ void DebugHUD::build() void DebugHUD::onRender() { - const float pad = 8.0f * menuScale; - const float lineH = 18.0f * menuScale; - const float bgPadX = 2.0f * menuScale; // horizontal inset inside each bg + float scale = textRenderer.getScale() * 2.5f; + const float pad = 8.0f * scale; + const float lineH = 18.0f * scale; + const float bgPadX = 2.0f * scale; // horizontal inset inside each bg const glm::vec4 bgColor{ 0.0f, 0.0f, 0.0f, 0.0f }; const glm::vec3 white{ 1.0f, 1.0f, 1.0f }; const float textX = pad; - float textY = static_cast(fullscreenHeight) - pad - 8.0f * menuScale; + float textY = static_cast(fullscreenHeight) - pad - 8.0f * scale; char buf[64]; auto drawLine = [&](const char* text) { float w = static_cast(textRenderer.getPixelSizeOfString(text)); - drawSimpleQuad(textX - bgPadX, textY - 3.0f * menuScale, w + bgPadX * 2.0f, lineH - 2.0f * menuScale, bgColor); + drawSimpleQuad(textX - bgPadX, textY - 3.0f * scale, w + bgPadX * 2.0f, lineH - 2.0f * scale, bgColor); textRenderer.renderText(text, textX, textY, white); textY -= lineH; }; diff --git a/src/client/menus/Menu.cpp b/src/client/menus/Menu.cpp index b443e5a7..3e593bbb 100644 --- a/src/client/menus/Menu.cpp +++ b/src/client/menus/Menu.cpp @@ -403,7 +403,7 @@ void Menu::resize(float width, float height) this->menuWidth = DESIGN_WIDTH * scale; this->menuHeight = DESIGN_HEIGHT * scale; - textRenderer.setScale(scale / 2.0f); + textRenderer.setScale(scale); build(); } diff --git a/src/client/menus/PlayerListHUD.cpp b/src/client/menus/PlayerListHUD.cpp index 2383b811..4fb46e10 100644 --- a/src/client/menus/PlayerListHUD.cpp +++ b/src/client/menus/PlayerListHUD.cpp @@ -44,11 +44,12 @@ void PlayerListHUD::onRender() { if (m_players.empty()) return; - const float s = menuScale; - const float panelW = 300.0f * s * menuScale; + float scale = textRenderer.getScale() * 2.5f; + const float s = scale; + const float panelW = 300.0f * s; const float padX = 10.0f * s; - const float padY = 8.0f * s * menuScale; - const float lineH = 20.0f * s * menuScale; + const float padY = 8.0f * s; + const float lineH = 20.0f * s; const float iconSize = 12.0f * s; const float topGap = 10.0f * s; From 979a07a5294b96fb34a176065e3a8551d9b94f68 Mon Sep 17 00:00:00 2001 From: Devinci Date: Wed, 3 Jun 2026 14:57:59 +0200 Subject: [PATCH 4/6] cout test --- src/client/App.cpp | 2 +- src/client/menus/Menu.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/App.cpp b/src/client/App.cpp index 34312b3c..3946d701 100644 --- a/src/client/App.cpp +++ b/src/client/App.cpp @@ -78,7 +78,7 @@ void App::init(const std::string& serverIp) { audio.reset(); } - glfwSetFramebufferSizeCallback(window, [](GLFWwindow* w, const int width, const int height) { + glfwSetFramebufferSizeCallback(window, [](GLFWwindow* w, int width, int height) { App* app = static_cast(glfwGetWindowUserPointer(w)); // Skip resize if window is minimized (0x0) if (width == 0 || height == 0) diff --git a/src/client/menus/Menu.cpp b/src/client/menus/Menu.cpp index 3e593bbb..2232b87d 100644 --- a/src/client/menus/Menu.cpp +++ b/src/client/menus/Menu.cpp @@ -405,6 +405,8 @@ void Menu::resize(float width, float height) textRenderer.setScale(scale); + std::cout << scale << std::endl; + build(); } From 7a5760196cb9fe28bb955e9bbcd84565f46a2d82 Mon Sep 17 00:00:00 2001 From: Devinci Date: Wed, 3 Jun 2026 15:09:41 +0200 Subject: [PATCH 5/6] hopefuly working ver --- src/client/menus/Chat.cpp | 2 ++ src/client/menus/DebugHUD.cpp | 2 ++ src/client/menus/Menu.cpp | 2 -- src/client/menus/PlayerListHUD.cpp | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/menus/Chat.cpp b/src/client/menus/Chat.cpp index dac15777..e42da42e 100644 --- a/src/client/menus/Chat.cpp +++ b/src/client/menus/Chat.cpp @@ -5,6 +5,8 @@ Chat::Chat(float width, float height) : Menu(width, height) { + DESIGN_WIDTH = 3840; + DESIGN_HEIGHT = 2160; build(); chatColor = glm::vec4(0,0,0,0.6f); } diff --git a/src/client/menus/DebugHUD.cpp b/src/client/menus/DebugHUD.cpp index 7efe9ea2..e28e389f 100644 --- a/src/client/menus/DebugHUD.cpp +++ b/src/client/menus/DebugHUD.cpp @@ -4,6 +4,8 @@ DebugHUD::DebugHUD(float width, float height) : Menu(width, height) { + DESIGN_WIDTH = 3840; + DESIGN_HEIGHT = 2160; build(); } diff --git a/src/client/menus/Menu.cpp b/src/client/menus/Menu.cpp index 2232b87d..3e593bbb 100644 --- a/src/client/menus/Menu.cpp +++ b/src/client/menus/Menu.cpp @@ -405,8 +405,6 @@ void Menu::resize(float width, float height) textRenderer.setScale(scale); - std::cout << scale << std::endl; - build(); } diff --git a/src/client/menus/PlayerListHUD.cpp b/src/client/menus/PlayerListHUD.cpp index 4fb46e10..8593662b 100644 --- a/src/client/menus/PlayerListHUD.cpp +++ b/src/client/menus/PlayerListHUD.cpp @@ -27,6 +27,8 @@ glm::vec3 PlayerListHUD::idToColor(uint32_t id) PlayerListHUD::PlayerListHUD(float width, float height) : Menu(width, height) { + DESIGN_WIDTH = 3840; + DESIGN_HEIGHT = 2160; build(); } From 6bb393dec82a97160fa592ce7975b8e4983af817 Mon Sep 17 00:00:00 2001 From: Devinci Date: Wed, 3 Jun 2026 18:14:23 +0200 Subject: [PATCH 6/6] fix on init --- src/client/menus/Chat.cpp | 2 ++ src/client/menus/DebugHUD.cpp | 2 ++ src/client/menus/PlayerListHUD.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/client/menus/Chat.cpp b/src/client/menus/Chat.cpp index e42da42e..6f288d36 100644 --- a/src/client/menus/Chat.cpp +++ b/src/client/menus/Chat.cpp @@ -9,6 +9,8 @@ Chat::Chat(float width, float height) : Menu(width, height) DESIGN_HEIGHT = 2160; build(); chatColor = glm::vec4(0,0,0,0.6f); + + resize(width, height); } Chat::~Chat() diff --git a/src/client/menus/DebugHUD.cpp b/src/client/menus/DebugHUD.cpp index e28e389f..82bf40f9 100644 --- a/src/client/menus/DebugHUD.cpp +++ b/src/client/menus/DebugHUD.cpp @@ -7,6 +7,8 @@ DebugHUD::DebugHUD(float width, float height) DESIGN_WIDTH = 3840; DESIGN_HEIGHT = 2160; build(); + + resize(width, height); } void DebugHUD::update(const DebugStats& stats) diff --git a/src/client/menus/PlayerListHUD.cpp b/src/client/menus/PlayerListHUD.cpp index 8593662b..f9550d31 100644 --- a/src/client/menus/PlayerListHUD.cpp +++ b/src/client/menus/PlayerListHUD.cpp @@ -30,6 +30,8 @@ PlayerListHUD::PlayerListHUD(float width, float height) DESIGN_WIDTH = 3840; DESIGN_HEIGHT = 2160; build(); + + resize(width, height); } void PlayerListHUD::update(const std::vector& players)