Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

1. calculate the size of the gui to draw

2. calculate the x where u want to start to draw (xmax-size)

3. draw the gui!

  • Author

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.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.