Closed athrane closed 2 years ago
Text should be positioned based on the current resolution:
static void calculateTextXPosition(RenderGameOverlayEvent event) { // Get window resolution MainWindow mainWindow = event.getWindow(); int height = mainWindow.getScaledHeight(); int width = mainWindow.getScaledWidth(); // get rendering engine Minecraft mcClient = Minecraft.getInstance(); EntityRendererManager renderManager = mcClient.getRenderManager(); FontRenderer fontRenderer = renderManager.getFontRenderer(); // get text length String guiString = "TEST TEST TEST"; // getGuiString(); int textWidth = fontRenderer.getStringWidth(guiString); // calculate x position int xpos = width - textWidth; // calculate y position int ypos = height - 10; // draw string fontRenderer.drawString(event.getMatrixStack(), guiString, xpos, ypos, TEXT_COLOR); }
Resolved with commit: https://github.com/athrane/bassebombecraft/commit/4c4667855fb59512f534b11043abf2ddbb47ec46
Text should be positioned based on the current resolution: