unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > Direct3D

- Sponsored Advertisement -
http://www.myfpscheats.com/


Reply
 
Thread Tools Display Modes
  #1  
Old 02-09-2009, 04:50 AM
Alkatraz Alkatraz is offline
Administrator
 
Join Date: Jan 2007
Posts: 72
Default [Source] Simple Color Tool

Credits to Stevepwns

For anyone needinga simple color tool, this is easy to add to your project.
Use what ever rendering method your familiar with



Code:
/*/----------------------------\ \
	ColorTool.h
	-----------

	Author: StevePwns aka(SRV)

\ \----------------------------/*/

#ifndef _COLORTOOL_H
#define _COLORTOOL_H

#define MAX_VALUE     255
#define MIN_VALUE       0

#define ENOUGH_SPACE  140
#define NEXT_LINE      15
#define JUMP            5


#define MORE_COLOR   0x63
#define LESS_COLOR   0x62
#define UP_KEY       0x69   //numpad 9
#define DOWN_KEY     0x66   //numpad 6
#define SELECT       0x61

enum ToolColors{
	eRed, 
	eGreen,
	eBlue,
	eElse
};

struct ColorTool
{
	 int x,y;
	 int ired,igreen,iblue;
	 int selection;


};ColorTool tool;

void initctool(int x, int y)
{
	tool.x = x;
	tool.y = y;

	tool.ired   = MAX_VALUE;
	tool.igreen = MAX_VALUE;
	tool.iblue  = MAX_VALUE;

	tool.selection = eRed;
}

void ToolControls()
{
	if (GetAsyncKeyState(UP_KEY)  &1){tool.selection -= 1;}
	if (GetAsyncKeyState(DOWN_KEY)&1){tool.selection += 1;}
    if (tool.selection < eRed) {tool.selection = eBlue;}
	if (tool.selection > eBlue){tool.selection = eRed;}

		switch (tool.selection)
		{
		case eRed:
			 if (GetAsyncKeyState(LESS_COLOR)&1){tool.ired -= JUMP;}
			 if (GetAsyncKeyState(MORE_COLOR)&1){tool.ired += JUMP;}
			 if (tool.ired < MIN_VALUE)         {tool.ired = MIN_VALUE;}
			 if (tool.ired > MAX_VALUE)         {tool.ired = MAX_VALUE;}

			 MyDrawText(tool.x,                tool.y, "<<", 0, 0, 0);
			 MyDrawText(tool.x + ENOUGH_SPACE, tool.y, ">>", 0, 0, 0);
			 break;

		case eGreen:
			 if (GetAsyncKeyState(LESS_COLOR)&1){tool.igreen -= JUMP;}
			 if (GetAsyncKeyState(MORE_COLOR)&1){tool.igreen += JUMP;}
			 if (tool.igreen < MIN_VALUE)       {tool.igreen = MIN_VALUE;}
			 if (tool.igreen > MAX_VALUE)       {tool.igreen = MAX_VALUE;}

			 MyDrawText(tool.x,                tool.y + NEXT_LINE, "<<", 0, 0, 0);
			 MyDrawText(tool.x + ENOUGH_SPACE, tool.y + NEXT_LINE, ">>", 0, 0, 0);
			 break;

		case eBlue:
			 if (GetAsyncKeyState(LESS_COLOR)&1){tool.iblue -= JUMP;}
			 if (GetAsyncKeyState(MORE_COLOR)&1){tool.iblue += JUMP;}
			 if (tool.iblue < MIN_VALUE)        {tool.iblue = MIN_VALUE;}
			 if (tool.iblue > MAX_VALUE)        {tool.iblue = MAX_VALUE;}

			 MyDrawText(tool.x,                tool.y + (NEXT_LINE * 2), "<<", 0, 0, 0);
			 MyDrawText(tool.x + ENOUGH_SPACE, tool.y + (NEXT_LINE * 2), ">>", 0, 0, 0);
			 break;
		}
}

void RenderTool()
{
	char pred[4];
	char pgreen[4];
	char pblue[4];

	ToolControls();
	MyDrawText(tool.x, tool.y - NEXT_LINE, "Color Tool", 0, 0, 0);

	MyDrawText2(tool.x + 20, tool.y,                   "RED",   MAX_VALUE,         0,         0);
	MyDrawText2(tool.x + 20, tool.y +  NEXT_LINE,      "GREEN",         0, MAX_VALUE,         0);
	MyDrawText2(tool.x + 20, tool.y + (NEXT_LINE * 2), "BLUE",          0,         0, MAX_VALUE);

	sprintf_s(pred,   "%i", tool.ired);
	sprintf_s(pgreen, "%i", tool.igreen);
	sprintf_s(pblue,  "%i", tool.iblue);

	MyDrawText2(tool.x + (ENOUGH_SPACE - 40),tool.y,                   pred,  tool.ired,           0,          0);
	MyDrawText2(tool.x + (ENOUGH_SPACE - 40),tool.y +  NEXT_LINE,      pgreen,        0, tool.igreen,          0);
	MyDrawText2(tool.x + (ENOUGH_SPACE - 40),tool.y +( NEXT_LINE * 2), pblue,         0,           0, tool.iblue);

	MyDrawText2(tool.x + 20, tool.y +( NEXT_LINE * 3), "FINAL COLOR", tool.ired, tool.igreen, tool.iblue);
}

#endif
Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
color, simple, source, tool

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 08:22 AM.