EDIT 2: CREDITS TO TOPBLAST! HE GAVE AC1D_BURN THE SOURCE AND HE RELEASED IT!
EDIT: WARNING THIS WAS BUILT FOR 800 WINDOW WIDTH! I DIDN'T REALIZE THAT PROBLEM TO KNOW, WHEN I TESTED IN 1600! BUT ANY REAL CODER CAN FIGURE OUT THE PROBLEM!
Hello everyone! Welcome to another source code release by me!
So I was looking around MPGH, and within the Combat Arms Hack Source I found a thread started by ac1d_buRn. The code includes a method of creating "XL Tabs," as ac1d_buRn would say in his original thread.
What I did was took the idea and made a simpler and more organized version! So here it is!
My Class
Code:
class Tabs
{
public:
int inumberTabs;
int tabSize;
int currentItem;
char *arrayText[6]; //6 is the number of tabs
void InitiateTabs(double screenWidth, int numberTabs);
void AddTab(int number, int arrayNum);
void NavigateTabs();
}
Initiate Tabs
Code:
void Tabs::InitiateTabs(double screenWidth, int numberTabs)
{
arrayText[0] = "Tab 1"; //Tab 1 text
arrayText[1] = "Tab 2"; //Tab 2 text
arrayText[2] = "Tab 3"; //Tab 3 text
arrayText[3] = "Tab 4"; //Tab 4 text
arrayText[4] = "Tab 5"; //Tab 5 text
arrayText[5] = "Tab 6"; //Tab 6 text
inumberTabs = numberTabs; //Set inumberTabs to numberTabs so that we can use the value of numberTabs outside the function
tabSize = screenWidth / numberTabs; //Set the tab size to a numberTabs'th of the screen(/window in my case) width
}
Add Tab
Code:
void Tabs::AddTab(int number, int arrayNum)
{
DrawBox1((tabSize * (number - 1)) + 1, 0, tabSize + 1, 50, 3, D3DCOLOR_ARGB(255, 192, 192, 192), D3DCOLOR_XRGB(100, 100, 100), g_pLine);
PrintText2((tabSize * (number - 1)) - tabSize * 1.4f, 0, D3DCOLOR_XRGB(255, 0, 0), DT_CENTER | DT_VCENTER, g_pFont, arrayText[arrayNum]);
}
Navigation
Code:
void Tabs::NavigateTabs()
{
if(GetAsyncKeyState(VK_RIGHT)&1)
{
if(currentItem < inumberTabs - 1)
{
currentItem++;
}
}
if(GetAsyncKeyState(VK_LEFT)&1)
{
if(currentItem > 0)
{
currentItem--;
}
}
DrawBox1(tabSize * currentItem, 0, tabSize + 1, 50, 3, D3DCOLOR_ARGB(255, 131, 181, 131), NULL, g_pLine);
DrawBorder1((tabSize * currentItem) + 2, 0 + 2, tabSize + 1 - 4, 50 - 4, 1, D3DCOLOR_ARGB(255, 80, 130, 80), g_pLine);
DrawBorder1(tabSize * currentItem, 0, tabSize + 1, 50, 2, D3DCOLOR_ARGB(255, 0, 255, 0), g_pLine);
PrintText2((tabSize * currentItem) - tabSize * 1.4f, 0, D3DCOLOR_XRGB(255, 0, 0), DT_CENTER | DT_VCENTER, g_pFont, arrayText[currentItem]);
}
Okay that's all the functions!
My functions:
Code:
FillARGB1(double x, double y, double w, double h, DWORD dwColor, LPD3DXLINE pLine);
DrawBorder1(double x, double y, double w, double h, int px, DWORD dwColor, LPD3DXLINE pDevice);
DrawBox1(double x, double y, double w, double h, int px, DWORD dwFillColor, DWORD dwBorderColor, LPD3DXLINE pLine);
PrintText2(double x, double y, DWORD dwColor, DWORD dwFormat, LPD3DXFONT pFont, char *Text, ...);