Page 1 of 1

Render an image on a Window

Posted: Sun Nov 08, 2009 08:45
by JoseMan
Hi there,

1st: CEGUI is a nice Lib (or Framework?).
2nd: The registration to the forum was a bit difficult/confused for me.... but now I'm happy :) .

Okay, to my question.

I want to render an image on a CEGUI-Window, for example on a button or on a window (used as a frame) under a button.
I can't find anything about it in the documentation, but I saw something like that here.

Can anybody give me an advise, or a code-snippet

Re: Render an image on a Window

Posted: Sun Nov 08, 2009 15:29
by Jabberwocky
Just use a StaticImage widget. If you want it to be the size of your whole window, make the StaticImage widget the size of the entire window.

In CEGUI 0.6.x, StaticImage widgets look something like this in your.layout file:

Code: Select all

      <Window Type='TaharezLook/StaticImage' Name='PlanetPicture'>
         <Property Name='UnifiedSize' Value='{{0.7,0},{0.4,0}}'/>
         <Property Name='UnifiedPosition' Value='{{0.15,0},{0.05,0}}'/>
         <Property Name='Image' Value='set:PlanetImages image:Jupiter'/>
         <Property Name='FrameEnabled' Value='false'/>
         <Property Name='BackgroundEnabled' Value='false'/>
         <Property Name='RiseOnClick' Value='false'/>
      </Window>


StaticImage widgets specify their images from an "imageset":
<Property Name='Image' Value='set:PlanetImages image:Jupiter'/>

You'll have to create and load an imageset file with any extra images you want to display in CEGUI.

That should be enough information to start you off. You can search the forums or look through the CEGUI samples for more details.

Re: Render an image on a Window

Posted: Sun Nov 08, 2009 17:06
by JoseMan
Thanks Jabberwocky.
StaticImage is the keyword..... :)
I'll try it.

Bye J...

Re: Render an image on a Window

Posted: Mon Nov 09, 2009 07:31
by JoseMan
Okay, another problem:
BTW: My english is a little bit terrible. :oops:
I want to have a flexible image.
When someting is happen use XYZ.tga as image,
when something else is happen use ABC.tga..... and so on.
In my game, there can be 20-30 possibilities for the use of an image.

How I realize that?

Sorry, I'm totaly noob on CEGUI...

Bye JoseMan

Re: Render an image on a Window

Posted: Mon Nov 09, 2009 08:55
by QuestOfDreams
You can set the actual image of the widget using the setProprty function as demonstrated in Demo7 (hope this hasn't changed since version 0.6.2)
e.g.

Code: Select all

Window* img = WindowManager::getSingleton().getWindow("Example/Window/StaticImage");
img->setProperty("Image", "set:BackgroundImage image:full_image");

Re: Render an image on a Window

Posted: Mon Nov 09, 2009 11:20
by scriptkid
^^ That should still work :)

Re: Render an image on a Window

Posted: Tue Nov 10, 2009 13:37
by JoseMan
Yes, that works. Thanks.
I begin to understand how CEGUI works :D .
How I know which properties there are exist?
Can anybody tell me, where I can find a list of properties?
Should I take a look in the *.scheme files, or something like this?

I'm using the latest releas of CEGUI.

(Mayby a stupid question?)
(Sorry for that question, but I'm at work and I don't have my code here. And at home I'm not online :( )

Ciao JoseMan..

Re: Render an image on a Window

Posted: Tue Nov 10, 2009 15:40
by QuestOfDreams