Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > Direct3D

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D
hacking programming reversing
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

Complete Mouse Menu
Old 07-26-2010, 04:40 PM   #1
n00bie

Fatkid's Avatar

Join Date: Jul 2010
Posts: 3
Reputation: 110
Rep Power: 20
Fatkid is officially drafted by UCFatkid is officially drafted by UC
Complete Mouse Menu

Don't get scared away by my low post count. There are no binaries here and none of this code is stolen, or in use on a pay site. With that said I will now begin the thread

Features of this release:
- Mouse controlled menu (with tabs)
- Easy to expand on
- Mostly clean code
- Save/load settings included
- Works in any game or hook


I left out certain features like multiple window support, combo boxes, sliders, console window, and some other things. The reason is I wanted to make the post simple, and maybe get some creative juices flowing.


Menu Notes:
I am releasing this because I am no longer working on it and someone should give it the love and attention it deserves.

Quote:
How to add items to the menu:

Here is the function definition for adding an item
CItem * CMenu::AddItem(CItem * pItem)

Here is the constructor for a checkbox
CCheckBox(int x, int y, char* szName, int iTab, float DefaultValue, float *pVar);

This is one way you can use it
pMenu->AddItem(new CCheckBox(20, 70, "Check1", 1, 0, &g_Vars.Check1));

What I dereference is a float, defined like this
float Check1;

When you click the checkbox it will modify that float, so i can do this outside of the menu
if(g_Vars.Check1)
//Hack code here

I'm going to leave adding a button up to you but it's not hard at all
Renderer Notes:
The primitive renderer is not only kind of slow but you may run into issues in certain games.
Quote:
I did not have permission from the author of the renderer I originally used to release it with this menu. I included a simple primitive renderer, however, I highly recommend you switch to sprite rendering because it is much faster.
Main Include "CMenu.h":
Code:
#pragma once

//////////////////////////////////////////////////////
/*
THIS IS A UC-FORUM ONLY RELEASE
www.uc-forum.com

This code is not to be sold, it is public code ONLY and is for learning purposes.
*/
//////////////////////////////////////////////////////


/*Constructors of importance:
CMenu::CMenu
CItem::CCheckBox
CItem::CButton
CItem::CTab

Functions of importance:
CMenu::AddItem
CMenu::DoMenu
CINIReader::FileToVariable
CINIReader::VariableToFile
*/

/*
How to add items to the menu:

Here is the function definition for adding an item
CItem * CMenu::AddItem(CItem * pItem)

Here is the constructor for a checkbox
CCheckBox(int x, int y, char* szName, int iTab, float DefaultValue, float *pVar);

This is one way you can use it
pMenu->AddItem(new CCheckBox(20, 70, "Check1", 1, 0, &g_Vars.Check1));

What I dereference is a float, defined like this
float Check1;

When you click the checkbox it will modify that float, so i can do this outside of the menu
if(g_Vars.Check1)
    //Hack code here

I'm going to leave adding a button up to you but it's not hard at all


Renderer notes:
I did not have permission from the author of the renderer I originally used to release it with this menu.
I included a simple primitive renderer, however, I highly recommend you switch to sprite rendering because it is much faster.
*/

//Colors
#define COLOR_NORMAL        D3DCOLOR_ARGB(255, 25, 25, 25)
#define COLOR_MOUSEOVER        D3DCOLOR_ARGB(255, 40, 40, 40)
#define COLOR_MOUSECLICK    D3DCOLOR_ARGB(255, 55, 55, 55)
#define COLOR_TEXT            D3DCOLOR_ARGB(255, 255, 255, 255)

#define COLOR_BACK            D3DCOLOR_ARGB(255, 30, 30, 30)
#define COLOR_ITEM_BACK        D3DCOLOR_ARGB(255, 45, 45, 45)

#define COLOR_CURSOR        D3DCOLOR_ARGB(255, 255, 50, 0)


//These are used for saving/loading settings
#define ITEMTYPE_TAB 0
#define ITEMTYPE_CHECKBOX 1
#define ITEMTYPE_BUTTON 2

#pragma warning(disable: 4244)

class CVariables;
class CMenuInfo;
class CBaseMenu;
class CMenu;
class CItem;

class CCheckBox;
class CButton;
class CTab;





#include "CBaseMenu.h"
#include "CMenuItem.h"
#include "CVariableManager.h"
Main Menu Code "CBaseMenu.h":
Code:
#pragma once

#define LIST_SIZE 18

