Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Advices needed for a HUD/GUI  (Read 2180 times)

0 Members and 1 Guest are viewing this topic.

Resethel

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Advices needed for a HUD/GUI
« on: July 24, 2015, 08:51:15 pm »
Hello everyone,

I've reached, in a recent project, the point where I must develop a HUD/GUI.
So I was wondering, how to correctly implement it?

Right now the solution I'm trying to build is:

  • Creating a base class from which each widget like buttons, sliders (and so on) will inherit
  • Creating a HUD/GUI class which will contain all the widget currently displayed, create them and draw them
  • The HUD/GUI class could handle the widgets' informations, I mean when I click on a button, the information will be sent to the HUD/GUI container class which will perform an action according to the message received

But I guess there are plenty of flaws by this method. So I thought that the HUD could be build as a single class with a vertex array, but I have no clue how to handle the "widgets" this way...

So I was wondering, is my first idea good and how can I improve it?Is the second method better? or should I process in a totally other way?

Anyway, thanks a lot for hearing my request :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11004
    • View Profile
    • development blog
    • Email
Re: Advices needed for a HUD/GUI
« Reply #1 on: August 01, 2015, 09:21:43 pm »
It's a rather abstract topic and I'm not sure you explained your idea well enough for others to understand it in-depth.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

firefly2442

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Advices needed for a HUD/GUI
« Reply #2 on: August 04, 2015, 09:40:25 pm »
If you would like to use an existing library, SFGUI is an option:

http://sfgui.sfml-dev.de/

Verra

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Advices needed for a HUD/GUI
« Reply #3 on: August 05, 2015, 09:13:20 am »
Here's a quick in dirty setup I threw together a bit ago. It relies heavily on sfml, you might be able to use it as base to get working on your message passing thing you were talking about. https://bitbucket.org/Verrazano/sassy