well i made my own pointer based menu cause oc motivated me and because ive seen so many noob menu base code it makes me sick,to so ill spead the love(lol) this is for 1 menu, no submenus here although same idea is done..
lets start our menu pointers
struct menu{
char *NewMenu; //the menu title
char *alias[8]; //the toggle alias's
float value; //a var will be assigned to this
float minvalue; // the minimum value
float maxvalue; //...
bool Usealias; //use alias?
};
menu Menu[11];
int menuNum=11;
Now we have our pointers so lets draw the menu text eh?
u can call this in glEnable thats what i use
for(int x=0;x<menuNum;x++)
{
BuildMenu(); //umm call the menu wtf u think?
Print(302,315+(menuPos*12),0,1,0,0,">"); //y menu highlight
Print(textX,textY,Menu[x].NewMenu); //adds 1 to x so u get 0-11(11=menuNum)
//if ur want to use an alias for ur values(this was a pain for me to figure out!!) then..
if(Menu[x].Usealias)Print(400,315+(12*x),0,1,1,0,Menu[x].alias[y]);
else{
glDisable(GL_TEXTURE_2D);
glColor3f(1,1,0);
glRasterPos2f(400,315+(12*x));
glPrint("%.2f",Menu[x].value);
(*orig_glEnable)(GL_TEXTURE_2D);
}
}
//Now somewhere in ur hack above ^^ make a func like
void BuildMenu()
{
Menu[0].NewMenu="My First Entry!!";
aimbot=Menu[0].value; to reverse this do as oc did, make a new func and call it b4 BuildMenu(); in glEnable and do something like aimbot=Menu[0].value; then u can do Menu[0].value=aimbot; here :-p
Menu[0].minvalue=0;
Menu[0].maxvalue=1;
Menu[0].Usealias=true;
Menu[0].alias[0]="off";
Menu[0].alias[1]="on";
Menu[1].NewMenu="My Second Entry!!";
Menu[2].NewMenu="My Third Entry!!";
Menu[3].NewMenu=".....";
}
// ok so this will draw the menu now lets toggle thru it!
void menuUp()
{
if(menuPos<1)menuPos=menuNum;
else menuPos--;
}
void menuDown()
{
if(menuPos==menuNum)menuPos=0;
else menuPos++;
}
void menuRight()
{
int x=menuPos;
if(Menu[x].value<Menu[x].maxvalue)
{
Menu[x].value++;
}
else if(Menu[x].value>Menu[x].maxvalue)return;
Save();
}
void menuLeft()
{
int x=menuPos;
if(Menu[x].value>Menu[x].minvalue)
{
Menu[x].value--;
}
else if(Menu[x].value>Menu[x].minvalue)return;
Save();
}
yea then assign w/e keys to toggle any questions aim me...
flammers if any, fuck u
aim=static bool
//=================================================================================
much better
menu.cpp
code:--------------------------------------------------------------------------------
#pragma warning(disable:4267)
#pragma warning(disable:4018)
#include "menu.h"
extern cl_enginefuncs_s *pEngfuncs;
Menu gMenu;
Menu::Menu()
{
menuPos = 1;
}
Menu::~Menu()
{
}
void Menu_Init() //call this once
{
//aimbot
gMenu.AddEntry("Aimbot" ,3.0f ,0.0f ,1.0f ,1.0f ,&aimbot);
gMenu.AddEntry("Aimthru" ,1.0f ,0.0f ,1.0f, 1.0f ,&aimthru);
gMenu.AddEntry("Shoot" ,1.0f ,0.0f ,1.0f ,1.0f ,&shoot);
gMenu.AddEntry("Smooth" ,5.0f ,0.0f ,1.0f ,1.0f ,&smooth);
gMenu.AddEntry("FOV" ,360.0f,0.0f ,10.0f,5.0f ,&fov);
gMenu.AddEntry("Anti-Recoil" ,1.0f ,0.0f ,1.0f ,1.0f ,&recoil);
gMenu.AddEntry("Stand-Height" ,24.0f ,18.0f,0.25f,0.25f,&stand_h);
gMenu.AddEntry("Stand-Forward",5.0f ,-5.0f,0.25f,0.25f,&stand_f);
gMenu.AddEntry("Duck-Height" ,24.0f ,18.0f,0.25f,0.25f,&duck_h);
gMenu.AddEntry("Duck-Forward" ,5.0f ,-5.0f,0.25f,0.25f,&duck_f);
//esp
gMenu.AddEntry("Sound ESP" ,2.0f,0.0f,1.0f,1.0f,&sound);
gMenu.AddEntry("Weapon ESP" ,1.0f,0.0f,1.0f,1.0f,&weapon);
gMenu.AddEntry("Name ESP" ,1.0f,0.0f,1.0f,1.0f,&name);
gMenu.AddEntry("Box ESP" ,1.0f,0.0f,1.0f,1.0f,&box);
gMenu.AddEntry("Distance ESP" ,1.0f,0.0f,1.0f,1.0f,&dist);
gMenu.AddEntry("Spiked Models",100 ,0.0f,10 ,10 ,&spiked);
gMenu.AddEntry("Barrel Hack" ,150 ,0.0f,10 ,10 ,&barrel);
gMenu.AddEntry("Glowing" ,1.0f,0.0f,1.0f,1.0f,&glow);
gMenu.AddEntry("Radar" ,1.0f,0.0f,1.0f,1.0f,&radar);
//removals
gMenu.AddEntry("Flash Removal",1.0f,0.0f,1.0f,1.0f,&flash);
gMenu.AddEntry("Smoke Removal",1.0f,0.0f,1.0f,1.0f,&smoke);
//misc
gMenu.AddEntry("Crosshair" ,3.0f,0.0f,1.0f,1.0f,&crosshair);
gMenu.AddEntry("System-Time" ,1.0f,0.0f,1.0f,1.0f,&time);
gMenu.AddEntry("Bunny-Hopping",1.0f,0.0f,1.0f,1.0f,&jump);
gMenu.AddEntry("HUD Stats" ,1.0f,0.0f,1.0f,1.0f,&stats);
}
void Menu:own( void )
{
int maxent = (entries.size());
if(menuPos == maxent)
{
menuPos = 1;
}
else
{
menuPos++;
}
}
void Menu::Up( void )
{
if(menuPos == 1)
{
menuPos = (entries.size());
}else
{
menuPos--;
}
}
void Menu::AddEntry(char *name,float max,float min,float plus,float minus,xcvar_t *cvar)
{
entry_s entry;
entry.name = name;
entry.max = max;
entry.min = min;
entry.plus = plus;
entry.minus = minus;
entry.cvar = cvar;
entries.push_back(entry);
}
void Menu::Select(int mode)
{
switch(mode)
{
case 1:
if(entries[(menuPos-1)].cvar->value < entries[(menuPos-1)].max)
{
entries[(menuPos-1)].cvar->value += entries[(menuPos-1)].plus;
}
break;
case 2:
if(entries[(menuPos-1)].cvar->value > entries[(menuPos-1)].min)
{
entries[(menuPos-1)].cvar->value -= entries[(menuPos-1)].minus;
}
break;
}
}
void Menu:raw(int xx , int yy , int width , int r , int g , int b ,int a)
{
this->x = xx;
this->y = yy;
this->w = width;
ColorEntry *clr = colorList.get(21);
//background
tintArea(xx-6,yy-4,width,(entries.size()*15)+18,clr);
//selector bar
ColorEntry *color = colorList.get(22);
tintArea(xx-6,yy+(12+((menuPos-1)*15)),width,15,color);
//title
pfnDrawSetTextColor(255,255,0); //Yellow
pfnDrawConsoleString(xx+28,yy-5,"hlh lite 1.3");
//entries
for(int x=0; x < entries.size() ; x++)
{
char value[256];
sprintf(value,"%0.1f",entries[x].cvar->value);
pfnDrawSetTextColor(255,255,255); //white
pfnDrawConsoleString(xx ,y+(12+(x*15)),entries[x].name);
pfnDrawSetTextColor(255,255,255); //white
pfnDrawConsoleString(xx+110,y+(12+(x*15)),value)
;
}
}
void Menu::Keys()
{
static bool up;
static bool down;
static bool dec;
static bool select;
static bool back;
static bool menu;
static bool off;
if((GetAsyncKeyState(key.down) < 0) && !down)
{
if(active)
{
Down();
}
down = true;
}else if(!(GetAsyncKeyState(key.down) <0) && down)
{
down = false;
}
if((GetAsyncKeyState(key.up) < 0) && !up)
{
if(active)
{
Up();
}
up = true;
}else if(!(GetAsyncKeyState(key.up) <0) && up)
{
up= false;
}
if((GetAsyncKeyState(key.select) < 0) && !select)
{
if(active)
{
Select(1);
}
select = true;
}else if(!(GetAsyncKeyState(key.select) <0) && select)
{
select= false;
}
if((GetAsyncKeyState(key.back) < 0) && !dec)
{
if(active)
{
Select(2);
}
dec = true;
}else if(!(GetAsyncKeyState(key.back) <0) && dec)
{
dec= false;
}
if((GetAsyncKeyState(key.menu) < 0) && !menu)
{
if(active)
{
active = false;
cvar.save();
}else{
active = true;
cvar.load();
}
menu = true;
}else if(!(GetAsyncKeyState(key.menu) <0) && menu)
{
menu= false;
}
extern bool panic;
if((GetAsyncKeyState(key.panic) < 0) && !off)
{
cvar.save();
cvar.off();
active=false;
panic=true;
off=true;
}else if(!(GetAsyncKeyState(key.panic) <0) && off)
{
off=false;
}
}
--------------------------------------------------------------------------------
menu.h
code:--------------------------------------------------------------------------------
#ifndef MENU_H
#define MENU_H
#include <windows.h>
#include <stdio.h>
#include <vector>
#include "Client.h"
#include "cvar.h"
#include "color.h"
using namespace std;
struct entry_s
{
xcvar_t *cvar;
float plus;
float minus;
float min;
float max;
char *name;
};
class Menu
{
public:
Menu();
~Menu();
//x y w h r g b a
void Draw(int,int,int,int,int,int,int);
void Up();
void Down();
void Select(int);
void Keys();
void AddEntry(char *name,float max,float min,float plus,float minus,xcvar_t *cvar);
bool active;
private:
int next;
int x,y;
int w;
int menuPos;
vector<entry_s>entries;
};
void Menu_Init();
extern Menu gMenu;
#endif
//cvar
typedef struct xcvar_s
{
char *name; //cvar-name
float value; //cvar-value
}xcvar_t;