Jump to content
  • Advertisement
Sign in to follow this  
noodleBowl

Touch button, Bounding Box, and its display

This topic is 1117 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my little custom engine, I have a class called TouchButton that is responsible for creating a on screen button.
TouchButtons have a single bounding box, which is used to determine if a TouchPoint is contained inside it. If the TouchPoint is inside the bounding box the button is being touched/pressed.

I have a issue that comes into play when rendering. Basically I can create my projection matrix using a orthographic projection that is off center (0, 0 is top left corner) or orthographic projection that is centered (0, 0 is at the center of the screen).

When trying use a projection matrix of each type, the rendering is perfect. The button is drawn to the screen correctly.
But when it comes to the bounding box and centered projection, the bounding box is out of sync with where the button is rendered. Meaning that if my finger is on the button, it wont register until I find where the buttons bounding box was placed sad.png

This is because of 0, 0 being in the center of the screen when it comes to rendering. And the 0, 0 being considered top left corner when it comes to the TouchPoints and bounding box.

How can I fix this? Is this normal (I feel like its not) when it comes to HUD / UI elements?

What do you guys do about HUD / UI elements?

Edited by noodleBowl

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!