Page 1 of 1

Static Image help

Posted: Mon Nov 08, 2010 20:19
by Fra3ture
I'm trying to display a sprite at the top of my screen with my buttons for starting and exiting the game at the bottom. The problem is that my sprite wont render while my GUI is rendering.

I've looked about the place and I read that I need to use a static image to get my game title sprite on screen at the same time. Though I can't see any code examples on how to do this (i've looked through all of the samples that come with the 0.7.3 VC SDK and found nothing).

Is a static image the way I want to go in order to render a sprite at the same time? (It is just literally a banner that says "My game" across the top. It doesnt need to do anything fancy) If not could someone please tell what I should be doing?

Could I also get a code sample at the same time please?

Re: Static Image help

Posted: Tue Nov 09, 2010 00:22
by Jamarr
Fra3ture wrote:I'm trying to display a sprite at the top of my screen with my buttons for starting and exiting the game at the bottom. The problem is that my sprite wont render while my GUI is rendering.


There is nothing in CEGUI preventing you from rendering a sprite, 3d model, or anything else while rendering the GUI at the same time. So if it is "not working" you are most likely 1) not actually rendering them at the same time or 2) your dx state is not being managed properly and for some reason prevent your sprite from being rendered. What have you tried?

I've looked about the place and I read that I need to use a static image to get my game title sprite on screen at the same time... Is a static image the way I want to go in order to render a sprite at the same time? (It is just literally a banner that says "My game" across the top. It doesnt need to do anything fancy) If not could someone please tell what I should be doing?


And where did you read this? You can use a StaticImage, or perhaps other widgets, to render a sprite on screen but it is certainly not a requirement. In your case, it sounds like this sprite should be part of the GUI, in which case using a StaticImage should suffice. I assume here by "sprite" you mean "2D image"; the term "sprite" can very in meaning, though most notably a form of mimicking 3D using 2D "poses" / an image-map.

If you are trying to create some kind of animated / gif-like image, you may be able to use the animation-system for that; if not, you'll have to manage the animation yourself via the imageset system; eg manually updating the texture used by an imageset assigned to a StaticImage widget on a timer. (unless this has been alleviated, which I've not heard of).

Though I can't see any code examples on how to do this (i've looked through all of the samples that come with the 0.7.3 VC SDK and found nothing)...Could I also get a code sample at the same time please?


There are several samples provided in the SDK that use StaticImage's and there are several threads on the forums that discuss various uses of the StaticImage widget. I suggest reading the tutorials, searching the forum, playing with the samples (CEGUI\Samples), and figuring things out for yourself.

If you want help with specifics, after you try to figure it out yourself post the relevant code for the issue you are having and explain what you expect to happen, and what actually happens. If you want to actually learn something, you really need to attempt it yourself before asking for handouts.