AyyyyLmao Posted August 4, 2015 Posted August 4, 2015 I want to display a few paragraphs of text which will have all the changes in an upcoming version. But if the user has their window size different to what I'm testing with then it will go over the edges and the user will not view it correctly. How would I implement a scroll bar and format it to fit in every window of any size? Heres what I have now: package mc.ayyyylmao.testgui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiControls; import net.minecraft.client.gui.GuiMultiplayer; import net.minecraft.client.gui.GuiScreen; public class TestGui extends GuiScreen { private GuiScreen parentScreen; private GuiButton dlnow; private GuiButton rmlater; private int headerPos; private int footerPos; private byte byte0 = -16; public TestGui(GuiScreen parent) { this.parentScreen = parent; } public void initGui() { this.buttonList.clear(); headerPos = 35; footerPos = this.height - 29; this.dlnow = new GuiButton(1, this.width / 2 - 70, footerPos-17, 150, 20, "Download Now"); this.rmlater = new GuiButton(2, this.width / 2 - 70, footerPos+3, 150, 20, "Remind Me Later"); this.buttonList.add(dlnow); this.buttonList.add(rmlater); } protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { if (mouseButton == 0) { for (int l = 0; l < this.buttonList.size(); ++l) { GuiButton guibutton = (GuiButton)this.buttonList.get(l); if (guibutton.mousePressed(this.mc, mouseX, mouseY)) { actionPerformed(guibutton); } } } } protected void actionPerformed(GuiButton button) { switch(button.id) { case 1: // Do stuff break; case 2: // Do stuff break; } } public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawBackground(0); this.drawGradientRect(0, 50, this.width, this.height - 50, -1072689136, -804253680); this.drawCenteredString(this.fontRendererObj, "New Version Released", this.width/2, headerPos, 0xFFFFFF); super.drawScreen(mouseX, mouseY, partialTicks); } } Thanks. Quote
AyyyyLmao Posted August 4, 2015 Author Posted August 4, 2015 Use FontRenderer#drawSplitString and it will split the string so that it fits on screen. And what about the height of the window? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.