Window Constructor really do ???

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

traibuidoi
Just popping in
Just popping in
Posts: 13
Joined: Tue Aug 05, 2008 08:31

Window Constructor really do ???

Postby traibuidoi » Wed Sep 03, 2008 10:23

at first , please look at this very simple code :


Code: Select all

CEGUI::Window* t = new CEGUI::Window("WindowsLook/StaticImage","test");
CEGUI::ImagesetManager::getSingleton().createImagesetFromImageFile("ImgOne","imgOne.PNG");   
myRoot->addChildWindow(t); //myRoot is Rootsheet
t->setProperty("Image","set:ImgOne image:full_image");


when app run it gets error in CEGUI.log : (Error) CEGUI::UnknownObjectException in file ..\..\..\src\CEGUIPropertySet.cpp(124) : There is no Property named 'Image' available in the set.


And the second code :

Code: Select all

CEGUI::Window* t = winMgr->createWindow("WindowsLook/StaticImage","test");
CEGUI::ImagesetManager::getSingleton().createImagesetFromImageFile("ImgOne","imgOne.PNG");
myRoot->addChildWindow(t);
t->setProperty("Image","set:ImgOne image:full_image");



It works fine !!!!

So could anyone tell me : what do the window contrustor really do ? And what's difference beetween createWindow() function and window constructor ?

In my game , i must inherit CEGUI::Window class to my own Window ( ex flashing image ...) but i don't know its constructor exactly do .

Please help me

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Sep 03, 2008 12:39

Hi,

Cegui uses a factory system to create instances. So when you call "createWindow", a different constructor gets called (StaticImage one), so that your "t" points to a StaticImage instead of a base Window (your first line). You must not create windows through the window class directly, but always through the manager. (I am now also thinking why then it is possible to do otherwise).

If you are creating you own widget with C++ implementation, you might want to check out this page:
http://www.cegui.org.uk/wiki/index.php/ ... istboxItem

However this requires recompiling, you can't use the SDK then...

HTH.
Check out my released snake game using Cegui!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 21 guests