//Everything in the menu gets a pointer to this
class CMenuInfo
{
public:
    //Mouse stuff
    int Left, Right;
    int aLeft, aRight;
    POINT CursorPos;
    RECT WndRect;
    HWND WindowHandle;

    //Is menu open
    bool * pbOpen;

    int iNumItems;
    CMenu * pWindow;
};

//Everything gets a pointer to this, which holds the Info pointer
class CBaseMenu
{
public:
    CBaseMenu();
    ~CBaseMenu();

    BOOL IsPointInRect(int PointX, int PointY, int RectX, int RectY, int RectW, int RectH);
    int GetMouseInfo();

    CMenuInfo* Info;
    D3DVIEWPORT9 Viewport;
};


class CMenu : public CBaseMenu
{
public:
    CMenu(LPDIRECT3DDEVICE9 pDevice, int X, int Y, int W, int H, char * szName);
    ~CMenu();

    void DoMenu();
    void DrawCursor(int type);


    void LoadSettings();
    void SaveSettings();

    CItem * AddItem(CItem* pItem);

    int iNumItems;
    int iCurrentTab;
    int iNumTabs;
    int OldX, OldY;
    int x, y, w, h;

    bool bIsOpen;
    bool bMoving;

    DWORD dwColor;


private:
    int CheckMove();
    bool bFirstCall;
    char    * szName;
    CItem    * pItemList[LIST_SIZE];
};
CBaseMenu.cpp
Code:
#include "stdafx.h"

//extern this!!!!!!!
CVariables g_Vars;



////////////////////////////////////////////////////////////////
//Base Menu Code
////////////////////////////////////////////////////////////////

CMenu::CMenu(LPDIRECT3DDEVICE9 pDevice, int X, int Y, int W, int H, char * szName)
{
    pDevice->GetViewport(&Viewport);

    Info    = new CMenuInfo();

    bIsOpen = false;
    bFirstCall = true;
    Info->pbOpen = &bIsOpen;
    iNumItems = 0;


    this->x                = X;
    this->y                = Y;
    this->w                = W;
    this->h                = H;
    this->szName        = szName;
    this->dwColor        = COLOR_BACK;
    this->iCurrentTab    = 1;
    this->iNumItems        = 0;
    this->bMoving        = false;
    Info->pWindow        = this;

    //This may have to be moved depending on the game, you can figure that one out :)
    Info->WindowHandle = GetForegroundWindow();
    GetWindowRect(Info->WindowHandle, &Info->WndRect);
}

void CMenu::LoadSettings()
{
    g_Vars.INI.SetFile("HackSettings.ini");
    g_Vars.INI.SetSection(this->szName);

    if(iNumItems > 0)
    {
        for(int j = 0; j < iNumItems; j++)
        {
            if(pItemList[j]->type != ITEMTYPE_TAB && pItemList[j]->type != ITEMTYPE_BUTTON)
                g_Vars.INI.FileToVariable(pItemList[j]->szName, pItemList[j]->DefaultValue, pItemList[j]->value);
        }
    }
}

void CMenu::SaveSettings()
{
    g_Vars.INI.SetFile("HackSettings.ini");
    g_Vars.INI.SetSection(this->szName);

    if(iNumItems > 0)
    {
        for(int j = 0; j < iNumItems; j++)
        {
            if(pItemList[j]->type != ITEMTYPE_TAB && pItemList[j]->type != ITEMTYPE_BUTTON)
                g_Vars.INI.VariableToFile(pItemList[j]->szName, *pItemList[j]->value);
        }
    }
}


CItem * CMenu::AddItem(CItem * pItem)
{
    pItem->pWindow            = this;
    pItem->Info                = this->Info;
    pItem->index            = this->iNumItems;
    pItemList[iNumItems]    = pItem;

    iNumItems++;
    Info->iNumItems++;

    return pItem;
}


void CMenu::DoMenu()
{

    //INI Settings
    if(bFirstCall)
    {
        LoadSettings();
        SaveSettings();
        bFirstCall = false;
    }

    if(GetAsyncKeyState(VK_DELETE)&1)
    {
        //If the menu is open and closing save settings
        if(bIsOpen == true)
        {
            SaveSettings();
        }

        //Open/close
        bIsOpen = !bIsOpen;
    }

    if(bIsOpen)
    {
        GetMouseInfo();
        
        pRenderer->FillRect(x, y, w, h, dwColor);
        pRenderer->DrawBox(x, y, w, h, dwColor + D3DCOLOR_ARGB(0, 25, 25, 25));

        pRenderer->DrawText(x + (w/2), y + 2, COLOR_TEXT, szName, DT_CENTER);

        //Draw menu objects
        for(int i = 0; i < iNumItems; i++)
            if(pItemList[i]->iTabnum == iCurrentTab || pItemList[i]->type == 0 || pItemList[i]->iTabnum == 0)
                pItemList[i]->Draw();

        CheckMove();
        DrawCursor(1);
    }
}

