About This File
Its a lil bit older,but anyways enjoy:
cMenu.cpp
#include "cMenu.h" /*INFORMATIONS =====POINT 1=====FUNCTIONS==== *Folder Function *Descrition Function *Colored Items *Arrow Control ====POINT 2===CREDITING==== *KingClem -Menu Class,Hooking,Examples.... *Hans211 -Some hints *MSDN -always helpfull ========================== */ int M_X,M_Y,i,u,Items,Position; int M_W = 210; //Menu widht int Line = 25; //Height of one Line int Visible = 1; //Visible by Startup? int Key = VK_INSERT; //Menu Key DWORD Col_Title = D3DCOLOR_ARGB(255,255,255,255); //Color Title DWORD Col_Cur = D3DCOLOR_ARGB(255, 255, 125, 000); //Color Current DWORD Col_On = D3DCOLOR_ARGB(255, 000, 255, 000); //Color ON DWORD Col_Off = D3DCOLOR_ARGB(255, 255, 000, 000); //Color OFF DWORD Col_Desc = D3DCOLOR_ARGB(255,255,0,0); //Color from the Description Text DWORD Col_Folder = D3DCOLOR_ARGB(255, 255, 255, 000) ; //Color for the Folder //Enable Descrition Box (You must fill it out self if you deactivate) BYTE Desc_Box_Enable = 1; //1 = Enabled,0 = Disabled struct Menu{ char *Name; int *options; char **Items; char *Description; int Max; int Type; }M_Struct[200]; //200 = Max Hacks...You can change it like you want //Adding a Hack to the Struct void cMenu::AddMenuOption(char *text,int *opt,char **ItemArray,char *ItemDescription,int Max,int Type) { M_Struct[items].Name = text;//adding text char to menu struct M_Struct[items].options = opt;//adding int to menu struct M_Struct[items].Items = ItemArray;//Adding Off/on chars to to menu struct M_Struct[items].Description = ItemDescription;//Adding item desc to menu struct M_Struct[items].Max = Max; //Adding max val to menu struct M_Struct[items].Type = Type; //Menuitem?MenuFolder? Items++;//One more Item } //Navigating the Menu void cMenu::Navigation() { int value; if (GetAsyncKeyState(Key)&1) Visible=(!Visible);//Visible Change if (Visible){//Is menu visible? value=0;//we make value to zero,to prevent errors if(GetAsyncKeyState(VK_DOWN)&1){//Down Arrow Position++;//calculating Position +1 if(M_Struct[Position].Name == 0)//if no text entred we calculate one back,so the user cant leave the menu Position--;//read above } if(GetAsyncKeyState(VK_UP)&1){//if pressing arrow up Position--; //calculating Position -1 if(Position == -1)Position=0;//If position is -1 ,position = 0,so we cant leave the menu } //if pressing right arrow else if(GetAsyncKeyState(VK_RIGHT)&1) { if(*M_Struct[Position].options < M_Struct[Position].Max-1)//Is options smaler then Maximal - 1? value++;//calculating value +1 } //If pressing left arrow else if((GetAsyncKeyState(VK_LEFT)&1) && *M_Struct[Position].options >0){//Is options bigger then 0 value--;//calculating value -1 } if(value){//value is not 0 *M_Struct[Position].options += value; if(M_Struct[Position].Type == FOLDER){ Items = 0; memset(&M_Struct,0,sizeof(M_Struct)); }//Ending Menu Rebuild }//Ending Value Change } //Ending Visible Check } void cMenu::DrawMenu(char *Title,int x,int y,ID3DXFont *pFont) { DWORD Item_Color;//The Variable for Item Color int i3;//Variable used for for(; D3D cD3D;//Initzializing the D3D Helper M_X = x+25;//Setting X Cord M_Y = y+25;//Setting Y Cord if(Visible){//Is Menu Visible? cD3D.DrawTextA(x+25,y,Col_Title,Title,pFont);//Drawing the Title for (i3=0; i3<Items; i3++) {//Check MSDN:http://msdn.microsoft.com/en-us/library/b80153d8%28v=vs.71%29.aspx if(*M_Struct[i3].options==0)//If option is 0 (off) Item_Color = Col_Off;//change Item Color to Color Off if(*M_Struct[i3].options>0)//If option is higher then 0 Item_Color = Col_On; //change Item Color to Color On if(M_Struct[i3].Type==FOLDER)//If type is folder Item_Color = Col_Folder;//change Item Color to Folder Color if(i3 == Position)//If current Item_Color = Col_Cur;//change Item Color to Current Color cD3D.DrawTextA(M_X,M_Y+Line*i3,Item_Color,M_Struct[i3].Name,pFont);//Drawing item text cD3D.DrawTextA(M_X+(M_W-20),M_Y+Line*i3,Item_Color,M_Struct[i3].Items[*M_Struct[i3].options],pFont);//Drawing Off/On Text /*Description Box*/ if(Desc_Box_Enable){ cD3D.DrawTextA(M_X+M_W+50,M_Y,Col_Desc,"Description:",pFont); cD3D.DrawTextA(M_X+M_W+50,M_Y+Line,Col_Desc,M_Struct[Position].Description,pFont);//Drawing the Desc Text }//ending descritiption box draw }//Ending the for statement }//Ending Visible check }
cMenu.h
#pragma once #include "D3D.h" #include <Windows.h> extern int Items,Key; #define FOLDER 2 #define ITEM 1 class cMenu { public: void AddMenuOption(char *text,int *opt,char **ItemArray,char *ItemDescription,int Max,int Type); void Navigation(); void DrawMenu(char *Title,int x,int y,ID3DXFont *pFont); };
D3D.cpp
#include "D3D.h" //Little D3D Draw Class void D3D::DrawTextC(int x,int y,DWORD color,char *text, ID3DXFont* pFont1) { RECT rect; SetRect( &rect, x, y, x, y ); pFont1->DrawTextA(NULL,text,-1,&rect, DT_CENTER|DT_NOCLIP, color ); } void D3D::DrawTextA(int x,int y,DWORD color,char *text,ID3DXFont* pFont1) { RECT rect; SetRect( &rect, x, y, x, y ); pFont1->DrawTextA(NULL,text,-1,&rect, DT_LEFT|DT_NOCLIP, color ); } void D3D::DrawRect(IDirect3DDevice9* pDevice, int CordX, int CordY, int CordW, int CordH, D3DCOLOR Color) { D3DRECT Cords = { CordX, CordY, CordX + CordW, CordY + CordH }; pDevice->Clear(1, &Cords, D3DCLEAR_TARGET, Color, 0, 0); }
D3D.h
#pragma once #include <d3d9.h> #include <d3dx9.h> class D3D { public: void DrawTextC(int x,int y,DWORD color,char *text, ID3DXFont* pFont1); void DrawRect(IDirect3DDevice9* pDevice, int CordX, int CordY, int CordW, int CordH, D3DCOLOR Color); void DrawTextA(int x,int y,DWORD color,char *text,ID3DXFont* pFont1); };
First include : cMenu.h in your Main.
Then add this:
cHelper *Helper; //Initzializing our Helper Class cHook *Hook;//"" Hooking Class D3D *cD3D;// "" Helper Draw Class cMenu KC_Menu;//"" Menu Class ID3DXFont* pFont;//"" Font
then you create a Void for the Menu Building:
Example:
//Adding menu items void MyMenu(void) { KC_Menu.AddMenuOption("Menu Settings",&Folder1,cFolder,"Here are the Menu Settings",2,FOLDER); if(Folder1){ KC_Menu.AddMenuOption("Change Key",&Change_Key,cKey,"Change the Menu Visbible Key",3,ITEM); //You can add thinks like change color,or menu widht or something } KC_Menu.AddMenuOption("Folder Two",&Folder2,cFolder,"This is another Folder",2,FOLDER); if(Folder2){ KC_Menu.AddMenuOption("Hack Two",&Example2,cNbr,"This is only another Example",101,ITEM); KC_Menu.AddMenuOption("BlaBla",&Example3,Off_On,"Well,nothing to say",2,ITEM); } }
Then call it like this in your Endscene:
if(Items==0){MyMenu(); }//if no items loadet,we do it KC_Menu.DrawMenu("KingClem's Public",50,30,pFont);//Drawing the Menu KC_Menu.Navigation(); //Menu Navigation
Hooked Base Download:
Recommended Comments
There are no comments to display.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.