Jump to content
  • Advertisement
Sign in to follow this  
Artum

Implementing a GUI for my 2D game.

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

Quote:
Original post by ArtumMy original idea was to use simple images with bounding boxes. If the player clicked inside that bounding box, an action would be performed. I've been doing that for selecting targets and it works just fine.
Thanks in advance,
-Artum.


What you mentioned should work perfectly fine for buttons etc, just be aware that if you plan on having 'windows' that can overlap you need to take consideration of this. If a button is drawn on top of another then you should take the actions of the uppermost. The easiest way of doing this is remembering that the collision should be front to back, opposite of your draw order.

Also for the buttons, I'd recommend implementing some sort of way to do call back functions as well as events for buttons. Ex: OnHoverOver, OnMouseLeftPress, OnMouseLeftHold, etc.

Hope that helps.

Share this post


Link to post
Share on other sites
Advertisement
Howdy all. I'm coding a little 2D RPG game and I've come to the point where I need to start adding a GUI. I've never fabricated a GUI before so I figured I'd ask around first. I don't need anything real fancy, I suppose. Probably just the following: Spell List, Inventory, Hotbar, Health/Mana Bars, Basic Start/Quit Menus. I'm using SDL and C++. My real question is what should I do for the hotbar and buttons? My original idea was to use simple images with bounding boxes. If the player clicked inside that bounding box, an action would be performed. I've been doing that for selecting targets and it works just fine. I'd like a second opinion, however. Should I go with my first plan, or is there a better way to do it? Thanks in advance, -Artum.

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.

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!