//Professional looking movement :)
int CMenu::CheckMove()
{
    if(IsPointInRect(Info->CursorPos.x, Info->CursorPos.y, x, y, w, 20) || (Info->aLeft && bMoving))
    {
        if(Info->aLeft)
        {
            //Without this the window will fly off the screen
            if(!bMoving)
            {
                OldX = Info->CursorPos.x;
                OldY = Info->CursorPos.y;
            }

            this->x += (Info->CursorPos.x - OldX);
            this->y += (Info->CursorPos.y - OldY);

            OldX = Info->CursorPos.x;
            OldY = Info->CursorPos.y;

            bMoving = true;
        }
        else
            bMoving = false;
    }
    else if(bMoving && Info->aLeft == 0)
        bMoving = false;

    return 0;
}


void CMenu::DrawCursor(int type)
{
    if(type == 0)
        pRenderer->DrawText(Info->CursorPos.x, Info->CursorPos.y, COLOR_CURSOR, "+", DT_CENTER | DT_VCENTER);
    //Triangle
    else if(type == 1)
    {
        for(int i = 0; i < 9; i++)
        {
            pRenderer->FillRect(Info->CursorPos.x, Info->CursorPos.y+i, i, 1, COLOR_CURSOR);
            pRenderer->FillRect(Info->CursorPos.x-i, Info->CursorPos.y+i, i, 1, COLOR_CURSOR);
        }
    }
}


CMenu::~CMenu()
{
    delete Info;
    delete pItemList[iNumItems];
}


////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////

CBaseMenu::CBaseMenu()
{
}



int CBaseMenu::GetMouseInfo()
{
    GetCursorPos(&Info->CursorPos);

    //Position fix for windowed
    Info->CursorPos.x = (Info->CursorPos.x - Info->WndRect.left) - 6;
    Info->CursorPos.y = (Info->CursorPos.y - Info->WndRect.top) - 40;


    
    if(!Info->pWindow->bMoving)
    {
        //Keep cursor in window
        if(Info->CursorPos.x < Info->pWindow->x)
            Info->CursorPos.x = Info->pWindow->x;
        if(Info->CursorPos.y < Info->pWindow->y)
            Info->CursorPos.y = Info->pWindow->y;

        if(Info->CursorPos.x > Info->pWindow->x + Info->pWindow->w)
            Info->CursorPos.x = Info->pWindow->x + Info->pWindow->w;
        if(Info->CursorPos.y > Info->pWindow->y + Info->pWindow->h)
            Info->CursorPos.y = Info->pWindow->y + Info->pWindow->h;
    }/*

    {
        //Keep cursor on screen
        if(Info->CursorPos.x < 0)
            Info->CursorPos.x = 0;
        else if(Info->CursorPos.y < 0)
            Info->CursorPos.y = 0;

        if(Info->CursorPos.x > Screen.x)
            Info->CursorPos.x = Screen.x;
        else if(Info->CursorPos.y > Screen.y)
            Info->CursorPos.y = Screen.y;
    }*/


    //Buttons input
    Info->Left        = (GetAsyncKeyState(0x1)&1);
    Info->Right        = (GetAsyncKeyState(0x2)&1);

    Info->aLeft        = (GetAsyncKeyState(0x1));
    Info->aRight    = (GetAsyncKeyState(0x2));


    return 0;
}




BOOL CBaseMenu::IsPointInRect(int PointX, int PointY, int RectX, int RectY, int RectW, int RectH)
{
    if(        PointX >  RectX 
        &&    PointX < (RectX + RectW) 
        &&    PointY >  RectY 
        &&    PointY < (RectY + RectH) )
    {
        return 1;
    }
        return 0;
}



CBaseMenu::~CBaseMenu()
{
}
Menu Item Code "CMenuItem.h":
Code:
#pragma once



class CItem : public CBaseMenu
{
public:
    virtual void Draw() = 0;
    virtual int CheckMouse() = 0;


    int x, y, w, h, iTabnum;
    int index;
    float type;
    float DefaultValue;
    DWORD dwColor;

