Jump to content

[1.11.2] [SOLVED] Centered Rendering


Bektor

Recommended Posts

Hi,

 

I've got a little question:

How can I render something like a progress bar or a text or what ever centered on the screen?

 

Note: For rendering I'm using the RenderGameOverlayEvent.Post event.

 

It would also be quite nice to know how to render stuff with this event centered on the block the player is looking at.

 

Thx in advance.

Bektor

Edited by Bektor

Developer of Primeval Forest.

Link to comment
Share on other sites

Just now, diesieben07 said:

As for centered on screen:


centeredPosition = (dimensionOfScreen - dimensionOfThing) / 2

Dimension being either width or height, depending on in which dimension you want to center.

 

As for rendering on the block... you should use DrawBlockHighlightEvent for that, which is fired when the block highlight (wireframe) is drawn. Check out RenderGlobal::drawSelectionBox to see how that is done and adapt it for your needs.

Ok, thx, but from where do I get width and height of the screen?

Developer of Primeval Forest.

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.