Jump to content

Button Highlighting


Pingubro

Recommended Posts

Hello, 

it is me again. I am creating a GUI the first time and try step by step to

create it on my own. But at this point I am stucked again.

My buttons seem very messy(posted screenshot). How cann I fix this?

And can I cange the texture of a button like I do in my code?

 

Button

GUI(in onACtionPerformed I change the texture)

Unbenannt.PNG

Edited by Pingubro
Link to comment
Share on other sites

Gui#drawTexturedModalRect expects your image to be 256x256 pixels. Use GuiScreen#drawModalRectWithCustomSizedTexture with the last 2 arguments being the texture width and height.

  • Like 1

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

2 minutes ago, Pingubro said:

And also how can I position it correctly?

 

Right now you are changing the texture position on the image, not the position of the actual button.

 

I don't know what you mean by "glimmer yellow", can you maybe describe your issues a bit better?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

So you mean your glimmer is in the wrong place?

 

else if (this.hovered)
{
    j = 16777120;
}

 

To change the color, you have to change that value. It is now 16777120, which is hex value 0xFFFFBE, which is slightly yellow. Use 16777215, or 0xFFFFFF for white.

 

A bit weird is that the only place that is used for is the rendering of text, which may also be why the position is wrong, as you always pass in an empty String as the button text. You either have to fiddle around with the positions or make your own method for rendering a colored overlay on top of your button.

Edited by larsgerrits
  • Like 1

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.



×
×
  • Create New...

Important Information

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