Jump to content

How to draw rectangle on GUI


dommilosz

Recommended Posts

I have gui class:

public class test_gui extends Screen

I want to draw Rectangle or Line on it. I'm writing "TEST" to gui and it's works. Is there any method to render a Line|Rectangle on GUI like drawing string?

Writing string code:

@Override
public void render(int p_render_1_, int p_render_2_, float p_render_3_) {
Minecraft mc = Minecraft.getInstance();
mc.fontRenderer.drawStringWithShadow("TEST",0,0,0xFFFFFF); //text is displaying
//function to draw a line
}
Link to comment
Share on other sites

I did this and there is nothing rendered (except "test"). Text rendered

@Override
public void render(int p_render_1_, int p_render_2_, float p_render_3_) {
    for(int i = 0; i < this.buttons.size(); ++i) {
        this.buttons.get(i).render(p_render_1_, p_render_2_, p_render_3_);
    }

    Minecraft mc = Minecraft.getInstance();
    mc.fontRenderer.drawStringWithShadow("TEST",0,0,0xFFFFFF);
    AbstractGui.fill(100,100,100,100,100);
}

 

 

Edited by dommilosz
Link to comment
Share on other sites

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.