Best way to make a tweaking GUI

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Treb
Just popping in
Just popping in
Posts: 1
Joined: Fri Oct 29, 2010 23:21

Best way to make a tweaking GUI

Postby Treb » Fri Oct 29, 2010 23:45

I am trying to make an anttweakbar esque tweaker with CEGUI. Unfortunately I must be doing it in an suboptimal fashion because it takes about 10 seconds to create the window and it is very slow to render.

The tweaker needs to be hierarchical because it will be used for editing our XML files. I drew an ugly picture in paint to illustrate this. I have a name, edit box, and check box for each value.
Image

Unfortunately the current way I'm approaching this is quite slow. It involves creating about 60 Vanilla/StaticText's and edit boxes and it takes about 10 seconds to create the window and is quite slow to render.

I was wondering how a more experienced user would approach making the type of GUI I explained.


Here is a simplified code sample to illustrate approximately what I'm doing at this point.

Code: Select all

    m_mngr = WindowManager::getSingletonPtr();
    m_rootWin = m_mngr->createWindow("DefaultWindow");
    m_mainWin = m_mngr->createWindow("Vanilla/FrameWindow");
    m_clientWin = m_mngr->createWindow("WindowsLook/ScrollablePane");

    m_rootWin->setMousePassThroughEnabled(true);

    m_rootWin->addChildWindow(m_mainWin);
    m_mainWin->addChildWindow(m_clientWin);

    m_mainWin->setPosition(UVector2(UDim(0,0),UDim(0,0)));
    m_mainWin->setMinSize(UVector2(cegui_absdim(300),cegui_absdim(400)));

    m_clientWin->setPosition(UVector2(UDim(0,0),UDim(0,0)));
    m_clientWin->setSize(UVector2(UDim(1,0),UDim(1,0)));


    float curHeight = 10.f;
    for( uint i = 0; i < 60; ++i )
    {
      Window * win = m_mngr->createWindow("Vanilla/StaticText");

      m_clientWin->addChildWindow(win);

      win->setPosition(UVector2(UDim(0,10.f),UDim(0,curHeight)));
      win->setSize(UVector2(UDim(0,200),UDim(0,30.f)));

      //move next window down, I also do indenting in my full code.
      curHeight += 35.f;
      win->setText(itoa(i,buf,10));
    }

    CEGUI::System::getSingleton().setGUISheet(m_rootWin);

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Best way to make a tweaking GUI

Postby CrazyEddie » Tue Nov 02, 2010 10:22

I would start by avoiding static text. To be honest, the static text has become bloated and horrible, and is not really suitable for a lightweight label class anymore - which is a shame, since that's what it was supposed to be. I would suggest skinning DefaultWindow using the Falagard/Default window renderer to create a basic label class and replace the static text instances with that, since - unless you want scrollbars and a bunch of other bloat in your labels - this will lighten the load considerably IMO.

CE.

mithryanna
Just popping in
Just popping in
Posts: 13
Joined: Fri Jun 25, 2010 15:00
Location: USA

Re: Best way to make a tweaking GUI

Postby mithryanna » Mon Nov 29, 2010 15:56

Hmm great stuff. I actually noticed the same problem with a window created in our app; it has a listbox in it that dynamically checks our globe object for map layers, and displays them in a list. Just going through and displaying a checkbox and static text for 3 layers takes a few seconds for the window to load. After reading this I'm going to try switching the labels to default windows instead of static text.

uelkfr
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Dec 14, 2010 16:57

Re: Best way to make a tweaking GUI

Postby uelkfr » Thu Dec 23, 2010 17:08

CrazyEddie wrote:I would start by avoiding static text. To be honest, the static text has become bloated and horrible, and is not really suitable for a lightweight label class anymore - which is a shame, since that's what it was supposed to be. I would suggest skinning DefaultWindow using the Falagard/Default window renderer to create a basic label class and replace the static text instances with that, since - unless you want scrollbars and a bunch of other bloat in your labels - this will lighten the load considerably IMO.

CE.

If so, why not to make the text as child (autowindow) of StaticText, or separate <WidgetLook> called "Label" without any bloated stuff. Or split this problem and create <WidgetLook> called "Panel" without text rendering support. There are a lot of approaches for future release :)
helper to newbies

"i help you, dear newbie
but nobody helps me!"

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Best way to make a tweaking GUI

Postby Kulik » Thu Dec 23, 2010 18:38

uelkfr: Yeah, I would start by renaming StaticText to something that would describe that it's powerful but bloated. Perhaps creating Label in the stock skins to replace it in the simple cases. Any ideas what StaticText should be called in 0.8?

User avatar
Mikademus
CEGUI MVP
CEGUI MVP
Posts: 130
Joined: Wed Mar 18, 2009 19:14

Re: Best way to make a tweaking GUI

Postby Mikademus » Thu Dec 23, 2010 20:50

Kulik wrote:uelkfr: Yeah, I would start by renaming StaticText to something that would describe that it's powerful but bloated. Perhaps creating Label in the stock skins to replace it in the simple cases. Any ideas what StaticText should be called in 0.8?


BasicText, BasicTextLabel, Label or StaticLabel are good names for a light-weight, bare-bones label component. The current StaticText could be called something like MessagePanel, FullTextWidget or FullTextPanel to signal that it is a feature-rich and high-overhead component.

This discussion should probably be brought over to API breaking consistency fixes intended for CEGUI 0.8.0 though.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests