unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > Direct3D

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


Reply
 
Thread Tools Display Modes
  #1  
Old 02-09-2009, 04:31 AM
Alkatraz Alkatraz is offline
Administrator
 
Join Date: Jan 2007
Posts: 72
Default [Source] Easy CheckBox source

Credits to Stevepwns and wieter20

Globals:
Code:
LPD3DXFONT ButtonFont;
POINT (cPos);
struct Checks
{
     int      num;
     bool     clicked;

}; Checks Check[20];

void Initializaparts(int bnum)
{
     Check[bnum].num       = bnum;
     Check[bnum].clicked   = false;

}
bool DrawCheck;
Initialize:
Code:
 D3DXCreateFont( m_pD3Ddev, 16, 0, FW_BOLD, 1, FALSE,DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Black",&ButtonFont);
Function:
Code:
void DrawCheckBox(float x, float y, float w, float h, float t, int a, int r, int g, int b, const char *text,int checknum )
{
    //yup
    if(!IsBadReadPtr(pLine, sizeof(ID3DXLine)))
    {
        D3DXVECTOR2 vLine1[2];
        D3DXVECTOR2 vLine2[2];
        D3DXVECTOR2 vLine3[2];
        D3DXVECTOR2 vLine4[2];
        
        pLine->SetWidth( t );
        pLine->SetAntialias( false );  
        pLine->SetGLLines( false );

        vLine1[0].x = x;
        vLine1[0].y = y;
        vLine1[1].x = x;
        vLine1[1].y = y+h;

        vLine2[0].x = x+w;
        vLine2[0].y = y;
        vLine2[1].x = x+w;
        vLine2[1].y = y+h;

        vLine3[0].x = x;
        vLine3[0].y = y;
        vLine3[1].x = x+w;
        vLine3[1].y = y;

        vLine4[0].x = x;
        vLine4[0].y = y+h;
        vLine4[1].x = x+w;
        vLine4[1].y = y+h;

        pLine->Begin( );
        pLine->Draw( vLine1, 2, D3DCOLOR_ARGB(a, r, g, b ) );
        pLine->Draw( vLine2, 2, D3DCOLOR_ARGB(a, r, g, b ) );
        pLine->Draw( vLine3, 2, D3DCOLOR_ARGB(a, r, g, b ) );
        pLine->Draw( vLine4, 2, D3DCOLOR_ARGB(a, r, g, b ) );
        pLine->End( );
        PrintText(ButtonFont,x + 25,y,255,255,255,255,text);
        
        
        if(DrawCheck)
        {
            PrintText(ButtonFont,x+4,y,255,255,255,255,"X");
        }

        if(GetAsyncKeyState(VK_LBUTTON)&1)
        {
            GetCursorPos(&cPos);
            if(cPos.x > x-1 && cPos.y > y-1 && cPos.x < x+w && cPos.y < y+h)
            {
                DrawCheck = !DrawCheck;
                 Check[checknum].clicked = !Check[checknum].clicked;

            }
        }


    }
}
Usage:
Code:
DrawCheckBox(22,250,15,15,1,255,255,255,255,"Chams",1);
if(Check[1].clicked)
{
//hackstuffhere
}
edit:
another bug has been found
if you use multiple checks they all check if u hit the upper one:S
please post any solutions if u have one
Reply With Quote
  #2  
Old 02-09-2009, 04:31 AM
Alkatraz Alkatraz is offline
Administrator
 
Join Date: Jan 2007
Posts: 72
Default

Code:
/-/---------------------------------
            
            checkbox.h
            ----------

      Author: SRV aka StevePwns
      C++ VS 2005
      D3D Universal Check Box

---------------------------------/-/

#ifndef _CHECK_H
#define _CHECK_H

#include "headers.h"
#include "render.h"

#define CHECK_BOX_SIZE      15
#define SPACE_TO_NEXT       25
#define BOX_GROUPS          10
#define MAX_CHECK_BOXES        15

int Box_Groups      = 0;
int Number_Of_Boxes = 0;
bool binitboxes     = false;

struct CheckBox
{
        int   ix, iy, iw, ih;
        char* szCaption;
        bool  bOver, bchecked;

};CheckBox chk[BOX_GROUPS][MAX_CHECK_BOXES];

bool MouseIsOver(int x, int y, int w, int h)
{
    POINT cur;
    GetCursorPos(&cur);
    bool bover;

    if (cur.x >= x && cur.x <= x + w && cur.y >= y && cur.y <= y + h){
        bover = true;
    }else{
        bover = false;
    }
    return bover;
}

void AddCheckBox( int igroup, int ibox, int ix, int iy, char* szCaption )
{
        chk[igroup][ibox].ix        = ix;
        chk[igroup][ibox].iy        = iy;                        
        chk[igroup][ibox].szCaption = szCaption;
        chk[igroup][ibox].iw        = CHECK_BOX_SIZE;
        chk[igroup][ibox].ih        = CHECK_BOX_SIZE;
        chk[igroup][ibox].bOver     = false;
        chk[igroup][ibox].bchecked  = false;
}
void CheckBoxBool(int group)
{
}
void CallCheckBox( int group ,int b )
{
        chk[group][b].bOver = MouseIsOver( chk[group][b].ix, chk[group][b].iy , chk[group][b].iw , chk[group][b].ih );

        if ( chk[group][b].bOver && (GetAsyncKeyState(VK_LBUTTON)&1) )
        {
                chk[group][b].bchecked = !chk[group][b].bchecked;
                CheckBoxBool( group );
        }

        if ( chk[group][b].bchecked )
        {
                drawinbox( chk[group][b].ix,      chk[group][b].iy,     CHECK_BOX_SIZE, CHECK_BOX_SIZE, 255, 255, 255, 40 );
                GreenText( chk[group][b].ix + 30, chk[group][b].iy + 3, chk[group][b].szCaption );
                RedText  ( chk[group][b].ix + 3,  chk[group][b].iy + 1, "X" );
        }else{
                drawinbox( chk[group][b].ix,      chk[group][b].iy,     CHECK_BOX_SIZE, CHECK_BOX_SIZE, 255, 255, 255, 40 );
                GreenText( chk[group][b].ix + 30, chk[group][b].iy + 3, chk[group][b].szCaption );
        }
}


#endif
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
checkbox, easy, source

Thread Tools
Display Modes

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



All times are GMT. The time now is 09:28 AM.