Jump to content

[1.8] [Solved] Gui not being rendered properly (texture.png > 256x256)


DARKHAWX

Recommended Posts

So I'm creating a new book GUI that is basically a tutorial book like those seen in Thaumcraft/Botania/TConstruct/etc. However when I added buttons and a few GUI elements to my image it seems to just bug out and place the textures in weird positions / not even show them.

 

-snip-

 

The first set of coordinates is the location of the top left corner of my book texture in minecraft's window.

The next 3 sets of coordinates are for each of the nextpage/prevpage/etc buttons being drawn (not the chapterButtons).

The pairs of coordinates mean, respectively, the top left corner of the buttons texture, the bottom right corner of the buttons texture (both of these are in respect to the texture.png file. They make a box that contains the texture of the button), and the third pair of coordinates refers to the location of the button within minecraft's window.

 

Now I'm pretty certain that, by default minecraft's window's size is 640x480 so surely all these buttons should be properly rendered within the window.

 

I know this is probably a bit messy and hard to read, but can anyone check if my math is off or if I am just doing some stuff completely wrong that would be great, as I've been at this for the last couple hours and can't seem to fix it...

 

(Also, as a side note, whenever I click a button it makes the sound numerous times... which I'm going to put down to not doing something right with buttonList. And finally, there are a few things here that are empty or incomplete, such as renderScreen(), that's just because I haven't gotten around to finishing it because of this stupid problem.

No signature for you!

Link to comment
Share on other sites

So after a bit of tinkering I found out my problem and just want to share with you if anyone has a similar problem.

 

The issue I was having is that my texture image was >256x256 in size (even though it was still square). Therefore I had to use the method drawModalRectWithCustomSizedTexture() rather than drawTexturedModalRect().

No signature for you!

Link to comment
Share on other sites

So after a bit of tinkering I found out my problem and just want to share with you if anyone has a similar problem.

 

The issue I was having is that my texture image was >256x256 in size (even though it was still square). Therefore I had to use the method drawModalRectWithCustomSizedTexture() rather than drawTexturedModalRect().

 

you can have it any multiple of 256, I honestly usually start with a canvas of 1024 and create the picture in a 256 x 256 square in the top left corner

Link to comment
Share on other sites

You can't have a bigger texture than 256 if you are using the

drawTexturedModelRect()

method. Bigger images just get cropped in the GUI and looks awful if you have some detail in the GUI texture.

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.

Announcements



×
×
  • Create New...

Important Information

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