Color Changing Text

Posts 1–15 of 15 · Page 1 of 1
Color Changing Text
I need help with a code, to send text through a rainbow effect, on the menu of a hack. I did a little research, but didnt find too many helpful articles about this specifically.. most of them were about changing the color of a window or text, but only once.

I want the title for my hack, to change colors constantly, but only as long as the menu is open.

What I Tried:
Code:
void HueRot(constchar* text)
{
int CR = 0; //ColorRed
int CG = 0; //ColorGreen
int CB = 0; //ColorBlue
int RC = 0; //ResetColors
if (RC == 0)
for(CR = 0; CR<255; CR++) //Fade from black to red
{if (CR < 255)
DrawString(x, y, D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif(CR == 255)
for(CG = 0; CG<255; CG++) //Fade from red to yellow
{if (CG < 255)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CG == 255)
for(CB = 0; CB<255; CB++) //Fade from yellow to white
{if (CB < 255)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CB == 255)
RC = 1; //All colors max, start subraction
}
}
}
elseif (RC == 1)
for(CR = 255; CR>0; CR--) //Fade from white to blue-green (teal/turqoise)
{if (CR > 0)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif(CR == 0)
for(CG = 255; CG>0; CG--) //Fade from blue-green to blue
{if (CG > 0)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CG == 0)
for(CB = 255; CB>0; CB--) //Fade from blue to black
{if (CB > 0)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CB == 0)
RC = 0; //All colors min, start addition
}
}
}
}


I'm sure im not the only one who thinks this is a good idea..
Quote Originally Posted by Grim View Post
I need help with a code, to send text through a rainbow effect, on the menu of a hack. I did a little research, but didnt find too many helpful articles about this specifically.. most of them were about changing the color of a window or text, but only once.

I want the title for my hack, to change colors constantly, but only as long as the menu is open.

What I Tried:
Code:
void HueRot(constchar* text)
{
int CR = 0; //ColorRed
int CG = 0; //ColorGreen
int CB = 0; //ColorBlue
int RC = 0; //ResetColors
if (RC == 0)
for(CR = 0; CR<255; CR++) //Fade from black to red
{if (CR < 255)
DrawString(x, y, D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif(CR == 255)
for(CG = 0; CG<255; CG++) //Fade from red to yellow
{if (CG < 255)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CG == 255)
for(CB = 0; CB<255; CB++) //Fade from yellow to white
{if (CB < 255)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CB == 255)
RC = 1; //All colors max, start subraction
}
}
}
elseif (RC == 1)
for(CR = 255; CR>0; CR--) //Fade from white to blue-green (teal/turqoise)
{if (CR > 0)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif(CR == 0)
for(CG = 255; CG>0; CG--) //Fade from blue-green to blue
{if (CG > 0)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CG == 0)
for(CB = 255; CB>0; CB--) //Fade from blue to black
{if (CB > 0)
DrawString(x, y,D3DCOLOR_ARGB( 255, CR, CG, CB), pFont, text);
elseif (CB == 0)
RC = 0; //All colors min, start addition
}
}
}
}


I'm sure im not the only one who thinks this is a good idea..

As a general improvement I'd do it like this:

Code:
int Col = 2;
char Turn = 0;
int Mul = 1;

for( ; Col <= 255; Col += 1*Mul ){
if(Col == 255){
   Mul = Mul*-1;
}

if(Col == 1){
   switch(Turn){

	   case 2:
         Turn = 0;
		 break;
       default: 
         Turn++;
		 break;
    }
    Mul = Mul*-1;
}
   switch (Turn){
	   
         case 0:
                DrawString(x, y, D3DCOLOR_ARGB( 255, Col, 0, 0), pFont, text);
				 
         break;
         case 1: 
                DrawString(x, y, D3DCOLOR_ARGB( 255, 0, Col, 0), pFont, text);
				 
         break;
         case 2:
               DrawString(x, y, D3DCOLOR_ARGB( 255, 0, 0, Col), pFont, text);
         break;          
   }




}
Maybe it isn't exactly what you're looking for, but it's easy to modify and tweak to your needs
Hmmz i guess you could make a timer..
and if the timer equals 1 second D3DCOLOR mColor = Blah blah
if 2 seconds mColor = blah blah and so on ...
Im test this out myself just too see
Quote Originally Posted by .::SCHiM::. View Post
As a general improvement I'd do it like this:

Code:
 
int Col = 2;
char Turn = 0;
int Mul = 1;
 
