Information ==========
- This menu click is mostly for Hans+Gellins Base in which Whit made!
- I haven't released much so here is something.
- This is for advanced coders only
Source =============
Menu.cpp
- We are going to use isMouseinRegion thanks to IcySeal
[php]bool isMouseinRegion(POINT cPos, int x1, int y1, int x2, int y2)
{
if(cPos.x > x1 && cPos.x < x2 && cPos.y > y1 && cPos.y < y2){
return true;
} else {
return false;
}
}[/php]
- Now we use this MenuClick made by me
[php]bool cMenu::MenuClick(int x, int y, int width, POINT loc)
{
int i;
if (Mtitle[0]) {
y+=(Mysize*2);
}
for (i=0; i<Mmax; i++) {
int val=(MENU[i].var)?(*MENU[i].var):0;
if (isMouseinRegion(loc, x, y, x+width, y+Mysize)) {
// do operation
Mpos = i;
if (*MENU[Mpos].var < (MENU[Mpos].maxvalue-1)) {
*MENU[Mpos].var += 1;
} else {
*MENU[Mpos].var = 0;
}
if (MENU[Mpos].typ == MENUFOLDER) { // menu tab
if (*MENU[Mpos].var > 0)
Mpos++;
Mmax=0;
}
Sleep(100);
return true;
}
y += Mysize;
}
return false;
}[/php]
Menu.h
- Were it says ( Red = add to the code )
class cMenu{
public:
void RenderMenu(void);
void MenuNav(void);
void MenuShow(int x, int y, ID3DXFont *pFont);
Add this ----> bool MenuClick(int x, int y, int width, POINT loc);
private:
void AddItem(char *txt, char **opt, int *var, int maxvalue, int typ);
}
A good coder would get this!![]()