cout << "Hello I Hack & NGU IS THE LALA LAND 4 Hacker. " ?? endl;
cout << "Hello I Hack & NGU IS THE LALA LAND 4 Hacker. " ?? endl;
[/ php ]
[php]
//drawMenu.h
#include<iostream>
#include<windows.h>
#include<string>
#include <stdio.h>
#include<conio.h>
using namespace std;
void ShowConsoleCursor( BOOL bShow )
{
static HANDLE hOut;
static BOOL firstTime = TRUE;
CONSOLE_CURSOR_INFO cursorInfo;
if( firstTime )
{
hOut = GetStdHandle( STD_OUTPUT_HANDLE );
firstTime = FALSE;
}
cursorInfo.dwSize = 10;
cursorInfo.bVisible = bShow;
SetConsoleCursorInfo( hOut,
&cursorInfo );
}
void gotoxy( short x, short y ) {
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
COORD position = { x, y };
SetConsoleCursorPosition( hStdout, position );
}
bool matchMenu(int a,int b)
{
if((a-97)==b)
return true;
else
return false;
}
void menuUp(char& a,int arraySize)
{
if((a-97)==0)
{
a+=(arraySize-1);
}
else
{
a-=1;
}
return;
}
void menuDown(char& a,int arraySize)
{
if((a-97)==(arraySize-1))
{
a-=(arraySize-1);
}
else
{
a+=1;
}
return;
}
int drawMenu(string message,string menuNameParse,int tabs)
{
ShowConsoleCursor(0);
CONSOLE_SCREEN_BUFFER_INFO SBInfo;
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
int menuAmmount=0,catchArrow,whichArrow,keyInput;
string menuNamesAfterParse,tabsQuantity;
for(int a=0;a<tabs;a++)
{
tabsQuantity+="\t";
}
menuNamesAfterParse=menuNameParse;
for(;
{
menuAmmount+=1;
if(menuNameParse.find_first_of('|'>=30)
break;
menuNameParse = menuNameParse.substr(0, menuNameParse.find_last_of('|');
}
string menuNames[menuAmmount];
for(int i=0;i<menuAmmount;i++)
{
menuNames[i]=menuNamesAfterParse.substr(0, menuNamesAfterParse.find_first_of('|' );
if(i!=(menuAmmount-1))
{
menuNamesAfterParse = menuNamesAfterParse.substr(menuNamesAfterParse.find_first_of('|');
menuNamesAfterParse = menuNamesAfterParse.substr(1);
}
}
char menuOn='a';
cout<<tabsQuantity<<"<"<<message<<">\n
";
for(;
{
GetConsoleScreenBufferInfo(hOut, &SBInfo);
for(int i=0;i<menuAmmount;i++)
{
cout<<tabsQuantity;
if(matchMenu(menuOn,i))
{
SetConsoleTextAttribute(hOut,BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_INTENSITY|NULL);
cout<<menuNames[i]<<endl;
SetConsoleTextAttribute(hOut, FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED|NULL);
}
else
{
cout<<menuNames[i]<<endl;
}
}
gotoxy(0,0);
catchArrow=getch();
gotoxy(SBInfo.dwCursorPosition.X,SBInfo.dwCursorPosition.Y);
if (catchArrow==224)
{
whichArrow=getch();
switch(whichArrow)
{
case 72: keyInput=1;
break;
case 80: keyInput=2;
break;
case 75: keyInput=3;
break;
case 77: keyInput=4;
break;
}
}
else if(catchArrow==13)
{
keyInput=5;
}
else
{
keyInput=0;
}
if(keyInput==1)
{
menuUp(menuOn,menuAmmount);
}
if(keyInput==2)
{
menuDown(menuOn,menuAmmount);
}
if(keyInput==5)
{
system("cls");
ShowConsoleCursor(1);
return(int(menuOn-96));
}
}
}
//TheUberFail
Copyright © 2024, NextGenUpdate.
All Rights Reserved.