    float    * value;
    char    * szName;

    //The window that made this item
    CMenu * pWindow;
};


class CCheckBox : public CItem
{
public:
    CCheckBox(int x, int y, char* szName, int iTab, float DefaultValue, float *pVar);

    void Draw();
    int CheckMouse();
};



class CButton : public CItem
{
public:
    CButton(int x, int y, int w, int h, char* szName, int iTab, DWORD *pFunctionToCall);

    void Draw();
    int CheckMouse();
    void HandleClick();

    bool bHandleClick;
    DWORD pFunction;
};



class CTab : public CItem
{
public:
    CTab(int x, int y, int w, int h, char* szName, int iTab);
    void Draw();
    int CheckMouse();
};
CMenuItem.cpp:
Code:
#include "stdafx.h"
////////////////////////////////////////////////////////////////
//Menu Item Code
////////////////////////////////////////////////////////////////

//I tried to use the same function order for every different item type




CCheckBox::CCheckBox(int x, int y, char* szName, int iTab, float DefaultValue, float *pVar)
{
    this->x            = x;
    this->y            = y;
    this->w            = 10;
    this->h            = 10;
    this->dwColor    = COLOR_NORMAL;
    this->szName    = szName;
    this->type        = 1;
    this->value        = 0;
    this->iTabnum    = iTab;
    this->DefaultValue    = DefaultValue;
    value            = pVar;
    *value            = DefaultValue;
}




void CCheckBox::Draw()
{
    int x = this->x + pWindow->x;
    int y = this->y + pWindow->y;

    pRenderer->FillRect(x, y, w, h, dwColor);
    pRenderer->DrawBox(x, y, w, h, COLOR_TEXT);
    pRenderer->DrawText(x + w + 5, y + (h/2), COLOR_TEXT, szName, DT_VCENTER);

    if(*value == 1)
        pRenderer->DrawText(x+ (w/2), y+ (h/2) - 1, COLOR_TEXT, "x", DT_CENTER | DT_VCENTER);

    CheckMouse();
}


int CCheckBox::CheckMouse()
{
    int x = this->x + pWindow->x;
    int y = this->y + pWindow->y;

    if(IsPointInRect(pWindow->Info->CursorPos.x, pWindow->Info->CursorPos.y, x, y, w, h))
    {
        if(pWindow->Info->aLeft)
            dwColor = COLOR_MOUSECLICK;
        else
            dwColor = COLOR_MOUSEOVER;

        if(pWindow->Info->Left)
        {
            if(*value == 0)
                *value = 1;
            else
                *value = 0;
            return 1;
        }
    }
    else
        dwColor = COLOR_NORMAL;

    return 0;
}


////////////////////////////////////////////////////////
////////////////////////////////////////////////////////

//Pass in the address of a function
CButton::CButton(int x, int y, int w, int h, char* szName, int iTab, DWORD *pFunctionToCall)
{
    this->x            = x;
    this->y            = y;
    this->w            = w;
    this->h            = h;
    this->dwColor    = COLOR_NORMAL;
    this->szName    = szName;
    this->type        = 2;
    this->iTabnum    = iTab;
    pFunction = (DWORD)pFunctionToCall;
}





void CButton::Draw()
{
    int x = this->x + pWindow->x;
    int y = this->y + pWindow->y;

    pRenderer->FillRect(x, y, w, h, dwColor);
    pRenderer->DrawBox(x, y, w, h, COLOR_TEXT);
    pRenderer->DrawText(x + (w/2), y + (h/2), COLOR_TEXT, szName, DT_CENTER | DT_VCENTER);


    CheckMouse();
}



int CButton::CheckMouse()
{
    int x = this->x + pWindow->x;
    int y = this->y + pWindow->y;

    if(IsPointInRect(pWindow->Info->CursorPos.x, pWindow->Info->CursorPos.y, x, y, w, h))
    {
        if(pWindow->Info->aLeft)
            dwColor = COLOR_MOUSECLICK;
        else
            dwColor = COLOR_MOUSEOVER;

         if(pWindow->Info->Left)
         {
            HandleClick();

            return 1;
         }
    }
    else
        dwColor = COLOR_NORMAL;

    return 0;
}


void CButton::HandleClick()
{
    //Single execution button code
    DWORD func = pFunction;
    _asm
    {
        mov eax, func
        call eax
    }
}


////////////////////////////////////////////////////////
////////////////////////////////////////////////////////




