Jump to content

[1.12]Overlaying Buttons


ArmamentHaki

Recommended Posts

I managed to scroll my Buttons in a Gui, but whenever I scroll them to far, the Buttons which are Scrolling up are going outside of the field where I want them to be visible.

I know I could Change the Buttons visibility upon reaching some Point on the Y-axis, but then the whole button would suddenly vanish, which wouldn't look nice.
So my Goal is to overlay the Buttons with a rectangle that is drawn around the box where my Buttons are , so that the Buttons vanish behind the Rectangle Pixel for Pixel.
Here is the Problem: I can't figure out how to set the drawing order of something. I tried drawing the Buttons before the Rectangle but that won't work either.


 

Link to comment
Share on other sites

44 minutes ago, ArmamentHaki said:

I tried drawing the Buttons before the Rectangle but that won't work either.

Could you please show your code? Drawing anything after the buttons are drawn should draw that "anything" above the buttons as their z level is at 0 by default. Most likely you are doing something incorrectly as drawing something after the buttons are drawn works fine for me.

 

As a workaround you should be able to draw that "rectangle overlay" with a higher Z value. If you are using BufferBuilder directly you specify z yourself in pos element. If you are letting the Gui class draw stuff for you there is a zLevel field that controls it. Or you canjust use GlStateManager::translate too. Just don't forget to reset the z level back after you are done drawing your overlay.

Link to comment
Share on other sites

1 hour ago, V0idWa1k3r said:

their z level is at 0 by default. Most likely you are doing something incorrectly as drawing something after the buttons are drawn works fine for me.

 

thanks, I didn't know the zLevels Default was 0, so that in the Translation of the Buttons i used 1.0 as a modifier. now it works.

 

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.