How use QuickGui with Gamestate?

Felipe

16-10-2007 12:26:10

in my code:

void MainMenuState::enter( void )
{

mGUIManager = QuickGUI::GUIManager::getSingletonPtr();
mGUIManager->setup(mWindow->getWidth(),mWindow->getHeight());

using QuickGUI::Rect;
using QuickGUI::Point;
using QuickGUI::Size;

mSheet = mGUIManager->getDefaultSheet();
mSheet->setDefaultFont("acmesa.14");

QuickGUI::Window* ninjaWindow = mSheet->createWindow(Rect(0.65,0.25,0.25,0.25));
ninjaWindow->hideTitlebar();

QuickGUI::Label* MenuLabel = ninjaWindow->createLabel(Rect(0.18,0.0,0.6,0.15),"Menu");
MenuLabel->getText()->setCaption("Menu");

QuickGUI::Button* hurtButton = ninjaWindow->createButton(Rect(0.07,0.26,0.8,0.15));
hurtButton->getText()->setCaption("Novo Jogo");
hurtButton->addEventHandler(QuickGUI::Widget::EVENT_MOUSE_BUTTON_UP,&MainMenuState::evtHndlr_Start,this);

QuickGUI::Button* healButton = ninjaWindow->createButton(Rect(0.075,0.50,0.8,0.15));
healButton->getText()->setCaption("Ajuda");

QuickGUI::Button* sairButton = ninjaWindow->createButton(Rect(0.075,0.83,0.8,0.15));
sairButton->getText()->setCaption("Sair");
sairButton->addEventHandler(QuickGUI::Widget::EVENT_MOUSE_BUTTON_UP,&MainMenuState::evtHndlr_Quit,this);


}

void MainMenuState::exit( void )
{
mGUIManager->destroySheet(mSheet);
}


give a error in

void GUIManager::removeFromRenderQueue()
{
if(mSceneManager != NULL)
mSceneManager->removeRenderQueueListener(this);
}


why?

kungfoomasta

16-10-2007 17:14:14

I'm not sure why you're getting an error there. I can see you are using v0.9.6, are you familiar with TortoiseSVN? I am pushing to make another release soon, a lot has changed..

Also, you shouldn't delete the default Sheet, QuickGUI should take care of that. I will check that it does, if not, I will fix it.

Try making a call to
mGUIManager->clearAll();

Felipe

16-10-2007 19:26:27

i make this and give same error!!

Felipe

16-10-2007 19:44:13

the error is in recall mGUIManager = QuickGUI::GUIManager::getSingletonPtr();

in my gamestate->enter()

singleton not implement corretly,

my other Managers(SoundManager,PhysicManager,etc) use Singleton with out problems.

kungfoomasta

16-10-2007 19:55:44

For now, instead of using SingletonPtr, delete and create a new instance of GUIManager.

mGUIManager = new GUIManager(...);

...

delete mGUIManager;

Just to confirm, what version are you using?

Felipe

16-10-2007 20:00:36

mGUIManager = new GUIManager(...);

isn't possible because GUIManager() is a private method

my version is 0.9.6b

Felipe

16-10-2007 21:33:57

i solved

my overlay and quickGUI sheet is conflit

my code

in gamemanager

mGUIManager = QuickGUI::GUIManager::getSingletonPtr();
mGUIManager->setup(mRenderWindow->getWidth(),mRenderWindow->getHeight());


in my gamestate

on enter() method

mGUIManager = QuickGUI::GUIManager::getSingletonPtr();

on exit() method

mGUIManager->clearAll();

thanks!

QuickQUI is more great than CEGUI!!

kungfoomasta

16-10-2007 22:10:32

Awesome, I'm glad you figured it out! Like I said, I will put out a new release soon, you'll want to switch over as soon as it comes out. I was itching to make some sort of release anyway. :wink:

Thanks for the comments! :D