Page 1 of 1

howto draw a texture on a window?

Posted: Fri Dec 15, 2006 16:36
by realtiger
Hi

I want to make a simple chess board.
So I have to render some textures on window.
How can I do so?
I need it, please.
Thank u.

Posted: Fri Dec 15, 2006 23:09
by Pompei2
You can use a StaticImage widget, look in the samples for the exact usage.

Posted: Sat Dec 16, 2006 03:04
by realtiger
Is this the way to use StaticImage?

Code: Select all

    // load an image to use as a background
    ImagesetManager::getSingleton().createImagesetFromImageFile("BackgroundImage", "GPN-2000-001437.tga");

    // here we will use a StaticImage as the root, then we can use it to place a background image
    Window* background = winMgr.createWindow("TaharezLook/StaticImage", "background_wnd");
    // set position and size
    background->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0)));
    background->setSize(UVector2(cegui_reldim(1), cegui_reldim( 1)));
    // disable frame and standard background
    background->setProperty("FrameEnabled", "false");
    background->setProperty("BackgroundEnabled", "false");
    // set the background image
    background->setProperty("Image", "set:BackgroundImage image:full_image");


I think there should be a CEGUI::StaticImage class. :?:

Posted: Sat Dec 16, 2006 14:32
by Rackle
>> I think there should be a CEGUI::StaticImage class.

If you look at the stuff I've wikied, that's pretty much what I've done. These are helper classes, building higher level structures/classes to simplify Cegui usage.

You have created the static image via code. Myself I tend to create them via the layout editor, so I do not have a great need for a specific class; the layout editor fills in all those function calls for me (by specifying the attributes within the .layout file).

Posted: Sat Dec 16, 2006 15:14
by realtiger
I have tried

Code: Select all

staticImage = (CEGUI::StaticImage*)wndMgr.getWindow("Root/PlayWindow/Avatar01SImage");


But still get the error: StaticImage is not a member of CEGUI. So I have to use CEGUI::Window class and set image by using SetProperty method.