Jump to content

Recommended Posts

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.