Okay The First Thing I will say is that its for learning i mean i ll teach you how to make a full base detailed for a d3d menu ofcourse not including the HOOK
Now Follow The Steps:
1.Download files in attachment
2.Make a new project
3.Name the header Files and the cpp files like those in attachment
4.copy and paste what in them to ur code but be accurate in this
5.[Info]this base i gave u is without the menu.cpp and the menu.h [ cuz thats what i ll teach u today how to make them]
Now How To Add what u want to ur menu first we need to make them recogonize the menu : [deadhellmenu.h]
Code:
Code:
Code:
Code:
D3D Menu.rar - Jotti's malware scan
[You must be registered and logged in to see this link.]
IT HAS 2 BE LIKE DAT:
Now Follow The Steps:
1.Download files in attachment
2.Make a new project
3.Name the header Files and the cpp files like those in attachment
4.copy and paste what in them to ur code but be accurate in this
5.[Info]this base i gave u is without the menu.cpp and the menu.h [ cuz thats what i ll teach u today how to make them]
Now How To Add what u want to ur menu first we need to make them recogonize the menu : [deadhellmenu.h]
Code:
- Code:
#include "stdafx.h"
#include "deadhellfont.h"
To Recogonize:
Code:
#pragma once
#define ITEM_ARRAY 64 // Maximum of 64 Items change to reduce Static address size
// ============ SOME CALCULATION MACROS FOR LONG CALCULATIONS ================
// ============ THE PREFIX IS MC ================
#define MC_MAXX (X+WIDTH) // X of Menu + Width
#define MC_FCTR(x,y) ((x+y)/2) // Calculate Center Point Between two items
#define MC_ITEMY(index) (Y+(index*I_SPC)+T_SPC+(T_SPC/2)) // Calculate Y of Item using Index or calculate Menu Maximum Y
#define MC_MSY (Y+T_SPC+(T_SPC/2)) // Y Start For Menu Items
Code:
- Code:
class cMenu{
public:
Item Index Structure:
Code:
struct sitem{
char title[50]; // Name Of Item to Display
char state[50]; // States of Item
int type; // Type of Item ie. Cat , Items
int max; // Number of States
int no; // number inside the Array
int *val; // Variable Being Controlled
} items[ITEM_ARRAY];
Item Color Enumeration:[Normal Colors]
Code:
enum COLORS{ // Normal Colors
WHITE = D3DCOLOR_ARGB(255,255,255,255),
RED = D3DCOLOR_ARGB(255,220,20,60),
GREEN = D3DCOLOR_ARGB(255,0,255,0),
BLUE = D3DCOLOR_ARGB(255,0,0,255),
BLACK = D3DCOLOR_ARGB(255,0,0,0),
PURPLE = D3DCOLOR_ARGB(255,125,0,255),
GREY = D3DCOLOR_ARGB(255,128,128,128),
YELLOW = D3DCOLOR_ARGB(255,255,255,0),
ORANGE = D3DCOLOR_ARGB(255,255,125,0)
};
Item Color Enumeration:[Item Colors]
Code:
enum I_COLORS{ // Item Colors
C_OFF = D3DCOLOR_ARGB(255,255,255,255),
C_ON = D3DCOLOR_ARGB(255,220,20,60),
C_CAT = D3DCOLOR_ARGB(255,220,20,60),
C_CUR = D3DCOLOR_ARGB(255,220,20,60),
C_TITLE = D3DCOLOR_ARGB(255,255,255,255),
C_STRING = D3DCOLOR_ARGB(255,220,20,60),
};
BackGround Color Enumeration:
Code:
enum BK_COLORS{ // BackGround Colors
C_BOX = D3DCOLOR_ARGB(255,0,0,0),
C_BORDER = D3DCOLOR_ARGB(255,220,20,60)
};
Menu Types Enumeration:
Code:
enum I_TYPES{
T_TEXT = 0,
T_ITEM = 1,
T_CAT = 2
};
Class Global Variables:
Code:
CD3DFont *font;
int X,Y; // TOP LEFT OF MENU
POINT mofs; // Offset From Mouse Last Point
POINT mpos; // Mouse Coordinates
int M_DRAG; // is Menu Being Dragged
int WIDTH; // Width of Menu
int I_OFS,S_OFS; // Item Title Column Start
int I_SPC,I_TSPC; // Title Spacing and Item Spacing
int T_SPC,F_SPC; // Title Spacing from Menu Items and Footer Spacing
int NO; // Number of Menu Items
int I_CUR; // Current Menu Item
bool SHOW; // Is menu shown
bool INIT; // Has Menu Been Setup
// ANIMATION GLOBALS
int ABOR; // Board Animation Offset
int BTEX,BDIR; // Blinking Text Highlight
Class Global Functions:
Code:
void DrawBox( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE9 pDevice);
void DrawBorder( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE9 pDevice);
void DrawMouse(int x, int y,LPDIRECT3DDEVICE9 pDevice);
char* oprintf (const char *fmt, ...);
void PostReset(LPDIRECT3DDEVICE9 pDevice);
void PreReset(void);
char* FPS(int en = 1);
char* TIME(void);
char* DATE(void);
void ShowMenu(LPDIRECT3DDEVICE9 pDevice);
void ShowBox(LPDIRECT3DDEVICE9 pDevice);
private:
Class Private Functions[so u can add groups,items,texts,custom borders and so on..all attatched under one main ]
Code:
void acat(char *title, char *states, int *var);
void aitem(char *title, char *states,int *var, int show, int when);
void atext(char *title, char *states,int show, int when);
void atext(char *title, char *states);
void additem(char *title, char *states,int type, int *var, int show, int when);
void getfield(char *str,char *dst,int no);
int nofields(char *str);
void Init(void);
int Load(char* szSection, char* szKey, int iDefaultValue,LPCSTR file);
void Save(char* szSection, char* szKey, int iValue,LPCSTR file);
//-----------------------------------------------------------------------------
};
extern cMenu Menu;
// Item Manager Struct
struct copt{
//Global Variables
int text; // Text Items
struct sinfo{
int main;
}info;
struct splayer{
int main;
int superj;
int speed;
int stamina;
int recoil;
int spread;
int trigger;
int nfd;
}player;
struct sserver{
int main;
int spawn;
int prem;
int slots;
}server;
struct susercp{
int main;
int pfind;
int pinfo;
int pkey;
}usercp;
struct sasm{
int main;
int antik;
int invis;
int restrict;
int mview;
int nodelay;
int prone;
int uoxy;
int bone;
int shotty;
int opk;
int svp;
int uammo;
int stw;
int wtw;
}asmm;
struct sd3d{
int main3;
int main;
int noreload;
int norecoil;
int nochangedelay;
int noweaponweight;
int nofalldamage;
int nonadedamage;
int main2;
int seeghosts;
int fastdefuse;
int fastplant;
int crouchspeed;
int speedknife;
int nogatlinggunspeedpenalty;
int nogatlinggundelay;
}d3d;
struct schams{
int main;
int chams;
int chamsf;
int chamsb;
int type;
}chams;
struct sesp{
int main;
int oespn;
int oesph;
int espn;
int esph;
int espi;
int eonly;
int espd;
}esp;
struct soptions{
int main;
int move;
int reset;
int save;
int load;
}options;
};
extern copt opt;
Done! Now To Make The Menu It Self:[deadhellmenu.cpp]
Code:
#include "stdafx.h"
#include "deadhellMenu.h"
#include "deadhellSound.h"
#include "deadhellBase.h"
#include "Sounds.h"
#include "pragma.h"
We Need To use the PostReset() method to Create Fonts and other Resources for Menu:
Code:
void cMenu::PostReset(LPDIRECT3DDEVICE9 pDevice)
{
font = new CD3DFont("Impac", 6, D3DFONT_BOLD);
font->InitDeviceObjects(pDevice);
font->RestoreDeviceObjects();
}
We Need To use the PreReset() method to Release Fonts / objects for menu:
Code:
void cMenu::PreReset(void)
{
font->InvalidateDeviceObjects();
font->DeleteDeviceObjects();
delete font;
font = NULL;
}
We Need To use the init() method toLoad Menu Defaults / Prepare Menu For Usage:
Code:
void cMenu::Init()
{
if (opt.options.reset)INIT=false;
if(!INIT){
opt.options.move=0; // BUG FIX FOR RESET DISABLE MOVE BEFORE SETTING COORDINATES
X=Y=100; // TOP LEFT START
WIDTH=200; // MENU WIDTH
I_OFS=4; // OFSET FOR ITEM
S_OFS=WIDTH-2; // OFSET FOR STATE
T_SPC=20; // Space from Title and Start of Items
F_SPC=20; // Footer Spacing Hook Menu
I_SPC=17; // Item Spacing
I_CUR=0; // Set current Item
ABOR=0; // ANIMATION MOVE
BDIR=0; // ANIMATION HIGHLIGHT
SHOW=true; // false=hide true=show
INIT=true; // STOP INITATION
}
}
Code:
- Code:
char* cMenu::FPS(int en)
{
static int FPScounter = 0;
static float FPSfLastTickCount = 0.0f;
static float FPSfCurrentTickCount;
static char cfps[6] = "";
if(!en)
{
FPSfCurrentTickCount = clock() * 0.001f;
FPScounter++;
if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f)
{
FPSfLastTickCount = FPSfCurrentTickCount;
sprintf(cfps," %d",FPScounter);
FPScounter = 0;
}
}
return cfps;
}
Now We need to add Time it is in USA Format:
Code:
char* cMenu::DATE(void)
{
static char cdate[20] = "" ;
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
sprintf( cdate, "%d-%02d-%d",current_tm->tm_mon+1,current_tm->tm_mday,current_tm->tm_year-100+2000);
return cdate;
}
Now We need to add Date it is in USA Format:
Code:
char* cMenu::DATE(void)
{
static char cdate[20] = "" ;
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
sprintf( cdate, "%d-%02d-%d",current_tm->tm_mon+1,current_tm->tm_mday,current_tm->tm_year-100+2000);
return cdate;
}
oprintf()[equivilant to sprintf but for output into of dest]
Code:
char* cMenu::oprintf (const char *fmt, ...)
{
static char buffer[225] = "";
va_list va_alist;
va_start (va_alist, fmt);
_vsnprintf (buffer,sizeof(buffer), fmt, va_alist);
va_end (va_alist);
return buffer;
}
Save() [saves ur setting in menu]
Code:
void cMenu::Save(char* szSection, char* szKey, int iValue,LPCSTR file)
{
char szValue[255];
sprintf(szValue, "%d", iValue);
WritePrivateProfileString(szSection, szKey, szValue, file);
}
Load()[Loads Menu Item States From Previously Saved File]
Code:
int cMenu::Load(char* szSection, char* szKey, int iDefaultValue,LPCSTR file)
{
int iResult = GetPrivateProfileInt(szSection, szKey, iDefaultValue, file);
return iResult;
}
Now Lets the BaseFunction for aitem,acat,and atext
Code:
//additem
void cMenu::additem(char *title, char *states,int type, int *var, int show, int when)
{
if(show==when)
{
strcpy(items[NO].title,title);
getfield(states,items[NO].state,*var+1);
items[NO].type=type;
items[NO].max=nofields(states);
items[NO].val=var;
NO++;
}
if(type!=T_TEXT)
{
if (opt.options.load)
*var = Load("Items", title, *var,Base.GetFile("mset.ini"));
if (opt.options.save)
Save("Items", title, *var,Base.GetFile("mset.ini"));
if (opt.options.reset)
*var=0;
}
}
//acat
void cMenu::acat(char *title, char *states,int *var)
{
additem(title,states,T_CAT,var,0,0);
}
//aitem
void cMenu::aitem(char *title, char *states,int *var,int show,int when)
{
additem(title,states,T_ITEM,var,show,when);
}
//atext
void cMenu::atext(char *title, char *states,int show,int when)
{
additem(title,states,T_TEXT,&opt.text,show,when);
}
void cMenu::atext(char *title, char *states)
{
additem(title,states,T_TEXT,&opt.text,1,1);
}
//no fields
int cMenu::nofields(char *str)
{
char *ptr;
int no;
for(no=1; (ptr=strchr(str,(char)'|'))!=NULL; no++)str=ptr+1;
return no;
}
//get field
void cMenu::getfield(char *str,char *dst,int no)
{
char *ptr;
int i;
for(i=1; (ptr=strchr(str,(char)'|'))!=NULL ; i++)
{
if(i==no) break;
str=ptr+1;
}
if(ptr)
{
i=(int)(ptr-str);
strncpy(dst,str,i);
dst[i]=0;
}
else
strcpy(dst,str);
}
//draw box
void cMenu::DrawBox( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE9 pDevice)
{
struct Vertex
{
float x,y,z,ht;
DWORD Color;
}V[4] = {
{x,y+h, 0.0f, 0.0f, Color},
{x,y, 0.0f, 0.0f, Color},
{x+w,y+h, 0.0f, 0.0f, Color},
{x+w,y, 0.0f, 0.0f, Color}
};
pDevice->SetTexture(0, NULL);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));
return;
}
//draw border
void cMenu::DrawBorder( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE9 pDevice)
{
DrawBox(x, y, 1, h,Color,pDevice);
DrawBox(x,y+h, w, 1,Color,pDevice);
DrawBox(x, y, w, 1,Color,pDevice);
DrawBox(x+w,y, 1,h+1,Color,pDevice);
return;
}
Code:
- Code:
void cMenu::ShowMenu(LPDIRECT3DDEVICE9 pDevice)
{
//-----------------------------------------------------------------------------
// Desc: Check Hotkeys
//-----------------------------------------------------------------------------
int lm = GetAsyncKeyState(VK_LBUTTON)&1;
int rm = GetAsyncKeyState(VK_RBUTTON)&1;
int left = GetAsyncKeyState(VK_LEFT )&1;
int right = GetAsyncKeyState(VK_RIGHT)&1;
int up = GetAsyncKeyState(VK_UP )&1;
int down = GetAsyncKeyState(VK_DOWN )&1;
//-----------------------------------------------------------------------------
// Desc: Prepare/Reset Menu
//-----------------------------------------------------------------------------
Init();
//-----------------------------------------------------------------------------
// Desc: Show The Menu
//-----------------------------------------------------------------------------
if(GetAsyncKeyState(VK_INSERT)&1) SHOW=(!SHOW);
if(SHOW){
//-----------------------------------------------------------------------------
// Desc: Get Mouse Coordinates and translate
//-----------------------------------------------------------------------------
GetCursorPos(&mpos);// Update Mouse Coordinates
ScreenToClient(GetForegroundWindow(),&mpos); // Translate to Current Window
//-----------------------------------------------------------------------------
// Desc: Move Menu
//-----------------------------------------------------------------------------
//if(mpos.x>X && mpos.x<X+WIDTH && mpos.y>Y && mpos.y<Y+T_SPC && GetAsyncKeyState(VK_LBUTTON)&1 && !opt.options.move) // If Header Clicked on
//{
// M_DRAG=1;
//}
//else
//{
// mofs.x=mpos.x - X;
// mofs.y=mpos.y - Y;
//}
//if(M_DRAG)
//{
// if(GetAsyncKeyState(VK_LBUTTON)&1)M_DRAG=0;
// X = mpos.x - mofs.x;
// Y = mpos.y - mofs.y;
//}
if(opt.options.move && GetAsyncKeyState(VK_LCONTROL)) // If Options for Left Control is Set
{
X =(((X<=mpos.x+4) && (X>=mpos.x)) || ((X>=mpos.x-4) && (X<=mpos.x)))?(X=mpos.x):(X+=((mpos.x-X)/4));
Y =(((Y<=mpos.y+4) && (Y>=mpos.y)) || ((Y>=mpos.y-4) && (Y<=mpos.y)))?(Y=mpos.y):(Y+=((mpos.y-Y)/4));
}
Menu Items:
Code:
NO=0;
acat("FPS",FPS(0),&opt.d3d.main3);
acat("Normal Functions","[OPEN]|[CLOSE]",&opt.d3d.main);
aitem("No Reload","OFF|ON",&opt.d3d.noreload,opt.d3d.main,1);
aitem("No Recoil","OFF|ON",&opt.d3d.norecoil,opt.d3d.main,1);
aitem("No Change Delay","OFF|ON",&opt.d3d.nochangedelay,opt.d3d.main,1);
aitem("No Weapon Weight","OFF|ON",&opt.d3d.noweaponweight,opt.d3d.main,1);
aitem("No Fall Damage","OFF|ON",&opt.d3d.nofalldamage,opt.d3d.main,1);
aitem("No Nade Damage","OFF|ON",&opt.d3d.nonadedamage,opt.d3d.main,1);
acat("Super Functions","[OPEN]|[CLOSE]",&opt.d3d.main2);
aitem("See Ghosts","OFF|ON",&opt.d3d.seeghosts,opt.d3d.main2,1);
aitem("Fast Defuse","OFF|ON",&opt.d3d.fastdefuse,opt.d3d.main2,1);
aitem("Fast Plant","OFF|ON",&opt.d3d.fastplant,opt.d3d.main2,1);
aitem("Crouch Speed","OFF|ON",&opt.d3d.crouchspeed,opt.d3d.main2,1);
aitem("Speed Knife","OFF|ON",&opt.d3d.speedknife,opt.d3d.main2,1);
aitem("No Gatling Gun Speed Penalty","OFF|ON",&opt.d3d.nogatlinggunspeedpenalty,opt.d3d.main2,1);
aitem("No Gatling Gun Delay","OFF|ON",&opt.d3d.nogatlinggundelay,opt.d3d.main2,1);
acat("Menu Options","[OPEN]|[CLOSE]",&opt.options.main);
aitem("Move Menu","NO|L-CTRL",&opt.options.move,opt.options.main,1);
aitem("Save Menu","Off|Saving",&opt.options.save,opt.options.main,1);
aitem("Load Menu","Off|Loading",&opt.options.load,opt.options.main,1);
aitem("Reset Menu","Off|Resetting",&opt.options.reset,opt.options.main,1);
acat("Information ","[OPEN]|[CLOSE]",&opt.info.main);
atext("By:","Master Coders",opt.info.main,1);
atext("Version","Master Coders V4",opt.info.main,1);
/*atext("FPS",FPS(0),opt.info.main,1);*/
atext("Time",TIME(),opt.info.main,1);
atext("Date",DATE(),opt.info.main,1);
opt.options.save=0;
opt.options.load=0;
DrawBox(X,MC_MSY,WIDTH,(NO*I_SPC),C_BOX,pDevice);// Render Menu Backround for items
DrawBorder(X,MC_MSY,WIDTH,(NO*I_SPC),C_BORDER,pDevice);// set-up border
Menu Loop
Code:
for(int no=0; no<NO; no++)
{
D3DCOLOR text;
text=(*(items[no].val)>0)?C_ON:C_OFF; // Is ON OR OFF
if(items[no].type==T_CAT)
text=C_CAT; // Category
if(I_CUR==no)
{
if(BDIR==0)
(BTEX<0xFF/4)?BTEX+=1:BDIR=1;
if(BDIR==1)
(BTEX>0x00)?BTEX-=1:BDIR=0;
if(ABOR>I_SPC*I_CUR)
ABOR=I_SPC*I_CUR;
else if (ABOR<(-I_SPC*I_CUR))
ABOR=(-I_SPC*I_CUR);
if(ABOR<0)
ABOR++;
else if(ABOR>0)
ABOR--;
text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);
DrawBorder(X,MC_ITEMY(no)-ABOR,WIDTH,I_SPC,C_CUR,pDevice);
}
if(mpos.x>X && mpos.x<MC_MAXX && mpos.y>MC_ITEMY(no) && mpos.y<MC_ITEMY(no)+I_SPC)
{
text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);
DrawBorder(X,MC_ITEMY(no),WIDTH,I_SPC,C_CUR,pDevice);
}
font->DrawText(X+I_OFS,MC_ITEMY(no)+2,text,items[no].title,DT_SHADOW);
font->DrawText(X+S_OFS,MC_ITEMY(no)+2,text,items[no].state,DT_RIGHT|DT_SHADOW);
}
Footer:
Code:
DrawBox(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BOX,pDevice);// Draw Footer Filled
DrawBorder(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BORDER,pDevice);// Footer Border
font->DrawText(MC_FCTR(X,MC_MAXX),MC_ITEMY(NO)+(F_SPC/2)+2,GREEN,"Master Coders V4",DT_CENTER|DT_SHADOW);
KeyBoard Navi:
Code:
if(left && (*items[I_CUR].val)>0)
{
(*items[I_CUR].val)-=1;
Sound.wav.playsoundmem((LPCSTR)SWITCH);
}
if(right && (*items[I_CUR].val)<(items[I_CUR].max-1))
{
(*items[I_CUR].val)+=1;
Sound.wav.playsoundmem((LPCSTR)SWITCH);
}
if(up)
{
do {
I_CUR=(I_CUR==0)?(NO-1):(I_CUR-1);
if(ABOR>(-(I_SPC)))ABOR-=I_SPC;
} while (items[I_CUR].type==T_TEXT);
Sound.wav.playsoundmem((LPCSTR)MOVE);
}
if(down || items[I_CUR].type==T_TEXT)
{
do
{
I_CUR=(I_CUR+1)%NO;
if(ABOR<(I_SPC))ABOR+=I_SPC;
} while (items[I_CUR].type==T_TEXT);
Sound.wav.playsoundmem((LPCSTR)MOVE);
}
//-----------------------------------------------------------------------------
// Desc: Menu Saftey / Sanity Checks and ReEncryption
//-----------------------------------------------------------------------------
if(I_CUR>NO)I_CUR=NO-1; // Prevent Selection From Hiding be hind hidden item
//-----------------------------------------------------------------------------
}
}
D3D Menu.rar - Jotti's malware scan
[You must be registered and logged in to see this link.]
IT HAS 2 BE LIKE DAT: