New D3D Tab Menu

Posts 115 of 21 · Page 1 of 2
New D3D Tab Menu [With Code]
hey guys i wanna present u my new tab menu

Goto 10:45 to see the result




Source:
Get the detours by your own or use yours!

main.cpp
Code:
#include "main.h"
#include "includes.h"
#include "funktionen.h"
#include "menucore.h"

cMain Main;
cFunction Function;
oReset pReset;
oPresent pPresent; 
oBeginScene pBeginScene;
oEndScene pEndScene;
oDrawIndexedPrimitive pDrawIndexedPrimitive;
oSetStreamSource pSetStreamSource;


D3DVIEWPORT9 vPort;
HRESULT WINAPI MyPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion){
    _asm pushad;
	pDevice->GetViewport(&vPort);
	VPort.x = vPort.Width;
	VPort.y = vPort.Height;


	if(Main.pFont == NULL){
		D3DXCreateFontA(pDevice, 14,7,FW_NORMAL, 0,0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH  | FF_DONTCARE, Font_Name, &Main.pFont);
	}else{
	Function.DrawString(10,10,0xFFFFFFFF,Main.pFont,"Kvn Test Menu");
	}

	GetCursorPos(&Mouse.mCur);
	Mouse.X = Mouse.mCur.x;
	Mouse.Y = Mouse.mCur.y;
	if(Main.pFont != NULL){MenuMain(pDevice);}
    _asm popad;

    return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}


HRESULT WINAPI MyReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
	_asm pushad;
	Main.pFont->OnLostDevice();
	Main.tFont->OnLostDevice();

	HRESULT hRet = pReset(pDevice, pPresentationParameters);

	if(SUCCEEDED(hRet))
		Main.pFont->OnResetDevice();
		Main.tFont->OnResetDevice();

	_asm popad;

	return pReset(pDevice, pPresentationParameters);
}


DWORD *FindDevice(VOID)
{
    DWORD Base = (DWORD)LoadLibraryW(L"d3d9.dll");

    for(DWORD i = 0; i < 0x128000; i++ )
    {
      if ( (*(BYTE *)(Base+i+0x00))==0xC7
        && (*(BYTE *)(Base+i+0x01))==0x06
        && (*(BYTE *)(Base+i+0x06))==0x89
        && (*(BYTE *)(Base+i+0x07))==0x86
        && (*(BYTE *)(Base+i+0x0C))==0x89
        && (*(BYTE *)(Base+i+0x0D))==0x86 )
        return (DWORD *)(Base + i + 2);
    }
    return NULL;
}

DWORD WINAPI Hook(LPVOID)
{
    while(GetModuleHandleA("d3d9.dll") == NULL)
  Sleep(100);
    DWORD * VtablePtr = FindDevice();
    DWORD* devicePtr = ***(DWORD****)VtablePtr;
    DWORD * VTable ;
    *(DWORD *)&VTable = *(DWORD *)VtablePtr;

 pPresent = (oPresent) (DWORD)VTable[hPresent] ;
    DetourTransactionBegin();
    DetourUpdateThread(GetCurrentThread());
    DetourAttach(&(PVOID&)pPresent, MyPresent);
    DetourTransactionCommit();

 pReset = (oReset) (DWORD)VTable[hReset];
    DetourTransactionBegin();
    DetourUpdateThread(GetCurrentThread());
    DetourAttach(&(PVOID&)pReset, MyReset);
    DetourTransactionCommit();
  
 return 0;
}

bool HookReady()
{
	if( GetModuleHandle( L"d3d9.dll" ) != NULL  )
	   return true;
	return false;
}


DWORD WINAPI dwHookThread(LPVOID)
{
	while(!HookReady())
		Sleep(25);
	CreateThread(NULL, NULL, Hook, NULL, NULL, NULL);
	return EXIT_SUCCESS;
}

BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
	DisableThreadLibraryCalls(hDll);
	if ( dwReason == 1 ){
		InitTabs();
		CreateThread(NULL, NULL,dwHookThread, NULL, NULL, NULL); 
	}
	return TRUE;
}
funktionen.h
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:
#define _CRT_SECURE_NO_WARNINGS
#pragma warning( disable: 4172 )
#pragma warning( disable: 4700 )
#pragma warning( disable: 4244 )
#pragma warning( disable: 4715 )
#pragma warning( disable: 4800 )
#pragma warning( disable: 4101 )
#pragma warning( disable: 4804 )
#pragma warning( disable: 4430 )

#pragma warning( disable: 4482 )
#pragma warning( disable: 4102 )
#pragma warning( disable: 4305 )
#pragma warning( disable: 4099 )
#pragma warning( disable: 4305 )
#pragma warning( disable: 4996 )

#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "Wininet.lib")
#pragma comment(lib, "ws2_32")
#pragma comment(lib, "WinInet.lib")
#pragma comment(lib, "detours.lib")

