Jump to content

GUI Overlay bigger


Spyeedy

Recommended Posts

1. Calls like this:

mc.ingameGUI

 

Are quite bad? Do: GuiOverlay extends Gui and use this.draw...

 

As to scaling - everything you will ever read/see/write is just some methods based on OpenGL - any GL operation can be used (almost) freely.

GL11.glScalef

 

Note that scaling is to top/left (not center).

 

Additionally:

Please look into Gui.class and maybe use drawTexturedModalRectWithCustomSize (or something like that). You could easily stretch your .png across whole screen.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

So I created a class which extends Gui and apply the texture etc, but where do I call the gui from to have it as a gui overlay when the player wears his armor?

width=620 height=260http://www.startrek.com/uploads/assets/articles/61c89a9d73c284bda486afaeaf01cdb27180359b.jpg[/img]

Till next time. Thank you for delivering funny scenes to Star Trek as Chekov :) . Will always remember you

Link to comment
Share on other sites

Whaaat?

 

1. Extending Gui gives you access to drawing methods (so you don't have to call ones via mc.ingameGUI). Just that.

2. You draw inside event! You don't call any stuff (aside from rendering).

3. Use Pre/Post sub-event (Post pref).

 

What is your question?

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

So I created a class which extends Gui and apply the texture etc, but where do I call the gui from to have it as a gui overlay when the player wears his armor?

 

Typo error, anyway.. i have yet to create the class, what do you mean "draw inside event"? My question was where do I call the gui and how do I have it displayed as a gui overlay when the player wears a particular armor?

 

width=620 height=260http://www.startrek.com/uploads/assets/articles/61c89a9d73c284bda486afaeaf01cdb27180359b.jpg[/img]

Till next time. Thank you for delivering funny scenes to Star Trek as Chekov :) . Will always remember you

Link to comment
Share on other sites

what do you mean "draw inside event"?

 

Like literally - inside event. your rendering code will be inside event method - exacly what you are doing now. Wtf?

 

how do I have it displayed as a gui overlay when the player wears a particular armor?

Before rendering code (inside event) make if statement with check against Minecraft#thePlayer and his inventory.

 

My question was where do I call the gui and how do I have it displayed as a gui overlay when the player wears a particular armor?

 

Again - WHAT GUI?! You are not making gui in ingame overlay - ingame overlay IS THE GUI!

 

1. Extending Gui gives you access to drawing methods (so you don't have to call ones via mc.ingameGUI). Just that.

Your event class CAN extend Gui.class to gain access to utility member methods - instead of calling Minecraft#ingameGUI#method you can use this#method. That is all, Gui.class != GUI.

 

Other:

Again - use Post sub-event!

Pick PHASE (event.phase)!

Wtf - if (!event.isCancelable()) - this is pointless.

 

 

EDIT

 

Now after rethinking whole thread:

1. You started with good code, asking about scaling.

2. I gave you answer for scaling and few TIPS about rendering.

3. You flipped whole thread in mess.

4. I literally answered with stuff that was already in code you gave (well, you still didn't have sub-event and event.phase)

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

1. Calls like this:

mc.ingameGUI

 

Are quite bad? Do: GuiOverlay extends Gui and use this.draw...

 

As to scaling - everything you will ever read/see/write is just some methods based on OpenGL - any GL operation can be used (almost) freely.

GL11.glScalef

 

Note that scaling is to top/left (not center).

 

Additionally:

Please look into Gui.class and maybe use drawTexturedModalRectWithCustomSize (or something like that). You could easily stretch your .png across whole screen.

 

Using GL11.glScalef in the method increaes the entire overlay, the hotbar, health etc

width=620 height=260http://www.startrek.com/uploads/assets/articles/61c89a9d73c284bda486afaeaf01cdb27180359b.jpg[/img]

Till next time. Thank you for delivering funny scenes to Star Trek as Chekov :) . Will always remember you

Link to comment
Share on other sites

What do you mean "Post sub-event" and "PHASE (event.phase)"?

RenderGameOverlayEvent has two subevents Pre and Post. ALWAYS (almost) use one of those!

RenderGameOverlayEvent has types - event.getType() (ye, I messed up name, but it's your fault you can't read sources/google). You have to pick one type, otherwise you are rendering multiple times per frame.

 

Using GL11.glScalef in the method increaes the entire overlay, the hotbar, health etc

Well yeah, if you didn't pick sub-event and type, then you are scaling everything. You need to scale and then revert (and/or use push/pop matrix).

 

For any other question related to GL I will autoomatically send you to google and Gui.class and a LOT of other vanilla sources which give examples.

 

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Using GL11.glScalef in the method increaes the entire overlay, the hotbar, health etc

Well yeah, if you didn't pick sub-event and type, then you are scaling everything. You need to scale and then revert (and/or use push/pop matrix).

 

For any other question related to GL I will autoomatically send you to google and Gui.class and a LOT of other vanilla sources which give examples.

Thanks for the push/pop matrix advice, it worked! :) Sorry for the trouble, first time working with GL11 and RenderGameOverlayEvent

width=620 height=260http://www.startrek.com/uploads/assets/articles/61c89a9d73c284bda486afaeaf01cdb27180359b.jpg[/img]

Till next time. Thank you for delivering funny scenes to Star Trek as Chekov :) . Will always remember you

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.