CTab::CTab(int x, int y, int w, int h, char* szName, int iTab)
{
    this->x            = x;
    this->y            = y;
    this->w            = w;
    this->h            = h;
    this->dwColor    = COLOR_NORMAL;
    this->szName    = szName;
    this->type        = 0;
    this->iTabnum    = iTab;
    //this->pWindow->iNumTabs++;
}




void CTab::Draw()
{
    int x = this->x + pWindow->x;
    int y = this->y + pWindow->y;


    pRenderer->FillRect(x, y, w, h, dwColor);
    pRenderer->DrawBox(x, y, w, h, COLOR_TEXT);
    pRenderer->DrawText(x + (w/2)+1, y + (h/2), COLOR_TEXT, szName, DT_CENTER | DT_VCENTER);

    CheckMouse();
}


int CTab::CheckMouse()
{
    int x = this->x + pWindow->x;
    int y = this->y + pWindow->y;

    if(IsPointInRect(pWindow->Info->CursorPos.x, pWindow->Info->CursorPos.y, x, y, w, h))
    {
        if(pWindow->Info->aLeft)
            dwColor = COLOR_MOUSECLICK;
        else
            dwColor = COLOR_MOUSEOVER;

        if(pWindow->Info->Left)
        {
            pWindow->iCurrentTab = iTabnum;
            return 1;
        }
    }
    else
        dwColor = COLOR_NORMAL;

    if(pWindow->iCurrentTab == iTabnum)
        dwColor = COLOR_MOUSEOVER + D3DCOLOR_ARGB(0, 6, 6, 6);

    return 0;
}






/////////////////////////////////////////////////////////////////////////////



Var system:
Code:
//TODO: recode


class CINIReader
{
public:

    void SetFile(char*);
    void SetSection(char*);
    float    FileToVariable(char* szKey, float Default, float* pOut = 0);
    void    VariableToFile(char* szKey, float fltValue);

private:
    char szINIFile[256];
    char szSection[256];
};

class CVariables
{
public:
    float Button1;
    float Check1;
    float Check2;


    CINIReader INI;
};
Code:
//TODO: recode





void CINIReader::SetFile(char* szFile)
{
    char szPath[260] = {0};
    TCHAR szEXEName[MAX_PATH];
    

    GetModuleFileName(0, szPath, sizeof(szPath));

    GetModuleBaseName(GetCurrentProcess(), GetModuleHandle(NULL), szEXEName, MAX_PATH);

    memcpy(&szPath[strlen(szPath) - strlen(szEXEName)], szFile, strlen(szFile));

    strcpy(szINIFile, szPath);
}

void CINIReader::SetSection(char* Section)
{
    strcpy(szSection, Section);
}


float CINIReader::FileToVariable(char* szKey, float Default, float* pOut)
{
    
    char szResult[256];
    char szDefault[256];

    sprintf(szDefault, "%f", Default);

    GetPrivateProfileString(szSection,  szKey, szDefault, szResult, 255, szINIFile);

    if(pOut != 0)
        *pOut = (float)atof(szResult);

    return (float)atof(szResult);
    
}

void CINIReader::VariableToFile(char* szKey, float fltValue)
{
     char szValue[255];
     sprintf(szValue, "%.2f", fltValue);
     WritePrivateProfileString(szSection,  szKey, szValue, szINIFile); 
}

RENDERER CODE:
Code:
#pragma once
#include <d3d9.h>
#include <d3dx9.h>



#define MY_FVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
#define LockFlag D3DLOCK_DISCARD
#define VBUFFER_SIZE 8




class CPrimRenderer
{
public:
    CPrimRenderer(LPDIRECT3DDEVICE9 pDevice);
    ~CPrimRenderer();

    void FillRect(float x, float y, float w, float h, DWORD Color);    
    void DrawBox(float x, float y, float w, float h, DWORD Color);
    
    void DrawText(int x, int y, DWORD dwColor, char* szText, DWORD dwFormat);

    void OnLostDevice();
    void OnResetDevice();
    void BeginRendering();
    void EndRendering();


private:
    LPDIRECT3DDEVICE9 pDevice;
    LPD3DXFONT pFont;
    LPD3DXSPRITE pTextSprite;
    LPDIRECT3DVERTEXBUFFER9 v_buffer;
    struct Vertex {FLOAT X, Y, Z, RHW; DWORD COLOR;};
};
Code:
#pragma warning(disable: 4700)





