Render an image on a Window

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

JoseMan
Just popping in
Just popping in
Posts: 15
Joined: Sun Nov 08, 2009 08:38

Render an image on a Window

Postby JoseMan » Sun Nov 08, 2009 08:45

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

User avatar
Jabberwocky
Quite a regular
Quite a regular
Posts: 86
Joined: Wed Oct 31, 2007 18:16
Location: Canada
Contact:

Re: Render an image on a Window

Postby Jabberwocky » Sun Nov 08, 2009 15:29

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.
The Salvation Prophecy
Space Combat. Planet Exploration. Strategic Domination.

JoseMan
Just popping in
Just popping in
Posts: 15
Joined: Sun Nov 08, 2009 08:38

Re: Render an image on a Window

Postby JoseMan » Sun Nov 08, 2009 17:06

Thanks Jabberwocky.
StaticImage is the keyword..... :)
I'll try it.

Bye J...

JoseMan
Just popping in
Just popping in
Posts: 15
Joined: Sun Nov 08, 2009 08:38

Re: Render an image on a Window

Postby JoseMan » Mon Nov 09, 2009 07:31

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

QuestOfDreams
Just popping in
Just popping in
Posts: 7
Joined: Wed Nov 04, 2009 16:32
Location: Austria
Contact:

Re: Render an image on a Window

Postby QuestOfDreams » Mon Nov 09, 2009 08:55

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");

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:

Re: Render an image on a Window

Postby scriptkid » Mon Nov 09, 2009 11:20

^^ That should still work :)
Check out my released snake game using Cegui!

JoseMan
Just popping in
Just popping in
Posts: 15
Joined: Sun Nov 08, 2009 08:38

Re: Render an image on a Window

Postby JoseMan » Tue Nov 10, 2009 13:37

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..

QuestOfDreams
Just popping in
Just popping in
Posts: 7
Joined: Wed Nov 04, 2009 16:32
Location: Austria
Contact:

Re: Render an image on a Window

Postby QuestOfDreams » Tue Nov 10, 2009 15:40



Return to “Help”

Who is online

Users browsing this forum: No registered users and 23 guests