For anyone needinga simple color tool, this is easy to add to your project.
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