Need some help!

wjbwsb

10-05-2010 02:37:01

Hi:
I'm new to use QuickGUI. When I run the program, I got a problem.

I add the code below to the example of Ogre:

void createScene(void)
{
mSceneMgr->setAmbientLight(ColourValue(0.25, 0.25, 0.25));

// add the ninja
Entity *ent = mSceneMgr->createEntity("Ninja", "ninja.mesh");
SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode("NinjaNode");
node->attachObject(ent);

// create the light
Light *light = mSceneMgr->createLight("Light1");
light->setType(Light::LT_POINT);
light->setPosition(Vector3(250, 150, 250));
light->setDiffuseColour(ColourValue::White);
light->setSpecularColour(ColourValue::White);

// Create the scene node
node = mSceneMgr->getRootSceneNode()->createChildSceneNode("CamNode1", Vector3(-400, 200, 400));
node->yaw(Degree(-45));
node->attachObject(mCamera);

// create the second camera node/pitch node
node = mSceneMgr->getRootSceneNode()->createChildSceneNode("CamNode2", Vector3(0, 200, 400));

//QuickGUI
QuickGUI::registerScriptReader();

new QuickGUI::Root();
QuickGUI::SkinTypeManager::getSingleton().loadTypes();
QuickGUI::GUIManagerDesc d;
d.sceneManager = mSceneMgr ;
d.viewport = mCamera->getViewport();


d.queueID = Ogre::RENDER_QUEUE_OVERLAY;

QuickGUI::GUIManager* mGUIManager = QuickGUI::Root::getSingletonPtr()->createGUIManager(d);

QuickGUI::SheetDesc* sd = QuickGUI::DescManager::getSingleton().getDefaultSheetDesc();
sd->resetToDefault();
sd->widget_dimensions.size = QuickGUI::Size(800,600);
QuickGUI::Sheet* mySheet = QuickGUI::SheetManager::getSingleton().createSheet(sd);

mGUIManager->setActiveSheet(mySheet);

}


And copy qgui.core.zip to the \media\packs

add Zip=../../media/packs/qgui.core.zip to resources.cfg


when I run the program , I got an exception:


SkinType does not exit for class "MouseCursor" and type "default"! in SkinTypeManager::getSkinType



Did I miss anything?

kungfoomasta

10-05-2010 23:32:36

This wiki tutorial should help you out:

http://www.ogre3d.org/wiki/index.php/QuickGUI_Beginner_Tutorial_1

You need to register the QuickGUI script reader prior to initialization of resources. The script reader basically tells ogre that ".skinType" files are resources, and so when the resource groups are initialized the parser parses the scripts and creates Skin definitions.

wjbwsb

11-05-2010 02:31:02

This wiki tutorial should help you out:

http://www.ogre3d.org/wiki/index.php/QuickGUI_Beginner_Tutorial_1

You need to register the QuickGUI script reader prior to initialization of resources. The script reader basically tells ogre that ".skinType" files are resources, and so when the resource groups are initialized the parser parses the scripts and creates Skin definitions.


Hi, kungfoomasta, thanks for your help!

I followed the Beginner_Tutorial and run the program, and there is no exception now.

I just move the code below to the void setupResources(void) function in ExampleApplication.h and it works.
QuickGUI::registerScriptReader();

But here comes another problem:

the tutorial says
Now that our Sheet is created, our GUI will be rendered!

But there is no sheet created, I can't see it. I don't know what I should do.

kungfoomasta

11-05-2010 21:23:41

Sorry, its a little outdated. You need to create a Sheet, then set it as the Active Sheet.

QuickGUI::Sheet* mySheet = QuickGUI::SheetManager::getSingleton().createSheet(...);
myGUIManager->setActiveSheet(mySheet);

wjbwsb

12-05-2010 02:45:43

Sorry, its a little outdated. You need to create a Sheet, then set it as the Active Sheet.

QuickGUI::Sheet* mySheet = QuickGUI::SheetManager::getSingleton().createSheet(...);
myGUIManager->setActiveSheet(mySheet);



Hi, kungfoomasta, thanks for your reply again.

Do you mean that I should use the code below

QuickGUI::Sheet* mySheet = QuickGUI::SheetManager::getSingleton().createSheet("mySheetFile.sheet",true);

to replace


QuickGUI::SheetDesc* sd = QuickGUI::DescManager::getSingleton().getDefaultSheetDesc();
sd->resetToDefault();
sd->widget_dimensions.size = QuickGUI::Size(800,600);
QuickGUI::Sheet* mySheet = QuickGUI::SheetManager::getSingleton().createSheet(sd);


I'm not sure about that.

And what I should do to create "mySheetFile.sheet" file.

Sorry to bother you again

kungfoomasta

12-05-2010 18:12:09

The editor doesn't work, I'd suggest creating the Sheet in code, and saving it to file for future use. You can save the sheet to file via an API, if I remember correctly its something like Sheet::writeToFile(...).

Feel free to post whenever you have questions. But I have to admit, I'm currently focusing on other projects, so I might be a little slow to respond, or fuzzy with the existing APIs in the latest release. :)

wjbwsb

13-05-2010 01:14:53

The editor doesn't work, I'd suggest creating the Sheet in code, and saving it to file for future use. You can save the sheet to file via an API, if I remember correctly its something like Sheet::writeToFile(...).

Feel free to post whenever you have questions. But I have to admit, I'm currently focusing on other projects, so I might be a little slow to respond, or fuzzy with the existing APIs in the latest release. :)



Thanks again. I'll try that API :D.