i have make with a Tutorial a d3d9 Menu because im a noob in d3d.
But yet i have the problem the game who i will Cheat are d3d11 and i dont understand how i update it?
Thank you in Advance,
Freaky
Source
Base.cpp
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#define D3DparamX , UINT paramx
#define D3DparamvalX , paramx
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#include "Variables.h"
#include "Menu.h"
#include "cDraw.h"
cDraw Draw;
#define Start_Therad(Function) CreateThread(0,0,(LPTHREAD_START_ROUTINE)Function, 0,0,0);
typedef HRESULT (WINAPI* oEndScene)(LPDIRECT3DDEVICE9 pDevice);
oEndScene pEndScene = NULL;
bool Create;
HRESULT APIENTRY myEndScene( LPDIRECT3DDEVICE9 pDevice )
{
if( !Create )
{
D3DXCreateLine(pDevice,&Draw.pLine);
Draw.InitFont("Arial",15,FW_BOLD,pDevice);
Create = true;
}
Draw.KeyMenu(VK_END,pDevice);
return pEndScene( pDevice );
}
#include "D3DHook.h"
BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
DisableThreadLibraryCalls(hDll);
if (dwReason==DLL_PROCESS_ATTACH)
{
Start_Therad(LoopFunction);
}
return TRUE;
}
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#define D3DparamX , UINT paramx
#define D3DparamvalX , paramx
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#include "Variables.h"
#include "Menu.h"
#include "cDraw.h"
cDraw Draw;
#define Start_Therad(Function) CreateThread(0,0,(LPTHREAD_START_ROUTINE)Function, 0,0,0);
typedef HRESULT (WINAPI* oEndScene)(LPDIRECT3DDEVICE9 pDevice);
oEndScene pEndScene = NULL;
bool Create;
HRESULT APIENTRY myEndScene( LPDIRECT3DDEVICE9 pDevice )
{
if( !Create )
{
D3DXCreateLine(pDevice,&Draw.pLine);
Draw.InitFont("Arial",15,FW_BOLD,pDevice);
Create = true;
}
Draw.KeyMenu(VK_END,pDevice);
return pEndScene( pDevice );
}
#include "D3DHook.h"
BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
DisableThreadLibraryCalls(hDll);
if (dwReason==DLL_PROCESS_ATTACH)
{
Start_Therad(LoopFunction);
}
return TRUE;
}
D3SHook.h
#pragma comment(lib, "detours.lib")
#include "detours.h"
#pragma region D3D9_Interface_Hook
bool hooked = false;
#define HOOK(func,addy) p##func = (o##func)DetourFunction((PBYTE)addy,(PBYTE)my##fun c)
#define UNHOOK(func,addy) p##func = (o##func)DetourFunction((PBYTE)addy,(PBYTE)p##func )
LPDIRECT3DDEVICE9 nm_pD3Ddev;
PBYTE HookVTable( PDWORD* dwVTable, PBYTE dwHook, INT Index )
{
DWORD dwOld = 0;
VirtualProtect((void*)((*dwVTable) + (Index*4) ), 4, PAGE_EXECUTE_READWRITE, &dwOld);
PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]);
(*dwVTable)[Index] = (DWORD)dwHook;
VirtualProtect((void*)((*dwVTable) + (Index*4)), 4, dwOld, &dwOld);
return pOrig;
}
LRESULT CALLBACK MsgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){return DefWindowProc(hwnd, uMsg, wParam, lParam);}
void DX_Init(DWORD* table)
{
WNDCLASSEXA wc = {sizeof(WNDCLASSEX),CS_CLASSDC,MsgProc,0L,0L,GetMo duleHandleA(NULL),NULL,NULL,NULL,NULL,"DX",NULL};
RegisterClassExA(&wc);
HWND hWnd = CreateWindowA("DX",NULL,WS_OVERLAPPEDWINDOW,100,10 0,300,300,GetDesktopWindow(),NULL,wc.hInstance,NUL L);
LPDIRECT3D9 pD3D = Direct3DCreate9( D3D_SDK_VERSION );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
LPDIRECT3DDEVICE9 pd3dDevice;
pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hW nd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pd3 dDevice);
DWORD* pVTable = (DWORD*)pd3dDevice;
pVTable = (DWORD*)pVTable[0];
table[0] = pVTable[42];
DestroyWindow(hWnd);
}
DWORD WINAPI VMT_Patching( LPVOID Param )
{
while(1)
{
Sleep(100);
HookVTable((PDWORD*)nm_pD3Ddev, (PBYTE)myEndScene, 42);
}
return 1;
}
void LoopFunction()
{
if(hooked==false)
{
DWORD VTable[3] = {0};
while(GetModuleHandleA("d3d9.dll")==NULL)
{
Sleep(250);
}
DX_Init(VTable);
HOOK(EndScene,VTable[0]);
while(!nm_pD3Ddev)
{
Sleep(50);
}
UNHOOK(EndScene, VTable[0]);
*(PDWORD)&pEndScene = VTable[0];
CreateThread(NULL,0,&VMT_Patching,NULL,0,NULL); //Create hooking thread
hooked = true;
}
}
#pragma endregion D3D9_Interface_Hook
#pragma comment(lib, "detours.lib")
#include "detours.h"
#pragma region D3D9_Interface_Hook
bool hooked = false;
#define HOOK(func,addy) p##func = (o##func)DetourFunction((PBYTE)addy,(PBYTE)my##fun c)
#define UNHOOK(func,addy) p##func = (o##func)DetourFunction((PBYTE)addy,(PBYTE)p##func )
LPDIRECT3DDEVICE9 nm_pD3Ddev;
PBYTE HookVTable( PDWORD* dwVTable, PBYTE dwHook, INT Index )
{
DWORD dwOld = 0;
VirtualProtect((void*)((*dwVTable) + (Index*4) ), 4, PAGE_EXECUTE_READWRITE, &dwOld);
PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]);
(*dwVTable)[Index] = (DWORD)dwHook;
VirtualProtect((void*)((*dwVTable) + (Index*4)), 4, dwOld, &dwOld);
return pOrig;
}
LRESULT CALLBACK MsgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){return DefWindowProc(hwnd, uMsg, wParam, lParam);}
void DX_Init(DWORD* table)
{
WNDCLASSEXA wc = {sizeof(WNDCLASSEX),CS_CLASSDC,MsgProc,0L,0L,GetMo duleHandleA(NULL),NULL,NULL,NULL,NULL,"DX",NULL};
RegisterClassExA(&wc);
HWND hWnd = CreateWindowA("DX",NULL,WS_OVERLAPPEDWINDOW,100,10 0,300,300,GetDesktopWindow(),NULL,wc.hInstance,NUL L);
LPDIRECT3D9 pD3D = Direct3DCreate9( D3D_SDK_VERSION );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
LPDIRECT3DDEVICE9 pd3dDevice;
pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hW nd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pd3 dDevice);
DWORD* pVTable = (DWORD*)pd3dDevice;
pVTable = (DWORD*)pVTable[0];
table[0] = pVTable[42];
DestroyWindow(hWnd);
}
DWORD WINAPI VMT_Patching( LPVOID Param )
{
while(1)
{
Sleep(100);
HookVTable((PDWORD*)nm_pD3Ddev, (PBYTE)myEndScene, 42);
}
return 1;
}
void LoopFunction()
{
if(hooked==false)
{
DWORD VTable[3] = {0};
while(GetModuleHandleA("d3d9.dll")==NULL)
{
Sleep(250);
}
DX_Init(VTable);
HOOK(EndScene,VTable[0]);
while(!nm_pD3Ddev)
{
Sleep(50);
}
UNHOOK(EndScene, VTable[0]);
*(PDWORD)&pEndScene = VTable[0];
CreateThread(NULL,0,&VMT_Patching,NULL,0,NULL); //Create hooking thread
hooked = true;
}
}
#pragma endregion D3D9_Interface_Hook
cDraw.cpp
#include "cDraw.h"
#include "Variables.h"
NHStudio Studio;
cDraw::cDraw(void)
{
Show = true;
}
void cDraw::InitFont(CHAR* szFontFamily,int W,DWORD Stile,IDirect3DDevice9* mDevice)
{
D3DXCreateFont(mDevice, W, 0, Stile, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, szFontFamily, &pFont);
}
void cDraw::Engine_Text(int x,int y,DWORD color,LPSTR text,DWORD ST)
{
RECT rect, rect2;
SetRect( &rect, x, y, x, y );
pFont->DrawTextA(NULL,text,-1,&rect, ST, color );
SetRect( &rect, x, y, x, y );
}
void cDraw::Engine_Box(int x, int y, int w, int h, D3DCOLOR Color,IDirect3DDevice9* mDevice)
{
D3DRECT rec;
rec.x1 = x;
rec.x2 = x + w;
rec.y1 = y;
rec.y2 = y + h;
mDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
mDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALP HA);
mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, D3DPT_TRIANGLESTRIP);
mDevice->Clear( 1, &rec, D3DCLEAR_TARGET, Color, 1, 1 );
}
void cDraw::Engine_Border(int x, int y, int w, int h,int s, D3DCOLOR Color,IDirect3DDevice9* mDevice)
{
Engine_Box(x, y, s, h,Color,mDevice);
Engine_Box(x,y+h, w, s,Color,mDevice);
Engine_Box(x, y, w, s,Color,mDevice);
Engine_Box(x+w,y, s,h+s,Color,mDevice);
}
BOOL cDraw::IsInBox(int x,int y,int w,int h)
{
POINT MousePosition;
GetCursorPos(&MousePosition);
ScreenToClient(GetForegroundWindow(),&MousePositio n);
return(MousePosition.x >= x && MousePosition.x <= x + w && MousePosition.y >= y && MousePosition.y <= y + h);
}
void cDraw::Engine_Line(long Xa,long Ya,long Xb,long Yb,int Width,D3DCOLOR Color)
{
D3DXVECTOR2 vLine[ 2 ];
pLine->SetAntialias( 0 );
pLine->SetWidth(Width);
pLine->Begin();
vLine[ 0 ][ 0 ] = Xa;
vLine[ 0 ][ 1 ] = Ya;
vLine[ 1 ][ 0 ] = Xb;
vLine[ 1 ][ 1 ] = Yb;
pLine->Draw( vLine, 2, Color );
pLine->End();
}
BOOL cDraw::State_Key(int Key,DWORD dwTimeOut)
{
if(HIWORD(GetKeyState(Key)))
{
if(!kPressingKeys[Key].bPressed || (kPressingKeys[Key].dwStartTime && (kPressingKeys[Key].dwStartTime + dwTimeOut) <= GetTickCount()))
{
kPressingKeys[Key].bPressed = TRUE;
if( dwTimeOut > NULL )
kPressingKeys[Key].dwStartTime = GetTickCount();
return TRUE;
}
}
else
kPressingKeys[Key].bPressed = FALSE;
return FALSE;
}
void cDraw::KeyMenu(DWORD KEY,LPDIRECT3DDEVICE9 pDevice)
{
if( pFont == NULL )
pFont->OnLostDevice();
else
{
if(GetAsyncKeyState(KEY)&1)Show=!Show;
if(Show)SHOW_MENU(pDevice);
}
}
#define TheColorit D3DCOLOR_ARGB(255,255,255,255)
void cDraw::Studio_Menu(int x, int y,LPSTR text, LPDIRECT3DDEVICE9 pDevice)
{
Engine_Box(x, y, 400, 229, DARK3, pDevice);//Основной бокс на котором строится все меню
Engine_Text(x+10, x+7, AliceBlue, text, L_Text);//Заголовок меню находящийся на его шапке
Engine_Border(x, y, 400, 28, 2, RED, pDevice);//обводка шапки меню
Engine_Border(x, y+28, 400, 199, 2, RED, pDevice);//обводка пространства под функции, чекбоксы и тп.
Engine_Border(x, y+28, 130, 199, 2, RED, pDevice);//обводка пространства под разделы меню
}
void cDraw::Engine_Button(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice)
{
if(IsInBox(x,y,130,25))
{
Engine_Box(x+3, y+3, 120, 21, DarkRed, pDevice);
if(State_Key(VK_LBUTTON,1000))
{
Studio.Menu1 = Studio.Menu2 = Studio.Menu3 = Studio.Menu4 = Studio.Menu5 = Studio.Menu6 = Studio.Menu7 = 0;
studio = !studio;
}
}
if(studio)
Engine_Box(x+3, y+3, 120, 21, RED, pDevice);
Engine_Border(x, y, 124, 25,2, RED, pDevice);
Engine_Text(x+64, y+5, AliceBlue, text, C_Text);
}
#define Серый D3DCOLOR_ARGB(160, 46, 46, 46)
void cDraw::Engine_CheckBox(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice)
{
Engine_Text(x+132,y+2,AliceBlue,text,L_Text);
Engine_Border(x+374,y+2,18,15,2,DarkRed,pDevice);
if(IsInBox(x+128,y,266,20))
Engine_Border(x+130,y,265,20,1,DarkRed,pDevice);
if(IsInBox(x+374,y+2,18,15))
if(State_Key(VK_LBUTTON,1000))
studio = !studio;
if(studio)
Engine_Box(x+377,y+5,14,11,RED,pDevice);
}
#include "cDraw.h"
#include "Variables.h"
NHStudio Studio;
cDraw::cDraw(void)
{
Show = true;
}
void cDraw::InitFont(CHAR* szFontFamily,int W,DWORD Stile,IDirect3DDevice9* mDevice)
{
D3DXCreateFont(mDevice, W, 0, Stile, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, szFontFamily, &pFont);
}
void cDraw::Engine_Text(int x,int y,DWORD color,LPSTR text,DWORD ST)
{
RECT rect, rect2;
SetRect( &rect, x, y, x, y );
pFont->DrawTextA(NULL,text,-1,&rect, ST, color );
SetRect( &rect, x, y, x, y );
}
void cDraw::Engine_Box(int x, int y, int w, int h, D3DCOLOR Color,IDirect3DDevice9* mDevice)
{
D3DRECT rec;
rec.x1 = x;
rec.x2 = x + w;
rec.y1 = y;
rec.y2 = y + h;
mDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
mDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALP HA);
mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, D3DPT_TRIANGLESTRIP);
mDevice->Clear( 1, &rec, D3DCLEAR_TARGET, Color, 1, 1 );
}
void cDraw::Engine_Border(int x, int y, int w, int h,int s, D3DCOLOR Color,IDirect3DDevice9* mDevice)
{
Engine_Box(x, y, s, h,Color,mDevice);
Engine_Box(x,y+h, w, s,Color,mDevice);
Engine_Box(x, y, w, s,Color,mDevice);
Engine_Box(x+w,y, s,h+s,Color,mDevice);
}
BOOL cDraw::IsInBox(int x,int y,int w,int h)
{
POINT MousePosition;
GetCursorPos(&MousePosition);
ScreenToClient(GetForegroundWindow(),&MousePositio n);
return(MousePosition.x >= x && MousePosition.x <= x + w && MousePosition.y >= y && MousePosition.y <= y + h);
}
void cDraw::Engine_Line(long Xa,long Ya,long Xb,long Yb,int Width,D3DCOLOR Color)
{
D3DXVECTOR2 vLine[ 2 ];
pLine->SetAntialias( 0 );
pLine->SetWidth(Width);
pLine->Begin();
vLine[ 0 ][ 0 ] = Xa;
vLine[ 0 ][ 1 ] = Ya;
vLine[ 1 ][ 0 ] = Xb;
vLine[ 1 ][ 1 ] = Yb;
pLine->Draw( vLine, 2, Color );
pLine->End();
}
BOOL cDraw::State_Key(int Key,DWORD dwTimeOut)
{
if(HIWORD(GetKeyState(Key)))
{
if(!kPressingKeys[Key].bPressed || (kPressingKeys[Key].dwStartTime && (kPressingKeys[Key].dwStartTime + dwTimeOut) <= GetTickCount()))
{
kPressingKeys[Key].bPressed = TRUE;
if( dwTimeOut > NULL )
kPressingKeys[Key].dwStartTime = GetTickCount();
return TRUE;
}
}
else
kPressingKeys[Key].bPressed = FALSE;
return FALSE;
}
void cDraw::KeyMenu(DWORD KEY,LPDIRECT3DDEVICE9 pDevice)
{
if( pFont == NULL )
pFont->OnLostDevice();
else
{
if(GetAsyncKeyState(KEY)&1)Show=!Show;
if(Show)SHOW_MENU(pDevice);
}
}
#define TheColorit D3DCOLOR_ARGB(255,255,255,255)
void cDraw::Studio_Menu(int x, int y,LPSTR text, LPDIRECT3DDEVICE9 pDevice)
{
Engine_Box(x, y, 400, 229, DARK3, pDevice);//Основной бокс на котором строится все меню
Engine_Text(x+10, x+7, AliceBlue, text, L_Text);//Заголовок меню находящийся на его шапке
Engine_Border(x, y, 400, 28, 2, RED, pDevice);//обводка шапки меню
Engine_Border(x, y+28, 400, 199, 2, RED, pDevice);//обводка пространства под функции, чекбоксы и тп.
Engine_Border(x, y+28, 130, 199, 2, RED, pDevice);//обводка пространства под разделы меню
}
void cDraw::Engine_Button(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice)
{
if(IsInBox(x,y,130,25))
{
Engine_Box(x+3, y+3, 120, 21, DarkRed, pDevice);
if(State_Key(VK_LBUTTON,1000))
{
Studio.Menu1 = Studio.Menu2 = Studio.Menu3 = Studio.Menu4 = Studio.Menu5 = Studio.Menu6 = Studio.Menu7 = 0;
studio = !studio;
}
}
if(studio)
Engine_Box(x+3, y+3, 120, 21, RED, pDevice);
Engine_Border(x, y, 124, 25,2, RED, pDevice);
Engine_Text(x+64, y+5, AliceBlue, text, C_Text);
}
#define Серый D3DCOLOR_ARGB(160, 46, 46, 46)
void cDraw::Engine_CheckBox(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice)
{
Engine_Text(x+132,y+2,AliceBlue,text,L_Text);
Engine_Border(x+374,y+2,18,15,2,DarkRed,pDevice);
if(IsInBox(x+128,y,266,20))
Engine_Border(x+130,y,265,20,1,DarkRed,pDevice);
if(IsInBox(x+374,y+2,18,15))
if(State_Key(VK_LBUTTON,1000))
studio = !studio;
if(studio)
Engine_Box(x+377,y+5,14,11,RED,pDevice);
}
cDraw.h
#pragma once
#include <d3d9.h>
#include <d3dx9.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include "Colors.h"
#define C_Text (DT_CENTER|DT_NOCLIP)
#define L_Text (DT_LEFT|DT_NOCLIP)
#define R_Text (DT_RIGHT|DT_NOCLIP)
static struct _Keys
{
bool bPressed;
DWORD dwStartTime;
}
kPressingKeys[256];
class cDraw
{
public:
cDraw(void);
bool Show;
ID3DXFont* pFont;
LPD3DXLINE pLine;
//enum gr_orientation {horizontal,vertical};
BOOL IsInBox(int x,int y,int w,int h);
BOOL State_Key(int Key,DWORD dwTimeOut);
void InitFont(CHAR* szFontFamily ,int W ,DWORD Stile ,IDirect3DDevice9* mDevice);
void Engine_Text(int x, int y, DWORD color, LPSTR text, DWORD ST);
void Engine_Line(long Xa ,long Ya ,long Xb ,long Yb ,int Width ,D3DCOLOR Color);
void Engine_Box( int x, int y, int w, int h, D3DCOLOR Color, LPDIRECT3DDEVICE9 m_pD3Ddev);
void Engine_Border(int x, int y, int w, int h,int s, D3DCOLOR Color, LPDIRECT3DDEVICE9 m_pD3Ddev);
void SHOW_MENU(LPDIRECT3DDEVICE9 pDevice);
void KeyMenu(DWORD KEY ,LPDIRECT3DDEVICE9 pDevice);
void Studio_Menu(int x, int y,LPSTR text, LPDIRECT3DDEVICE9 pDevice);
void Engine_Button(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice);
void Engine_CheckBox(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice);
};
Menu.h
#include "cDraw.h"
void cDraw::SHOW_MENU(LPDIRECT3DDEVICE9 pDevice)
{
Studio_Menu(20, 20,"NHStudio D3D9 Menu Engine by iDReeM", pDevice);
Engine_Button(23, 51,Studio.Menu1,"Engine_Button",pDevice);
Engine_Button(23, 51+28,Studio.Menu2,"Engine_Button",pDevice);
Engine_Button(23, 51+28*2,Studio.Menu3,"Engine_Button",pDevice);
Engine_Button(23, 51+28*3,Studio.Menu4,"Engine_Button",pDevice);
Engine_Button(23, 51+28*4,Studio.Menu5,"Engine_Button",pDevice);
Engine_Button(23, 51+28*5,Studio.Menu6,"Engine_Button",pDevice);
Engine_Button(23, 51+28*6,Studio.Menu7,"Engine_Button",pDevice);
if(Studio.Menu1)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*4, Studio.test5,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*5, Studio.test6,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*6, Studio.test6,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*7, Studio.test6,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*8, Studio.test6,"Engine_CheckBox", pDevice);
}
if(Studio.Menu2)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*4, Studio.test5,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*5, Studio.test6,"Engine_CheckBox", pDevice);
}
if(Studio.Menu3)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*4, Studio.test5,"Engine_CheckBox", pDevice);
}
if(Studio.Menu4)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
}
if(Studio.Menu5)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
}
if(Studio.Menu6)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
}
if(Studio.Menu7)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
}
}
#pragma once
#include <d3d9.h>
#include <d3dx9.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include "Colors.h"
#define C_Text (DT_CENTER|DT_NOCLIP)
#define L_Text (DT_LEFT|DT_NOCLIP)
#define R_Text (DT_RIGHT|DT_NOCLIP)
static struct _Keys
{
bool bPressed;
DWORD dwStartTime;
}
kPressingKeys[256];
class cDraw
{
public:
cDraw(void);
bool Show;
ID3DXFont* pFont;
LPD3DXLINE pLine;
//enum gr_orientation {horizontal,vertical};
BOOL IsInBox(int x,int y,int w,int h);
BOOL State_Key(int Key,DWORD dwTimeOut);
void InitFont(CHAR* szFontFamily ,int W ,DWORD Stile ,IDirect3DDevice9* mDevice);
void Engine_Text(int x, int y, DWORD color, LPSTR text, DWORD ST);
void Engine_Line(long Xa ,long Ya ,long Xb ,long Yb ,int Width ,D3DCOLOR Color);
void Engine_Box( int x, int y, int w, int h, D3DCOLOR Color, LPDIRECT3DDEVICE9 m_pD3Ddev);
void Engine_Border(int x, int y, int w, int h,int s, D3DCOLOR Color, LPDIRECT3DDEVICE9 m_pD3Ddev);
void SHOW_MENU(LPDIRECT3DDEVICE9 pDevice);
void KeyMenu(DWORD KEY ,LPDIRECT3DDEVICE9 pDevice);
void Studio_Menu(int x, int y,LPSTR text, LPDIRECT3DDEVICE9 pDevice);
void Engine_Button(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice);
void Engine_CheckBox(int x, int y, bool &studio, LPSTR text, IDirect3DDevice9* pDevice);
};
Menu.h
#include "cDraw.h"
void cDraw::SHOW_MENU(LPDIRECT3DDEVICE9 pDevice)
{
Studio_Menu(20, 20,"NHStudio D3D9 Menu Engine by iDReeM", pDevice);
Engine_Button(23, 51,Studio.Menu1,"Engine_Button",pDevice);
Engine_Button(23, 51+28,Studio.Menu2,"Engine_Button",pDevice);
Engine_Button(23, 51+28*2,Studio.Menu3,"Engine_Button",pDevice);
Engine_Button(23, 51+28*3,Studio.Menu4,"Engine_Button",pDevice);
Engine_Button(23, 51+28*4,Studio.Menu5,"Engine_Button",pDevice);
Engine_Button(23, 51+28*5,Studio.Menu6,"Engine_Button",pDevice);
Engine_Button(23, 51+28*6,Studio.Menu7,"Engine_Button",pDevice);
if(Studio.Menu1)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*4, Studio.test5,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*5, Studio.test6,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*6, Studio.test6,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*7, Studio.test6,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*8, Studio.test6,"Engine_CheckBox", pDevice);
}
if(Studio.Menu2)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*4, Studio.test5,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*5, Studio.test6,"Engine_CheckBox", pDevice);
}
if(Studio.Menu3)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*4, Studio.test5,"Engine_CheckBox", pDevice);
}
if(Studio.Menu4)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*3, Studio.test4,"Engine_CheckBox", pDevice);
}
if(Studio.Menu5)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21*2, Studio.test3,"Engine_CheckBox", pDevice);
}
if(Studio.Menu6)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
Engine_CheckBox(23, 51+21, Studio.test2,"Engine_CheckBox", pDevice);
}
if(Studio.Menu7)
{
Engine_CheckBox(23, 51, Studio.test1,"Engine_CheckBox", pDevice);
}
}
Variables.h
#pragma once
struct NHStudio
{
bool test1,
test2,
test3,
test4,
test5,
test6;
bool Menu1,
Menu2,
Menu3,
Menu4,
Menu5,
Menu6,
Menu7;
};
extern NHStudio Studio;
#pragma once
struct NHStudio
{
bool test1,
test2,
test3,
test4,
test5,
test6;
bool Menu1,
Menu2,
Menu3,
Menu4,
Menu5,
Menu6,
Menu7;
};
extern NHStudio Studio;