Code:
#include <Windows.h>
#include <stdio.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <detours.h>
#pragma comment( lib, "d3d9.lib" )
#pragma comment( lib, "d3dx9.lib" )
class Menu
{
protected:
DWORD CorFundo;
DWORD CorBorda;
DWORD CorEscrita;
int TamanhoChk = 20;
POINT MenuLoc;
POINT MenuTamanho;
char* MenuTitulo;
int ItemInicio;
VOID FillRGB(INT x, INT y, INT w, INT h, D3DCOLOR Color, LPDIRECT3DDEVICE9 pDevice)
{
D3DRECT rec = { x, y, x + w, y + h };
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, Color, 0, 0);
} //Fill Space
VOID DrawBorder(INT x, INT y, INT w, INT h, INT px, DWORD Color, LPDIRECT3DDEVICE9 pDevice)
{
FillRGB(x, (y + h - px), w, px, Color, pDevice);
FillRGB(x, y, px, h, Color, pDevice);
FillRGB(x, y, w, px, Color, pDevice);
FillRGB((x + w - px), y, px, h, Color, pDevice);
} //Draw Border
VOID DrawRect(LPDIRECT3DDEVICE9 pDevice, INT x, INT y, INT w, INT h, DWORD Color)
{
D3DRECT rec;
rec.x1 = x;
rec.x2 = x + w;
rec.y1 = y;
rec.y2 = y + h;
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, Color, 0, 0);
} //DrawRectangle with Background
VOID Escrever(INT x, INT y, D3DCOLOR Color, CHAR *String)
{
RECT Rect;
SetRect(&Rect, x, y, x, y);
PFont->DrawTextA(0, String, -1, &Rect, DT_LEFT | DT_NOCLIP, Color);
} //WriteText
bool VerificarPressionado(int x, int y, int w, int h)
{
POINT Mouse;
GetCursorPos(&Mouse);
ScreenToClient(GetForegroundWindow(), &Mouse);
if (GetAsyncKeyState(VK_LBUTTON))
{
if ((Mouse.x > x) && (Mouse.x < x + w) && (Mouse.y > y) && (Mouse.y < y + h))
{
Sleep(250);
return true;
}
}
return false;
} //If LBUTTON Pressed in Location :) ret True;
public:
void SetupMenu(int x, int y, int w, int h, char* Titulo, DWORD CorF, DWORD CorB, DWORD CorE) // Config Menu
{
MenuLoc.x = x; // Location Menu X
MenuLoc.y = y; // Location Menu Y
ItemInicio = y + 23; // Items Begin Y
MenuTamanho.x = w; // Menu Width
MenuTamanho.y = h; // Menu Hegth
MenuTitulo = Titulo; //Menu Title
CorFundo = CorF; // Menu BackGround Color
CorBorda = CorB; // Menu Border Color
CorEscrita = CorE; // Menu Text Color
}
VOID DesenharMenu(LPDIRECT3DDEVICE9 pDevice) //Draw Menu
{
DrawRect(pDevice, MenuLoc.x, MenuLoc.y, MenuTamanho.x, MenuTamanho.y, CorFundo); //Draw BackGround Menu
DrawBorder(MenuLoc.x, MenuLoc.y, MenuTamanho.x, MenuTamanho.y, 2, CorBorda, pDevice ); //Draw Border Menu
DrawBorder(MenuLoc.x, MenuLoc.y, MenuTamanho.x, 21, 2, CorBorda, pDevice); //Draw Box Titulo
Escrever((MenuTamanho.x / 2 )- MenuLoc.x , MenuLoc.y + 2, CorEscrita, MenuTitulo); // Draw Text Titulo
}
VOID AdicionarCheckBox(char* Texto, bool &Var, int Item, LPDIRECT3DDEVICE9 pDevice) // Add Item ( CheckBox )
{
int x = MenuLoc.x + 4;
int y = ItemInicio + (TamanhoChk * Item);
int w = 17;
int h = 17;
FillRGB(x, y, w, h, D3DCOLOR_ARGB(0, 0, 0, 100), pDevice); // Draw Back BOX
Escrever(x + 21, y, CorEscrita, Texto); // Draw Text
if (VerificarPressionado(x, y, w, h))Var = !Var; //If Click Mouse in Area of CheckBox
if (Var)
{
FillRGB(x + 1, y + 1, w - 2, h - 2, D3DCOLOR_ARGB(255, 255, 255, 51), pDevice); // Draw Box Selected
}
}
}cMenu;
How to use?
In DLL MAIN:
Code:
cMenu.SetupMenu(X Menu, Y Menu, W Menu, H Menu, Title Menu, Back Color, Border Color, Text Color);
Example:
cMenu.SetupMenu(10, 10, 234, 285, "gusdnide", D3DCOLOR_RGBA(47, 45, 45, 255), D3DCOLOR_RGBA(77, 72, 72, 100), D3DCOLOR_ARGB(255, 255, 140, 000));
In Render Func:
Code:
cMenu.DesenharMenu(pDevice);
Example Add Item:
Code:
//cMenu.AdicionarCheckBox(Texto,Variable, Number Location, Device);
cMenu.AdicionarCheckBox("WallHack", Wall, 1, pDevice);
cMenu.AdicionarCheckBox("Chams", Chams, 2, pDevice);
cMenu.AdicionarCheckBox("NoFog", Fog, 3, pDevice);
Result:
Credits:
@
gusdnide
64com <- UNK (Some Draws)