CPrimRenderer::CPrimRenderer(LPDIRECT3DDEVICE9 pDevice)
{
    this->pDevice = pDevice;

    D3DXCreateFont(pDevice, 14, 0, 400, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Verdana", &pFont);
    D3DXCreateSprite(pDevice, &pTextSprite);


    pDevice->CreateVertexBuffer(VBUFFER_SIZE*sizeof(Vertex),
                               D3DUSAGE_DYNAMIC,
                               MY_FVF,
                               D3DPOOL_DEFAULT,
                               &v_buffer,
                               NULL);
}

CPrimRenderer::~CPrimRenderer()
{
    v_buffer->Release();
    pFont->Release();
    pTextSprite->Release();
    pDevice->Release();
}



void CPrimRenderer::BeginRendering()
{
    pTextSprite->Begin(D3DXSPRITE_ALPHABLEND);
    pDevice->SetFVF(MY_FVF);
    pDevice->SetStreamSource(0, v_buffer, 0, sizeof(Vertex));
}

void CPrimRenderer::EndRendering()
{
    pTextSprite->End();
}


void CPrimRenderer::OnLostDevice()
{
    pFont->OnLostDevice();
    pTextSprite->OnLostDevice();
    v_buffer->Release();
}

void CPrimRenderer::OnResetDevice()
{
    pTextSprite->OnResetDevice();
    pFont->OnResetDevice();

    pDevice->CreateVertexBuffer(VBUFFER_SIZE*sizeof(Vertex),
                           D3DUSAGE_DYNAMIC,
                           MY_FVF,
                           D3DPOOL_DEFAULT,
                           &v_buffer,
                           NULL);
}



void CPrimRenderer::FillRect(float x, float y, float w, float h, DWORD Color)
{
    //Bug fix
    x -= 0.5f;
    y -= 0.5f;



    Vertex V1[] =
    {
        //top left
        {x, y, 0, 1, Color},
        {x+w, y, 0, 1, Color},
        {x, y+h, 0, 1, Color},

        //bottom right
        {x+w, y, 0, 1, Color},
        {x+w, y+h, 0, 1, Color}

    };



    //Sprite rendering bug fix

    pDevice->SetRenderState(D3DRS_CULLMODE,    D3DCULL_CCW);



    Vertex* vertices;
    v_buffer->Lock(0, 0, (void**)&vertices, LockFlag);
    
    vertices[0] = V1[0];
    vertices[1] = V1[1];
    vertices[2] = V1[2];
    vertices[3] = V1[3];
    vertices[4] = V1[4];
    vertices[5] = V1[5];

    v_buffer->Unlock();

    pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 4);


    pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
}






void CPrimRenderer::DrawText(int x, int y, DWORD dwColor, char* szText, DWORD dwFormat)
{
    dwFormat    |= DT_NOCLIP;

    RECT rct;  
    rct.left    = x - 1;  
    rct.right    = x + 1;  
    rct.top        = y - 1;  
    rct.bottom    = y + 1;

    pFont->DrawText(pTextSprite, szText, -1, &rct, dwFormat, dwColor);
}



void CPrimRenderer::DrawBox(float x, float y, float w, float h, DWORD Color)
{
    //left
    FillRect(x, y, 1, h, Color);
    //top
    FillRect(x, y, w, 1, Color);
    //right
    FillRect(x+w, y, 1, h, Color);
    //bottom
    FillRect(x, y+h, w+1, 1, Color);
}
Credits:
Raiders - teaching me a lot about OO programming
monster64 - my hero

Last edited by Fatkid; 07-26-2010 at 04:51 PM.
Fatkid is offline

Reply With Quote


Old 07-26-2010, 05:22 PM   #2
:3 1337 :3

Wieter20's Avatar

Join Date: Nov 2008
Location: The Netherlands
Posts: 979
Reputation: 14563
Rep Power: 204
Wieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server spaceWieter20 's rep takes up 1 gig of server space
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (1)
Points: 13,900, Level: 15
Points: 13,900, Level: 15 Points: 13,900, Level: 15 Points: 13,900, Level: 15
Activity: 1.2%
Activity: 1.2% Activity: 1.2% Activity: 1.2%
Last Achievements
nice, screenie?
Wieter20 is offline

Reply With Quote

Old 07-26-2010, 05:27 PM   #3
n00bie

Fatkid's Avatar

Threadstarter
Join Date: Jul 2010
Posts: 3
Reputation: 110
Rep Power: 20
Fatkid is officially drafted by UCFatkid is officially drafted by UC
I didn't focus too much on visuals when I was coding this but it wouldn't be hard to make it more perdy

Fatkid is offline

Reply With Quote

