Jump to content
  • entries
    707
  • comments
    1173
  • views
    436284

WidgetManager... finally

Sign in to follow this  
Programmer16

95 views

Up until a few minutes ago, every time I added a test widget I had to add the following lines to my application:

// During setup
WIDGET.Set(/*values*/);

// In Frame()
WIDGET.Render(0, m_pGraphics, m_pFont);

// In EventHandler()
WIDGET.OnLeftClick(Event);
WIDGET.OnLeftRelease(Event);
WIDGET.OnMiddleClick(Event)
...
WIDGET.OnMouseMove(Event);
WIDGET.OnChar(Event);
etc


Not much, but it got really tedious after a while (and annoying if I forget to add an event handler.) So, I finally coded up my WidgetManager class and THANK GOD! Mucho easier to add items and everything is tracked by the manager.

There is only one real problem I have with my GUI system, and that is that it doesn't have a command-esque event, so I have to detect df::IM_LBUTTONUP events. Works great, but it cuts out keyboard shortcuts and such. So, this is something I'm going to change for version 2.

I have mixed feelings about my ListBox/DropDownList system. To add items to a listbox requires the following code:

ListBox::ListBoxItem* pItem = new ListBox::ListBoxItem;
pItem->Set(pListBox, szText);
pListBox->AddChild(pItem);


I'm going to refactor out the AddChild() call though, since my Set() method should do that.

Did I ever mention that I love working with GUIs? A lot? I have no idea why, but GUIs facinate me.

Check out my previous post for a demo link and new screenshots.

Bedtime now, I have to work tomorrow.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!