Jump to content
  • Advertisement
Sign in to follow this  
AaronWizardstar

Managing pop-up GUI items

This topic is 1864 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 a GUI system, what would be a good way to represent pop-up items such as menus and dialog boxes?

 
My GUI system is based on trees of widgets, e.g. a panel has a button has a label. Now I need widgets that are on top of other widgets instead of just inside them. Some pop-ups are modal, like dialog boxes, but some pop-ups like collapsable menus would only block the widgets directly under them.
 
One idea I had was to have all my widget trees in a stack. The tree for my main interface would live at the bottom, and any pop-ups would be additional trees pushed on to the stack. A widget tree could also have a flag for whether it's modal or not, likely kept in its root widget.
 
I'd also want to position some pop-ups relative to another widget, like a menu that's under a button. I'm not sure how I'd be able to do that aside from working out the screen coordinates of the parent widget. I wouldn't make the pop-up an actual child of the parent widget, since that relationship is for widgets contained by other widgets.

Share this post


Link to post
Share on other sites
Advertisement

Yeah I've seen some people implement modal type dialog boxes using a stack (some even use the built in stack you get through function calls - simply returning back to the underlying window when the topmost "pop-up" is closed).

 

As to your final question, if you don't use inheritance to push a parent window's screen position to its children, you could push that information through parameters when the parent window makes the function calls to pop-up its child widget(s).

 

Honestly there are so many already built GUI systems that you are probably wasting your time working on this unless you are just doing it solely to teach yourself something. For Windows you could try, GDI, Win32 APIs, for DirectX you could use DXUT, for other platforms and languages simple Google searches will turn up a few pre-built GUI libraries you could link into your project (Scaleform is a good choice for larger more professional projects).

Share this post


Link to post
Share on other sites

As to your final question, if you don't use inheritance to push a parent window's screen position to its children, you could push that information through parameters when the parent window makes the function calls to pop-up its child widget(s).

 

I do push the parent's position in a way.  When I draw a widget, I translate the screen coordinates by the widget's (x, y) position before drawing the children.
 
That's for widgets that are inside widgets though, and the parent widget stores its child widgets. Most widgets even clip the screen by their dimensions before drawing their children. I don't think I can represent "anchored" pop-ups the same way.

 

Honestly there are so many already built GUI systems that you are probably wasting your time working on this unless you are just doing it solely to teach yourself something. For Windows you could try, GDI, Win32 APIs, for DirectX you could use DXUT, for other platforms and languages simple Google searches will turn up a few pre-built GUI libraries you could link into your project (Scaleform is a good choice for larger more professional projects).

I could start a new thread on this, but requirements and restrictions prevent me from using most libraries. I want to be cross platform - I'm actually developing on a Mac - so Windows and DirectX based libraries are out (so are Apple's libraries). I'm doing this as a hobby and intend to make my game open source, so it's hard to justify to myself spending money on a GUI library, or even a general toolkit like Flash. Most of the cross platform open source [C++] libraries besides CEGUI seem to be in a perpetually alpha state, and I was turned off by CEGUI because it seemed to want to do its own rendering and resource management independent of my own engine's rendering and resource management. I briefly looked at libRocket and decided structuring everything in HTML didn't mesh with me since I couldn't figure out how to make a mouse cursor. And I'm programming my game in Ruby with Gosu, so most of those libraries would be unusable for me anyway. sad.png

Share this post


Link to post
Share on other sites

Hello,

 

At Coherent Labs we're developing a HTML5-based GUI library that will help you with the pop-up GUI. However, we're a commercial closed source vendor. So it might not be appropriate for your game but you can give it a try.

 

There are also some open source solutions that might help you out:

Chromium Embedded Framework

EAWebKit

 

I hope this will help you out with your project.

Edited by MartinZhel

Share this post


Link to post
Share on other sites

Thanks for the post, Martin, though unfortunately I'm not sure your suggestions would be much help.

There are also some open source solutions that might help you out:
Chromium Embedded Framework
EAWebKit

There isn't any info on the EAWebKit page. Just a couple of download links.

The Chromium Embedded Framework would require me to dip into C++. In that case I'd might as well try to learn libRocket again, since that would likely be lighter than embedding all of the Chromium engine.

Thanks anyway though.

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!