for( ; Col <= 255; Col += 1*Mul ){
if(Col == 255){
   Mul = Mul*-1;
}
 
if(Col == 1){
   switch(Turn){
 
       case 2:
         Turn = 0;
         break;
       default: 
         Turn++;
         break;
    }
    Mul = Mul*-1;
}
   switch (Turn){
 
         case 0:
                DrawString(x, y, D3DCOLOR_ARGB( 255, Col, 0, 0), pFont, text);
 
         break;
         case 1: 
                DrawString(x, y, D3DCOLOR_ARGB( 255, 0, Col, 0), pFont, text);
 
         break;
         case 2:
               DrawString(x, y, D3DCOLOR_ARGB( 255, 0, 0, Col), pFont, text);
         break;          
   }
 
 
 
 
}
Maybe it isn't exactly what you're looking for, but it's easy to modify and tweak to your needs
easy to tweak yea, but reading it, it doesn't look as tho it would work.. have you tested that at all?

Quote Originally Posted by whit View Post
Hmmz i guess you could make a timer..
and if the timer equals 1 second D3DCOLOR mColor = Blah blah
if 2 seconds mColor = blah blah and so on ...
Im test this out myself just too see
awesome.. thanks whit
Quote Originally Posted by Grim View Post


easy to tweak yea, but reading it, it doesn't look as tho it would work.. have you tested that at all?



awesome.. thanks whit
Yep it works, printf() ftw
/short

@Hell_Demon

FUUUUU, you toped mine
x += 1;
COLORREF RainBOSS = RGB((170+x)%255, (85+x)%255, x%255)
if(x == 255) x = 0;

Too lazy to test which colors that would loop, but i'm sure it'll look gay =p
Quote Originally Posted by Hell_Demon View Post
x += 1;
COLORREF RainBOSS = RGB((170+x)%255, (85+x)%255, x%255)
if(x == 255) x = 0;

Too lazy to test which colors that would loop, but i'm sure it'll look gay =p
@Hell_Demon so this would work right?
Code:
int x = 0;
int CR;
int CG;
int CB;
int CA = 255;
x += 1;
CR = (170+x)%255;
CG = (85+x)%255;
CB = x%255;
if(x == 255)
if(CA = 255)
{x = 0;
CA = 155;}
elseif(CA = 155)
{x = 0;
CA = 255;}
DrawString(x, y, D3DCOLOR_ARGB( CA, CR, CG, CB), font, text)

Quote Originally Posted by Grim View Post


@Hell_Demon so this would work right?
Code:
int x = 0;
int CR;
int CG;
int CB;
int CA = 255;
x += 1;
CR = (170+x)%255;
CG = (85+x)%255;
CB = x%255;
if(x == 255)
if(CA = 255)
{x = 0;
CA = 155;}
elseif(CA = 155)
{x = 0;
CA = 255;}
DrawString(x, y, D3DCOLOR_ARGB( CA, CR, CG, CB), font, text)

Loop the code that does the work and I think you are good
job Hell_Demon
it works, but the color change its super fast, laggy as hell, and the menu doesn't show. If i add any sort of a sleep to it, the game will just lock up and crash. even a sleep of 300 the game just locks up.

what should i do?
Quote Originally Posted by Grim View Post
it works, but the color change its super fast, laggy as hell, and the menu doesn't show. If i add any sort of a sleep to it, the game will just lock up and crash. even a sleep of 300 the game just locks up.

what should i do?
Ok so we have a problem. We need to slow down our color changing. Now how can we do this you ask? First of all, loop the work. Then try addind like a 30 sleep after each color u go through. Mind sending me the SC so I can try addind a sleep? I mean like the whole code for the entire hack and tell me what game.
Quote Originally Posted by fukojr2 View Post


Ok so we have a problem. We need to slow down our color changing. Now how can we do this you ask? First of all, loop the work. Then try addind like a 30 sleep after each color u go through. Mind sending me the SC so I can try addind a sleep? I mean like the whole code for the entire hack and tell me what game.
You cant add Sleep in a Directx Function
Quote Originally Posted by whit View Post

You cant add Sleep in a Directx Function
what if i dont loop it, and just have it called with every hotkey pressed? Insert to show the menu will give one color, up another, down another left and right too?

that would work while i try to find a way to loop it constantly

EDIT: fucking brilliant. i got it working flawlessly.
Quote Originally Posted by Grim View Post

what if i dont loop it, and just have it called with every hotkey pressed? Insert to show the menu will give one color, up another, down another left and right too?

that would work while i try to find a way to loop it constantly

EDIT: fucking brilliant. i got it working flawlessly.
You got some sort of scene hooked right? Those are in a loop already, no need to put another one inside it. if not, create a new thread...
Quote Originally Posted by .::SCHiM::. View Post
You got some sort of scene hooked right? Those are in a loop already, no need to put another one inside it. if not, create a new thread...
the man speaks actions i already took. lol thanks for all the help guys.
Posts 1–15 of 15 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us