Old 07-26-2010, 07:03 PM   #4
Supreme H4x0|2

Crucial's Avatar

Join Date: Feb 2010
Location: Chattanooga, TN
Posts: 654
Reputation: 36845
Rep Power: 406
Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!Crucial has a huge epeen!
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (3)
The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote by UnKnoWnCheaTs staff, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month
Points: 22,946, Level: 21
Points: 22,946, Level: 21 Points: 22,946, Level: 21 Points: 22,946, Level: 21
Activity: 2.4%
Activity: 2.4% Activity: 2.4% Activity: 2.4%
Last Achievements
Nice menu, thanks for sharing.
Crucial is online now

Reply With Quote

Old 07-26-2010, 07:22 PM   #5
Hax 101

|KungFuPenguin|'s Avatar

Join Date: Jan 2008
Posts: 355
Reputation: 5711
Rep Power: 114
|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS|KungFuPenguin| DEFINES UNKNOWNCHEATS
Points: 6,680, Level: 9
Points: 6,680, Level: 9 Points: 6,680, Level: 9 Points: 6,680, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Cool menu. Just a tip: instead of using an array of items (where you have to keep in track with a total items define) you could use a vector to store all your items. Its much more easy to manage cause it basically dynamically resizable, and overall just better.
|KungFuPenguin| is offline

Reply With Quote

Old 07-26-2010, 07:54 PM   #6
Broken Moderator

kolbybrooks's Avatar

Join Date: Aug 2006
Location: United States
Posts: 760
Reputation: 33567
Rep Power: 418
kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!
Points: 23,105, Level: 21
Points: 23,105, Level: 21 Points: 23,105, Level: 21 Points: 23,105, Level: 21
Activity: 20.0%
Activity: 20.0% Activity: 20.0% Activity: 20.0%
Last Achievements
Or create your own linked list, but depends on how you want to do it.
kolbybrooks is online now

Reply With Quote

Old 07-26-2010, 08:28 PM   #7
UnKnoWnCheaTeR

Freeheadshot's Avatar

Join Date: Mar 2010
Location: Germany
Posts: 941
Reputation: 40621
Rep Power: 448
Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!Freeheadshot has a huge epeen!
Recognitions:
The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote by UnKnoWnCheaTs staff, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month
Points: 25,225, Level: 22
Points: 25,225, Level: 22 Points: 25,225, Level: 22 Points: 25,225, Level: 22
Activity: 14.1%
Activity: 14.1% Activity: 14.1% Activity: 14.1%
Last Achievements
Very nice ! +rep
Freeheadshot is online now

Reply With Quote

Old 07-26-2010, 09:03 PM   #8
SEGnosis
Guest

Posts: n/a
Nice, but absolutely no features I haven't seen before D:

Reply With Quote

Old 07-26-2010, 09:16 PM   #9
Donator

raiders's Avatar

Join Date: Nov 2007
Posts: 1,494
Reputation: 72055
Rep Power: 802
raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!raiders has a huge epeen!
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (5)
The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote by UnKnoWnCheaTs staff, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month
Points: 44,627, Level: 32
Points: 44,627, Level: 32 Points: 44,627, Level: 32 Points: 44,627, Level: 32
Activity: 20.0%
Activity: 20.0% Activity: 20.0% Activity: 20.0%
Last Achievements
Quote:
Originally Posted by kolbybrooks View Post
Or create your own linked list, but depends on how you want to do it.
A linked list has more overhead when you iterate through it. Since you don't modify the list very much, it would be a better idea to use an array implementation.

Quote:
Originally Posted by |KungFuPenguin| View Post
Cool menu. Just a tip: instead of using an array of items (where you have to keep in track with a total items define) you could use a vector to store all your items. Its much more easy to manage cause it basically dynamically resizable, and overall just better.
yep.. let vector handle all the bs for you.

Quote:
Originally Posted by SEGnosis View Post
Nice, but absolutely no features I haven't seen before D:
He didn't release some of the harder gui objects... leaving an open window for creativity.
__________________
[22:22] monster64: yo dawg i heard u like chams so i put chams in your chams so you can see through shit while you see through shit

[09:07] Tally: grab your ak47 and put on your bomb jacket.... its gonna be a long morning

09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Last edited by raiders; 07-26-2010 at 09:19 PM.
raiders is offline

Reply With Quote

Old 07-26-2010, 09:19 PM   #10
Senior Member

SgtDrew's Avatar

