Page 1 of 2

CGUIExtendedText (colored text and images)

Posted: Wed Jan 17, 2007 5:37 pm
by Klasker
The static text element didn't really cut it for me so I made a new GUI component that supports text of different colors and fonts, images (inline and anchored), tabs, and horizontal lines(!).

Screens:
ImageImageImage

The scrollbar isn't part of the element, but another element I made which I called CGUIPanel. It simply adds a scrollbar to scroll through the elements inside it.

So how does it work? I invented a simple syntax that lets you add "control tags" in the text. So if I write:
This is an armor: #img:armor#. This #col:red#text is red#col#.
It will look like this:
This is an armor: Image. This text is red.
These are all the tags supported:
  • #img:(name):(anchor)# : Displays an image. If anchor is specified (optional) it will be anchored to either left or right.
  • #col:xxxx# ... #col# : Changes text color. #col# returns to original color.
  • #font:xxxx# ... #font# : Changes font. #font# returns to original font.
  • #tab# : Indents the text. Similar to pressing the TAB key.
  • #hline# : Inserts a horizontal line. Uses the text color. Width can be specified by writing #hline:2# for a 2-pixel thick line.
  • #align#: Changes text alignment. #align:center# is centered text and #align:right# is right-aligned text. #align# makes it left-aligned again.
So what you waiting for? Download it now.
NOTE: It uses the core::map<> class from the SVN version, so I included "irrMap.h" in the download (so you don't need SVN to use it). I hope that's OK with everyone.

Now that I see what can be done with this, I think I'll now take it one step further and make an HTML-like GUI component. I'm thinking I could make an entire GUI out of HTML-like code. That would be awesome! That would pretty much obsolete this component, but I thought I'd share what I found anyways.

If you like it, please tell me what you think 8)
If you don't like it, please press Alt+F4. :evil:

Posted: Wed Jan 17, 2007 6:42 pm
by bitplane
wow, great idea, looks amazing too. nice work :)
*opens msn*

Posted: Wed Jan 17, 2007 8:28 pm
by Spintz
This is awesome!! I haven't yet looked at the code but the examples look sweet. Mine, if I add it to IrrSpintz? I'd have to change it to use STL Map and probably some other things...but I'd love to add it!!!

Posted: Wed Jan 17, 2007 10:18 pm
by Klasker
Spintz wrote:This is awesome!! I haven't yet looked at the code but the examples look sweet. Mine, if I add it to IrrSpintz? I'd have to change it to use STL Map and probably some other things...but I'd love to add it!!!
Sure you can add it. Though, I'm working on the HTML GUI component right now, so you might want to wait and see if something better comes up.

Posted: Thu Jan 18, 2007 11:08 am
by IPv6
Heh, i did the same thing for my game (still in progress)...
As a suggestion for futher improvement: you can add tag that make text between certain tags dynamic (jumping chars for example) since you do paining for yourself anyway :) quite funny! :)

Posted: Thu Jan 18, 2007 2:40 pm
by BlindSide
very very nice! I could use this...

Posted: Thu Jan 18, 2007 5:04 pm
by RapchikProgrammer
Awesome work dude, i might need something like this for my game. Thanx a lot!

Posted: Thu Jan 18, 2007 11:54 pm
by Midnight
ooooh aaaah! 8)

Posted: Fri Jan 19, 2007 6:49 pm
by KillerXX7
Looks really cool :!:

Posted: Tue Jan 23, 2007 8:04 pm
by rogerborg
Superb work! I hope this gets integrated.

Posted: Tue Jan 23, 2007 8:33 pm
by krama757
Dammit Klasker, how are you so damn cool! :) Thanks a bunch.

Posted: Tue Jan 30, 2007 10:23 pm
by Klasker
It's been nearly two weeks now so I thought I'd give a heads up about the HTML renderer I mentioned. I made a working HTML renderer so far, with all the features of old version, and <table> tags and nested tags. BUT the code is not very good. In fact, the CHTMLContainer class has become a blob class full of spaghetti code, which is why I am not releasing anything at the moment. I want to release something decent instead, and next time it may not be based on true HTML but rather a similar XML-based language.

Bitplane mentioned having IGUIElements as HTML elements, and I want that possible too, but with the design I came up with it didn't seem to be very feasible. But that's probably because of the way IGUIElement works: It will only take the clipping plane from its parent, so I have to make IHTMLElement an IGUIElement too. Geez!

Technically it's working now, but if this is to be useful it needs to be better than that, so I'll be back when I have something better.

Posted: Tue Jan 30, 2007 11:14 pm
by rogerborg
Wonderful, thanks for keeping us posted.

One thing to bear in mind is that it's perhaps easier (for hybrid and bitplane) to get new functionality integrated if you submit it in smaller patches and updates, rather than big blobs.

Posted: Sun Feb 18, 2007 11:53 am
by Virion
Looks professional. Keep it up. :D

Posted: Tue May 01, 2007 10:56 pm
by mooreaa
Hmm sorry to hear about the HTML version giving u problems. Have you looked at using an external parser like TinyXML?

Looks really cool, can't wait for the next version. Keep us updated!