#include <windows.h>
#include <Winuser.h>
#include <stdio.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <fstream>
#include <stdio.h>
#include <ctime>
#include <mmsystem.h>
#include <wininet.h>
#include <process.h>
#include <conio.h>
#include <wininet.h>
#include <iostream>
#include "detours.h"
main.h
Code:
#include "includes.h"
typedef HRESULT (WINAPI* oPresent)(LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion);
typedef HRESULT (WINAPI* oReset)(LPDIRECT3DDEVICE9 pDevice,D3DPRESENT_PARAMETERS* Parametri);
typedef HRESULT (WINAPI* oBeginScene)(LPDIRECT3DDEVICE9 pDevice);
typedef HRESULT (WINAPI* oEndScene)(LPDIRECT3DDEVICE9 pDevice);
typedef HRESULT (WINAPI* oDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
typedef HRESULT (WINAPI* oSetStreamSource)(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride);

#define D3D9_Name L"d3d9.dll"
#define Font_Name "Arial"
#define hReset     16
#define hPresent   17
#define hBeginScene 41
#define hEndScene 42
#define hSSS 100
#define hDIP 82

#define Len_size 12
#define _Menu
#define _Main

class cMain
{
public: 
	LPD3DXFONT pFont;
	LPD3DXFONT tFont;
	LPDIRECT3DDEVICE9 pDevice;
};

extern class cMain Main;

class cFunction
{
public: 
	void DrawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...) ;
	HRESULT DXDrawBorderedBox(FLOAT x, FLOAT y, FLOAT h, FLOAT w, DWORD color1, DWORD color2, LPDIRECT3DDEVICE9 pDevice);
	void DrawCheckBox(bool Checked, long x, long y, LPDIRECT3DDEVICE9 pDevice);
	void Begin_Log(char* pMessage);
	void Add_To_Log(char* pMessage);
};

class cMouse
{
public:
	POINT mCur;
	int X;
	int Y;
};


extern class cMouse Mouse;
extern class cFunction Function;
menucore.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
Code:
class cD3D
{
public: 
	long X;
	long Y;
	bool ItemOne;
	bool ItemTwo;
	bool ItemThree;

};

class cPlayer
{
public: 
	long X;
	long Y;
	bool ItemOne;
	bool ItemTwo;
	bool ItemThree;
};

class cWeapon
{
public: 
	long X;
	long Y;
	bool ItemOne;
	bool ItemTwo;
	bool ItemThree;

};

class cMisc
{
public: 
	long X;
	long Y;
	bool ItemOne;
	bool ItemTwo;
	bool ItemThree;
};


extern class cD3D D3D;
extern class cPlayer Player;
extern class cWeapon Weapon;
extern class cMisc Misc;
Credits: Me
Nice work. I was working on the "Slide out" effect myself since it seemed really cool.

Nice to see others trying new things as well. Good work
Quote Originally Posted by RedAppleCoder View Post
Smooth movings look great everytime
I just noticed, correct me if I'm wrong, but you have no menu options. You're just drawing them. There's no use of them.
Quote Originally Posted by Dragon(H)ell View Post
I thought that too in first but I think you can do it like this

Code:
if(Tab_Weapon.ItemOne){
bla bla bla
}esle{
blablabla}
I couldn't find anything being initialized or called to change the value of it being on or off.
Quote Originally Posted by Dragon(H)ell View Post
Code:
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");}
That's just drawing it. There is no dependency on a variable (hack) for it to change. That's what I couldn't find.

That's just drawing the string.
Quote Originally Posted by Shadow` View Post
Well, I just skimmed the video and saw this comment, and my theory is that the "Tab_Weapon.ItemOne" is the variable. Perhaps if he has some sort of GetAsyncKey to activate it from true and false, then it would be changeable. If he was just drawing the text, i would see no reason for the if statement.
I skimmed through the code, and there's nothing to change the variable though.
there are the variables.. bool Tab_D3D.ItemOne as example. if u realy understand classes and c++ then its easy.
Quote Originally Posted by RedAppleCoder View Post
there are the variables.. bool Tab_D3D.ItemOne as example. if u realy understand classes and c++ then its easy.
I can see the variables easily.
But what changes their values? I can't find that.
Quote Originally Posted by Flengo View Post


I can see the variables easily.
But what changes their values? I can't find that.
Youll find this in each Tab void:

Code:
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;}
}
I can see lots of improvements that you can make with your code.
Try to make everything as easy as possible to add features.
It will save time for yourself, and anyone who happens to read your code.

I would suggest by using arrays and using references to variables so it can be more 'globalized' and 'automated'.
The menu class itself should not be edited by the user unless changing the GUI around.

e.g
Code:
struct ItemStructs{
char *ItemName;
int *Variable; //can be a boolean
char **Options;
int max;
};

ItemStructs ITEM[20]; //Already a much cleaner way of adding features to your menu C:
Quote Originally Posted by flameswor10 View Post
I can see lots of improvements that you can make with your code.
Try to make everything as easy as possible to add features.
It will save time for yourself, and anyone who happens to read your code.

I would suggest by using arrays and using references to variables so it can be more 'globalized' and 'automated'.
The menu class itself should not be edited by the user unless changing the GUI around.

e.g
Code:
struct ItemStructs{
char *ItemName;
int *Variable; //can be a boolean
char **Options;
int max;
};

ItemStructs ITEM[20]; //Already a much cleaner way of adding features to your menu C:
i wrote this for beginners that everyone can understand what i do.
Quote Originally Posted by RedAppleCoder View Post
i wrote this for beginners that everyone can understand what i do.
Its much easier to understand if its neater and more organized.
Thats true but no one realy understand what arrays are when you beginn
Quote Originally Posted by RedAppleCoder View Post
Thats true but no one realy understand what arrays are when you beginn
Arrays are an early part of every language tutorial, essential knowledge for beginners. Everyone who even attempts to understand game hacking should have a knowledge at least that detailed. Even if they don't, they should be taught how to code intelligently, and not learn poor practices like those exercised in the development of this.
Posts 115 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?