Join Date: Sep 2008
Posts: 85
Reputation: 311
Rep Power: 46
SgtDrew has dreams of becoming a modSgtDrew has dreams of becoming a modSgtDrew has dreams of becoming a modSgtDrew has dreams of becoming a mod
Points: 2,777, Level: 4
Points: 2,777, Level: 4 Points: 2,777, Level: 4 Points: 2,777, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Very nice I like it.
SgtDrew is offline

Reply With Quote

Old 07-26-2010, 09:38 PM   #11
Donator

Blubsi's Avatar

Join Date: May 2009
Posts: 535
Reputation: 10144
Rep Power: 144
Blubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server spaceBlubsi 's rep takes up 1 gig of server space
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (1)
Points: 9,067, Level: 11
Points: 9,067, Level: 11 Points: 9,067, Level: 11 Points: 9,067, Level: 11
Activity: 4.7%
Activity: 4.7% Activity: 4.7% Activity: 4.7%
Last Achievements
Nice release
Blubsi is online now

Reply With Quote

Old 07-26-2010, 09:40 PM   #12
Broken Moderator

kolbybrooks's Avatar

Join Date: Aug 2006
Location: United States
Posts: 760
Reputation: 33567
Rep Power: 418
kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!
Points: 23,105, Level: 21
Points: 23,105, Level: 21 Points: 23,105, Level: 21 Points: 23,105, Level: 21
Activity: 20.0%
Activity: 20.0% Activity: 20.0% Activity: 20.0%
Last Achievements
Quote:
Originally Posted by raiders View Post
A linked list has more overhead when you iterate through it. Since you don't modify the list very much, it would be a better idea to use an array implementation.
Not if you code and implement it correctly; and I wasn't swinging a dick saying it was better than anything else, I was simply suggesting more options.
kolbybrooks is online now

Reply With Quote

Old 07-26-2010, 09:46 PM   #13
Retired Admin

learn_more's Avatar

Join Date: Sep 2006
Posts: 5,249
Reputation: 93628
Rep Power: 1106
learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (2)
sieg heil Nazi
Points: 70,490, Level: 39
Points: 70,490, Level: 39 Points: 70,490, Level: 39 Points: 70,490, Level: 39
Activity: 24.7%
Activity: 24.7% Activity: 24.7% Activity: 24.7%
Last Achievements
Award-Showcase
Quote:
Originally Posted by kolbybrooks View Post
Not if you code and implement it correctly; and I wasn't swinging a dick saying it was better than anything else, I was simply suggesting more options.
for iterating the overhead is minimal, if any (if implemented correctly)

for getting the nth item, there is overhead in linked list.
__________________
learn_more is offline

Reply With Quote

Old 07-26-2010, 10:11 PM   #14
Broken Moderator

kolbybrooks's Avatar

Join Date: Aug 2006
Location: United States
Posts: 760
Reputation: 33567
Rep Power: 418
kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!
Points: 23,105, Level: 21
Points: 23,105, Level: 21 Points: 23,105, Level: 21 Points: 23,105, Level: 21
Activity: 20.0%
Activity: 20.0% Activity: 20.0% Activity: 20.0%
Last Achievements
Quote:
Originally Posted by learn_more View Post
for getting the nth item, there is overhead in linked list.
That's very very true, but you shouldn't be getting a specific item from the linked list when dealing with a GUI (Ideally). If you are, I wouldn't deal with a linked list either.
kolbybrooks is online now

Reply With Quote

Old 08-03-2010, 07:00 PM   #15

CallMeEclipse's Avatar

Join Date: Jul 2009
Location: California
Posts: 2,330
Reputation: 33489
Rep Power: 412
CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!CallMeEclipse has a huge epeen!
Delta Fighter Champion Jumpin Joe Champion
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (1)
Points: 26,395, Level: 23
Points: 26,395, Level: 23 Points: 26,395, Level: 23 Points: 26,395, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Neat Menu

Quote:
Originally Posted by SEGnosis View Post
Nice, but absolutely no features I haven't seen before D:
Yes, but now-a-days when do you see new features? Unless you code them yourself.
__________________


(1217 AM) uNrEaL: One man's slap in the face is another man's slit throat
CallMeEclipse is offline

Reply With Quote

Old 08-03-2010, 09:14 PM   #16
SEGnosis
Guest

Posts: n/a
Quote:
Originally Posted by CallMeEclipse View Post
Unless you code them yourself.
Exactly o:
No new pub shit, just same ol D:

Reply With Quote
Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
complete, menu, mouse
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 07:51 AM.