How to add images "freely" among text.

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

yllfever
Just popping in
Just popping in
Posts: 8
Joined: Mon Mar 09, 2009 08:21

How to add images "freely" among text.

Postby yllfever » Tue Mar 17, 2009 03:49

Hi, all.

Just like in the MSN, we will need to send faces or other larger images,
when chatting.

I'm writing a chatbox, how can I display text mixed with freely placed images? Is it possible just using a ItemListbox with my own ItemEnty?

Any suggestion will be appreciated.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Tue Mar 17, 2009 11:42

Hi,

To do it 'freely' is pretty difficult at the moment.

The "best" way is probably to encode all the information in the text string and parse that into a sequence of sub-strings and images that you then render.

CE.

yllfever
Just popping in
Just popping in
Posts: 8
Joined: Mon Mar 09, 2009 08:21

Postby yllfever » Wed Mar 18, 2009 04:01

Thanks for your reply, CE. You are alwlays patient, and your replies are helpful.

As there is no easy way, I'll have to create a new window type like "RichEditbox".

I've read some of the source files of CEGUI. But I didn't find where to put my window's text and images to the renderer.

How is a CEGUI window get itself rendered?

There is a

Code: Select all

 virtual void populateRenderCache() 

method in the Window class. But none of the derived class override it, like Editbox, MultiLineEditbox, etc.

So, if i want to mentain the content myself, how can I get my content rendered?

[/code]

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Wed Mar 18, 2009 09:44

Hi,

The rendering is handled by a separate object called a CEGUI::WindowRenderer (the defaults for these are in the FalagardWRBase module). The idea is that the core functionality of any given widget type should totally independent of it's visual aspect, so in CEGUI we have these two items separate (with varying degrees of success; but hey, it's a work in progress :P).

The default approach we use in the library is for the WindowRenderer for a given widget type to get most of it's basic form via a falagard looknfeel WidgetLook specification. WindowRenderer types are mapped to Window types along with a LookNFeel within the scheme file.

Having said this, the use of the WindowRenderer is not a requrement; certainly not for user project widgets where customisation is less of an issue than it is for us as library providers ;) You can just as easily dispense with WindowRenderer objects and override that populateRenderCache function.

One key thing to understand is that when you 'draw' things in that function (or via the WindowRenderer), you're not actually drawing it immediately; rather you're queueing things to be drawn at a later time. You do this by using the Window objects RenderCache, and add images and text strings to that, which will be drawn later at an appropriate time.

Anyway, take a look in the FalagardWRBase files, since that's where the rendering 'action' takes place.

HTH

CE

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sun Mar 22, 2009 12:36

Hey, here is a post that might interest you: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=339

but be double-triple-sure to verify the code before you add it to your cegui, I remember there were little memory overflows that make the game crash here and then, if they are not fixed.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 1 guest