Code:
void cFunction::DrawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...)
{
if(!g_pFont)
return;
RECT FontPos = { x, y, x + 120, y + 16 };
char buf[1024] = {'\0'};
va_list va_alist;
va_start(va_alist, fmt);
vsprintf_s(buf, fmt, va_alist);
va_end(va_alist);
g_pFont->DrawTextA(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
}
void cFunction::DrawCheckBox(bool Checked, long x, long y, LPDIRECT3DDEVICE9 pDevice)
{
Function.DXDrawBorderedBox((FLOAT)x,(FLOAT)y,11,11,(D3DCOLOR_ARGB(180,0,0,0)),(D3DCOLOR_ARGB(180,140,140,140)),pDevice);
if(Checked==true){Function.DXDrawBorderedBox((FLOAT)(x+3),(FLOAT)(y+3),5,5,(D3DCOLOR_XRGB(255,100,0)),(D3DCOLOR_XRGB(255,100,0)),pDevice);}
}
HRESULT cFunction::DXDrawBorderedBox(FLOAT x, FLOAT y, FLOAT h, FLOAT w,
DWORD color1, DWORD color2, LPDIRECT3DDEVICE9 pDevice)
{
struct croner { D3DXVECTOR4 p; DWORD c; } cr[5];
cr[0].p = D3DXVECTOR4(x+0-0.5f,y+h-0.5f,0.0f,1.0f); cr[0].c = color1;
cr[1].p = D3DXVECTOR4(x+0-0.5f,y+0-0.5f,0.0f,1.0f); cr[1].c = color1;
cr[2].p = D3DXVECTOR4(x+w-0.5f,y+h-0.5f,0.0f,1.0f); cr[2].c = color1;
cr[3].p = D3DXVECTOR4(x+w-0.5f,y+0-0.5f,0.0f,1.0f); cr[3].c = color1;
pDevice->SetTexture(0, NULL);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, cr, sizeof(croner));
cr[0].p = D3DXVECTOR4(x+0-0.5f,y+h-0.5f,0.0f,1.0f); cr[0].c = color2;
cr[1].p = D3DXVECTOR4(x+0-0.5f,y+0-0.5f,0.0f,1.0f); cr[1].c = color2;
cr[2].p = D3DXVECTOR4(x+w-0.5f,y+0-0.5f,0.0f,1.0f); cr[2].c = color2;
cr[3].p = D3DXVECTOR4(x+w-0.5f,y+h-0.5f,0.0f,1.0f); cr[3].c = color2;
cr[4].p = D3DXVECTOR4(x+0-0.5f,y+h-0.5f,0.0f,1.0f); cr[4].c = color2;
pDevice->SetTexture(0, NULL);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
pDevice->DrawPrimitiveUP(D3DPT_LINESTRIP, 4, cr, sizeof(croner));
return S_OK;
}
char NameOfLogFile[200]="C:\\StrideLog.txt";
void cFunction::Begin_Log(char* pMessage)
{
FILE* pfile;
if((pfile = fopen(NameOfLogFile,"w")) != NULL)
{
fprintf(pfile,"%s\n", pMessage);
fflush(pfile); // tastaturpuffer leeren
fclose(pfile);
}
}
void cFunction::Add_To_Log(char* pMessage)
{
FILE* pfile;
if((pfile = fopen(NameOfLogFile,"a")) != NULL)
{
fprintf(pfile,"%s\n", pMessage);
fflush(pfile);
fclose(pfile);
}
}
includes.h
Code:
#include "tabclasses.h"
cMouse Mouse;
cD3D Tab_D3D;
cPlayer Tab_Player;
cWeapon Tab_Weapon;
cMisc Tab_Misc;
POINT VPort;
bool footbar;
#define FocusColor D3DCOLOR_ARGB(200, 255, 255, 255)
#define NonFocusColor D3DCOLOR_ARGB(150, 0, 0, 255)
#define D3DTab_Pos 10
#define D3DTab_Len 33
#define D3DTab_StartPos 8
#define PlayerTab_Pos 80
#define PlayerTab_Len 45
#define PlayerTab_StartPos 78
#define WeaponTab_Pos 150
#define WeaponTab_Len 57
#define WeaponTab_StartPos 148
#define MiscTab_Pos 230
#define MiscTab_Len 33
#define MiscTab_StartPos 228
int TabIndex=1;
long ScrollbarPos;
long ScrollbarLen;
int D3Dindex;
int Playerindex;
int Weaponindex;
int Miscindex;
void TabControl(){
if(GetAsyncKeyState(VK_LEFT)&1){
TabIndex--;
if(TabIndex == 0){TabIndex = 4;}
}
if(GetAsyncKeyState(VK_RIGHT)&1){
TabIndex++;
if(TabIndex == 5){TabIndex = 1;}
}
if(TabIndex==1){ScrollbarPos = D3DTab_StartPos; ScrollbarLen = D3DTab_Len;}
if(TabIndex==2){ScrollbarPos = PlayerTab_StartPos; ScrollbarLen = PlayerTab_Len;}
if(TabIndex==3){ScrollbarPos = WeaponTab_StartPos; ScrollbarLen = WeaponTab_Len;}
if(TabIndex==4){ScrollbarPos = MiscTab_StartPos; ScrollbarLen = MiscTab_Len;}
}
void DrawFooter(LPDIRECT3DDEVICE9 pDevice){
if(footbar==true){Function.DXDrawBorderedBox(1, VPort.y - 20, 20, VPort.x - 1, D3DCOLOR_ARGB(150, 0, 0, 0), FocusColor, pDevice);}else{Function.DXDrawBorderedBox(1, VPort.y - 20, 20, VPort.x - 1, D3DCOLOR_ARGB(150, 0, 0, 0), NonFocusColor, pDevice);}
Function.DXDrawBorderedBox(ScrollbarPos, VPort.y - 17, 15, ScrollbarLen, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(150, 0, 255, 0), pDevice);
Function.DrawString(D3DTab_Pos, VPort.y - 17, 0xFFFFFFFF, Main.pFont, "D3D");
Function.DrawString(PlayerTab_Pos, VPort.y - 17, 0xFFFFFFFF, Main.pFont, "Player");
Function.DrawString(WeaponTab_Pos, VPort.y - 17, 0xFFFFFFFF, Main.pFont, "Weapon");
Function.DrawString(MiscTab_Pos, VPort.y - 17, 0xFFFFFFFF, Main.pFont, "Misc");
}
void DrawD3DTab(LPDIRECT3DDEVICE9 pDevice){
if(footbar==true){Function.DXDrawBorderedBox(Tab_D3D.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(150, 0, 0, 255), pDevice);}else{Function.DXDrawBorderedBox(Tab_D3D.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), FocusColor, pDevice);}
if(GetAsyncKeyState(VK_UP)&1){D3Dindex++; if(D3Dindex==4){D3Dindex=3;}}
if(GetAsyncKeyState(VK_DOWN)&1){D3Dindex--; if(D3Dindex==-1){D3Dindex=0;}}
if(GetAsyncKeyState(VK_NUMPAD0)&1){
if(D3Dindex==1){Tab_D3D.ItemThree =! Tab_D3D.ItemThree;}
if(D3Dindex==2){Tab_D3D.ItemTwo =! Tab_D3D.ItemTwo;}
if(D3Dindex==3){Tab_D3D.ItemOne =! Tab_D3D.ItemOne;}
}
if(D3Dindex==0){footbar=true;}else{footbar=false;}
Function.DrawString(Tab_D3D.X + 5, 105, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 1");
Function.DrawString(Tab_D3D.X + 5, 120, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 2");
Function.DrawString(Tab_D3D.X + 5, 135, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 3");
if(D3Dindex==1){Function.DrawString(Tab_D3D.X + 5, 135, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 3");}
if(D3Dindex==2){Function.DrawString(Tab_D3D.X + 5, 120, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 2");}
if(D3Dindex==3){Function.DrawString(Tab_D3D.X + 5, 105, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 1");}
if(Tab_D3D.ItemOne==true){Function.DrawString(Tab_D3D.X + 125, 105, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_D3D.X + 125, 105, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_D3D.ItemTwo==true){Function.DrawString(Tab_D3D.X + 125, 120, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_D3D.X + 125, 120, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_D3D.ItemThree==true){Function.DrawString(Tab_D3D.X + 125, 135, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_D3D.X + 125, 135, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
}
void DrawPlayerTab(LPDIRECT3DDEVICE9 pDevice){
if(footbar==true){Function.DXDrawBorderedBox(Tab_Player.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(150, 0, 0, 255), pDevice);}else{Function.DXDrawBorderedBox(Tab_Player.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), FocusColor, pDevice);}
if(GetAsyncKeyState(VK_UP)&1){Playerindex++; if(Playerindex==4){Playerindex=3;}}
if(GetAsyncKeyState(VK_DOWN)&1){Playerindex--; if(Playerindex==-1){Playerindex=0;}}
if(GetAsyncKeyState(VK_NUMPAD0)&1){
if(Playerindex==1){Tab_Player.ItemThree =! Tab_Player.ItemThree;}
if(Playerindex==2){Tab_Player.ItemTwo =! Tab_Player.ItemTwo;}
if(Playerindex==3){Tab_Player.ItemOne =! Tab_Player.ItemOne;}
}
if(Playerindex==0){footbar=true;}else{footbar=false;}
Function.DrawString(Tab_Player.X + 5, 105, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 1");
Function.DrawString(Tab_Player.X + 5, 120, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 2");
Function.DrawString(Tab_Player.X + 5, 135, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 3");
if(Playerindex==1){Function.DrawString(Tab_Player.X + 5, 135, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 3");}
if(Playerindex==2){Function.DrawString(Tab_Player.X + 5, 120, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 2");}
if(Playerindex==3){Function.DrawString(Tab_Player.X + 5, 105, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 1");}
if(Tab_Player.ItemOne==true){Function.DrawString(Tab_Player.X + 125, 105, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Player.X + 125, 105, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_Player.ItemTwo==true){Function.DrawString(Tab_Player.X + 125, 120, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Player.X + 125, 120, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_Player.ItemThree==true){Function.DrawString(Tab_Player.X + 125, 135, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Player.X + 125, 135, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
}
void DrawWeaponTab(LPDIRECT3DDEVICE9 pDevice){
if(footbar==true){Function.DXDrawBorderedBox(Tab_Weapon.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(150, 0, 0, 255), pDevice);}else{Function.DXDrawBorderedBox(Tab_Weapon.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), FocusColor, pDevice);}
if(GetAsyncKeyState(VK_UP)&1){Weaponindex++; if(Weaponindex==4){Weaponindex=3;}}
if(GetAsyncKeyState(VK_DOWN)&1){Weaponindex--; if(Weaponindex==-1){Weaponindex=0;}}
if(GetAsyncKeyState(VK_NUMPAD0)&1){
if(Weaponindex==1){Tab_Weapon.ItemThree =! Tab_Weapon.ItemThree;}
if(Weaponindex==2){Tab_Weapon.ItemTwo =! Tab_Weapon.ItemTwo;}
if(Weaponindex==3){Tab_Weapon.ItemOne =! Tab_Weapon.ItemOne;}
}
if(Weaponindex==0){footbar=true;}else{footbar=false;}
Function.DrawString(Tab_Weapon.X + 5, 105, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 1");
Function.DrawString(Tab_Weapon.X + 5, 120, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 2");
Function.DrawString(Tab_Weapon.X + 5, 135, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 3");
if(Weaponindex==1){Function.DrawString(Tab_Weapon.X + 5, 135, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 3");}
if(Weaponindex==2){Function.DrawString(Tab_Weapon.X + 5, 120, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 2");}
if(Weaponindex==3){Function.DrawString(Tab_Weapon.X + 5, 105, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 1");}
if(Tab_Weapon.ItemOne==true){Function.DrawString(Tab_Weapon.X + 125, 105, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Weapon.X + 125, 105, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_Weapon.ItemTwo==true){Function.DrawString(Tab_Weapon.X + 125, 120, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Weapon.X + 125, 120, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_Weapon.ItemThree==true){Function.DrawString(Tab_Weapon.X + 125, 135, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Weapon.X + 125, 135, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
}
void DrawMiscTab(LPDIRECT3DDEVICE9 pDevice){
if(footbar==true){Function.DXDrawBorderedBox(Tab_Misc.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(150, 0, 0, 255), pDevice);}else{Function.DXDrawBorderedBox(Tab_Misc.X, 100, 400, 150, D3DCOLOR_ARGB(150, 0, 0, 0), FocusColor, pDevice);}
if(GetAsyncKeyState(VK_UP)&1){Miscindex++; if(Miscindex==4){Miscindex=3;}}
if(GetAsyncKeyState(VK_DOWN)&1){Miscindex--; if(Miscindex==-1){Miscindex=0;}}
if(GetAsyncKeyState(VK_NUMPAD0)&1){
if(Miscindex==1){Tab_Misc.ItemThree =! Tab_Misc.ItemThree;}
if(Miscindex==2){Tab_Misc.ItemTwo =! Tab_Misc.ItemTwo;}
if(Miscindex==3){Tab_Misc.ItemOne =! Tab_Misc.ItemOne;}
}
if(Miscindex==0){footbar=true;}else{footbar=false;}
Function.DrawString(Tab_Misc.X + 5, 105, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 1");
Function.DrawString(Tab_Misc.X + 5, 120, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 2");
Function.DrawString(Tab_Misc.X + 5, 135, D3DCOLOR_ARGB(255, 0, 255, 255), Main.pFont, "Item 3");
if(Miscindex==1){Function.DrawString(Tab_Misc.X + 5, 135, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 3");}
if(Miscindex==2){Function.DrawString(Tab_Misc.X + 5, 120, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 2");}
if(Miscindex==3){Function.DrawString(Tab_Misc.X + 5, 105, D3DCOLOR_ARGB(255, 255, 255, 255), Main.pFont, "Item 1");}
if(Tab_Misc.ItemOne==true){Function.DrawString(Tab_Misc.X + 125, 105, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Misc.X + 125, 105, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_Misc.ItemTwo==true){Function.DrawString(Tab_Misc.X + 125, 120, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Misc.X + 125, 120, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
if(Tab_Misc.ItemThree==true){Function.DrawString(Tab_Misc.X + 125, 135, D3DCOLOR_ARGB(255, 0, 255, 0), Main.pFont, "On");}else{Function.DrawString(Tab_Misc.X + 125, 135, D3DCOLOR_ARGB(255, 255, 0, 0), Main.pFont, "Off");}
}
void MenuMain(LPDIRECT3DDEVICE9 pDevice){
if(TabIndex==1){DrawD3DTab(pDevice);}
if(TabIndex==2){DrawPlayerTab(pDevice);}
if(TabIndex==3){DrawWeaponTab(pDevice);}
if(TabIndex==4){DrawMiscTab(pDevice);}
DrawFooter(pDevice);
}
void tCheck(){
if(TabIndex==1){Tab_Player.X = -150; Tab_Weapon.X = -150; Tab_Misc.X = -150;}
if(TabIndex==2){Tab_D3D.X = -150; Tab_Misc.X = -150; Tab_Weapon.X = -150;}
if(TabIndex==3){Tab_D3D.X = -150; Tab_Misc.X = -150; Tab_Player.X = -150;}
if(TabIndex==4){Tab_Player.X = -150; Tab_Player.X = -150; Tab_Weapon.X = -150;}
}
DWORD WINAPI Timer(LPVOID){
while(true){
if(footbar==true){
TabControl();
if(TabIndex==1){if(Tab_D3D.X <= 100){Tab_D3D.X +=1; Sleep(1); tCheck();}}
if(TabIndex==2){if(Tab_Player.X <= 100){Tab_Player.X +=1; Sleep(1); tCheck();}}
if(TabIndex==3){if(Tab_Weapon.X <= 100){Tab_Weapon.X +=1; Sleep(1); tCheck();}}
if(TabIndex==4){if(Tab_Misc.X <= 100){Tab_Misc.X +=1; Sleep(1); tCheck();}}
}
}
}
void InitTabs(){
CreateThread(NULL, NULL, Timer, NULL, NULL, NULL);
}
tabclasses.h