(C++)chatQue class [v0.2.3] Alpha Fade works w/ 1.2

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

The alpha fade works perfectly with the new irrlicht 1.2!

@ssexton- I have left your pure alpha fade code in: commented out for users who wish to have a pure alpha fade, but kept my original fade algorithm as default. They look virtually the same, but for users with irrlicht 1.1 or older, they will still get a fade to black rather then no fade at all.

@rogerborg- Thanks, currently the class is written to be easily dropped into your project with out having to compile irrlicht for it. But if someone with power to get this included in vanilla irrlicht showed interest I would gladly convert it.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Yay :D Ive added non word breaking word wrapping!

Just replace this on line 96:

Code: Select all

if(l_cutPosition != -1)
	{
        wcscpy(lmsg.message,text.subString(0,l_cutPosition).c_str()); 
	}
With:

Code: Select all

if(l_cutPosition != -1)
	{
	l_cutPosition = text.subString(0,l_cutPosition).findLast(32);
        wcscpy(lmsg.message,text.subString(0,l_cutPosition).c_str()); 
	}
I made it as a modification to an Irrlicht Chat client Im making.

@Rambus, as a favour, could you please add a way to change the colour of individual words? Or atleast be able to add a non line breaking message after another so that words can be individually coloured?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Sounds like you want a mashup of Rambus and Klasker's UI mods. Maybe we could send them on a date together? ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

Hey, happy to see you did the word wrapping :)

About colors,
Do you wan't a few basic colors to choose from (10 or so) or to be able to define any RGB value? Is this something you would wan't to work with other filters or a filter on its own?

I would imagine it would be easy to implement as a filter, with special reserved ascii values changing the color. For RGB values I could have an override color function that would allow you to replace a basic color with on of your choosing. Getting it to work with say pulse or shadow wouldent be hard (if we decided to make it a global thing rather then just a filter)

Hit me back with some ideas and when I have a few free hours I will implement it.

Edit: I took a look at Klasker's UI mod, If ascii values are going to be a pain to put in I could use #color# tags instead.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Yes a mash up would be great :D

The word wrapping was very simple to change as you can see it just searches the cut string for the last space (32 char value) and changes the cut off location to that.

Come to think of it, as a safety precaution incase you have a full line without a space change that to

Code: Select all

if(l_cutPosition != -1)
   {
        s32 spacepos = text.subString(0,l_cutPosition).findLast(32);
        if(spacepos != -1)
        l_cutPosition = spacepos;
        wcscpy(lmsg.message,text.subString(0,l_cutPosition).c_str());
   } 
Now if there are spaces they will be preserved, and if the whole line is just characters with no spaces the individual characters will be wrapped. I havent tested the code yet but it looks ok...
Last edited by BlindSide on Sat Feb 10, 2007 1:26 am, edited 1 time in total.
jrm
Posts: 111
Joined: Tue Dec 13, 2005 8:57 pm

Post by jrm »

Needs to be s32 instead of u32 :D

JRM
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

I will implement proper word wrapping based on your code when I add color codes or non terminal lines.
Might be a week or so until I get a chance to sit down with the code though, sorry for making you wait.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

jrm wrote:Needs to be s32 instead of u32 :D

JRM
Oh yeah! thx for that...how else will it equal -1 :oops:
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

Sorry for the delay,
The project I created this class for is going to go back into active development in a week or so here, so I will be adding the following features:
-Option to have a addMessage not append a linebreak. (Multicolor text)
-Render to a quad, so the chatQue can be scaled to apear the same on any resolution.
-Probably some more styles.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

:D Yay
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Maybe dsome sort of memory function, so that scrolling could be enabled?
-EDIT- Nvm, that would be the list... Hmm, I'll play around with it ^^, though a good interface would always be useful ^^ -EDIT-

BTW, I'm using your snippet right now and it works great, thx for your work ^^

Much obliged :)
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Actually if you can implement scrolling that would be great.
Post Reply