Jump to content

[1.7.10]Render bar the other way round.


NextInima

Recommended Posts

i have a standart bar in minecraft

 

 

int expbar = (int) (((double) 194) * (rins.getCURRENTLEVELEXP()) / rins.getNEXTLEVELMAXEXP());

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

drawTexturedModalRect(xPos -94, yPos - 32 + 3, 0, 9, expbar, 7);

 

 

this is going normal like the normal expbar of minecraft.

 

But how i can change the drawing from right to left    to left to right?

Link to comment
Share on other sites

I cant find a way to solve this problem.

 

here is my bar

 

 

 

 

the 2 bars on top are render the same, but i want the left bar to render right to left.

 

can write so good english ;D i hope you understand it.

Link to comment
Share on other sites

You should really learn tesselator (and math?) to understand the drawing process.

 

The method you are using now:

drawTexturedModalRect(xPos -94, yPos - 32 + 3, 0, 9, expbar, 7);

Is pretty much: Draw box from x/y, with width/height.

 

So logically, when width is your progress, the "walls" of box are at:

left: x

right: x+progress

top: y

bot: y+height

 

To draw in reverse you would need to have:

left: x+max-progress

right: x+max

top: y

bot: y+height

 

Converted to drawing:

drawTexturedModalRect(xPos + 194 - expbar, yPos - 29, 0, 9, expbar, 7);

 

But that is just plain stupid if you can easily learn tess and draw nice things, example:

	wr.addVertex(right, top, zLevel); // top right corner
	wr.addVertex(left, top, zLevel); // top left corner
	wr.addVertex(left, bottom, zLevel); // bot left
	wr.addVertex(right, bottom, zLevel); // bot right

This draws a box with said 4 corners. Since vertexes go anti-clockwise, you add them in this order. Look at "drawTexturedModalRect" on how to implement it, I leave it as an exerice.

Read more:

http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html

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

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.