Jump to content
  • Advertisement
Sign in to follow this  
Artum

UI implementaion question.

This topic is 4281 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

Howdy. Let's get this out of the way: C++, Dev-C++, SDL So I've got a little game I'm making for myself (yeah who doesn't). In my game I'm at the point when I'd like to start adding in some UI: healthbars, hotbars, menus, and that sort of thing. I've been using SDL_Rects and the mouse coordinates to see if a button was clicked on; if the coords are within the Rect and the mouse button was clicked then the UI button has been clicked. So far it's been working out, but I just wanted to check with the community and see if anyone has a better idea on how to get UI interaction. Thanks in advance, -Artum.

Share this post


Link to post
Share on other sites
Advertisement
You may want to organize UI elements into a hierarchy, much like a scene graph. If you ever have movable elements, or any situation in which they may overlap, it could help you determine which element gets the event message by propagating it through parent-child relationships.

You also might want to consider giving the elements layer indices or z-values, which are also helpful in case of overlap or unexpected resolutions or things like that.

Aside from that, I'd say just do it the way it works. I used to spend entirely too much time designing, and not enough actually getting things done.

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!