Results 1 to 11 of 11
  1. #1
    _Fk127_'s Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    724
    Reputation
    16
    Thanks
    208
    My Mood
    Bitchy

    Draw CheckBox Function

    Heres a function i made for drawing checkboxes. i know its messy, and some of it is probably not needed, but it works, and i did my best! Thanks nubzgetkillz for the help!

    Code:
    struct {	 
      char *txt;	   
      bool  *var;	  
    } check[100];
    void Drawcheckbox(char *txt,int x, int y, int w, int h,bool *var,D3DCOLOR text, D3DCOLOR border, D3DCOLOR oncolor, D3DCOLOR offcolor,IDirect3DDevice9* pDevice )
    {
    	 check[0].var=var;
    	 check[0].txt=txt;
    	DrawBox(x,y,w,h,offcolor,border,pDevice);
    	DrawText(x + w + 5,y + 5,text, txt, pDevice);
    	if(isMouseinRegion(x,y,x+w,y+h))
    	{
    		if(GetAsyncKeyState(VK_LBUTTON)&1)
    		{
    			*var =! *var;
    		}
    	}
    	if(*var)
    	{
    		DrawBox(x,y,w,h,oncolor,border,pDevice);
    	}
    }
    how to use:
    in globals, add a boolean for your hack you want to toggle with the checkbox
    Code:
    bool t1;
    then to draw it
    Code:
    /*Drawcheckbox(text, x, y, w, h, &+boolean for your hack, textcolor,bordercolor, oncolor, offcolor, pDevice); */
    Drawcheckbox("test",60,80,76,56,&t1,Red, Blue,Green, Red, pDevice);
    for your hack
    Code:
    if(t1)
    {
    //do hack for checkbox 1 here
    }


    In case u dont have them:
    Code:
    bool isMouseinRegion(int x1, int y1, int x2, int y2)
    {
        POINT cPos;
        GetCursorPos(&cPos);
        if(cPos.x > x1 && cPos.x < x2 && cPos.y > y1 && cPos.y < y2){
            return true;
        } else {
            return false;
        }
    }
    Code:
    void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
    {
    	D3DRECT rec = { x, y, x + w, y + h };
    	pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
    }
    Code:
    void DrawBorder( int x, int y, int w, int h, int px, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
    {
    	FillRGB( x, (y + h - px), w, px,	BorderColor, pDevice );
    	FillRGB( x, y, px, h,				BorderColor, pDevice );
    	FillRGB( x, y, w, px,				BorderColor, pDevice );
    	FillRGB( (x + w - px), y, px, h,	BorderColor, pDevice );
    }
    Code:
    void DrawBox( int x, int y, int w, int h, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
    {
    	FillRGB( x, y, w, h,		BoxColor, pDevice );
    	DrawBorder( x, y, w, h, 1,	BorderColor, pDevice );
    }
    Code:
    void DrawText(int x,int y,DWORD color,char *text, LPDIRECT3DDEVICE9 pDevice){
    RECT rect;
    SetRect( &rect, x, y, x, y );
    Directx_Font->DrawTextA(NULL,text,-1,&rect, DT_LEFT|DT_NOCLIP, color);
    }
    Last edited by _Fk127_; 11-30-2010 at 04:39 PM.

  2. #2
    whatup777's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    CA Source Code Section
    Posts
    4,030
    Reputation
    147
    Thanks
    351
    My Mood
    Dead
    Really not that complicated.

    Now make it OOP.
    Quotes I live by.


    A foolish person learns from his mistakes, I wise person learns from others.
    Quote Originally Posted by AVGN View Post



    mhm

    i live in texas

    i was at the grocery store with my son. He saw a mexican guy, and he said "Look daddy! a mower man!"

    he's 4 yrs old

  3. #3
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,406
    Reputation
    157
    Thanks
    3,991
    My Mood
    Flirty
    looks good

  4. The Following User Says Thank You to ac1d_buRn For This Useful Post:

    _Fk127_ (11-30-2010)

  5. #4
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,863
    Reputation
    425
    Thanks
    8,598
    What's with everyone and their checkboxes lately?

  6. #5
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    Quote Originally Posted by ᴺᴼᴼᴮ View Post
    What's with everyone and their checkboxes lately?
    @ fk127 good job
    @noob.. Lol it is because I released it jk.. SOLIFY STARTED UP Checkboxes AGAIN WITH HIS BASE I GUESS... hehe u doing checkboxes too and acid and everyone

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  7. The Following User Says Thank You to Nubzgetkillz For This Useful Post:

    _Fk127_ (11-30-2010)

  8. #6
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,863
    Reputation
    425
    Thanks
    8,598
    Quote Originally Posted by Nubzgetkillz View Post
    @ fk127 good job
    @noob.. Lol it is because I released it jk.. SOLIFY STARTED UP Checkboxes AGAIN WITH HIS BASE I GUESS... hehe u doing checkboxes too and acid and everyone
    I prefer hotkeys.

  9. #7
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,406
    Reputation
    157
    Thanks
    3,991
    My Mood
    Flirty
    Quote Originally Posted by ᴺᴼᴼᴮ View Post
    What's with everyone and their checkboxes lately?
    one person does it, and then the rest of the monkeys follow.

  10. #8
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    Quote Originally Posted by ac1d_buRn View Post


    one person does it, and then the rest of the monkeys follow.
    who started? probably Solify? and his base?

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  11. #9
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,863
    Reputation
    425
    Thanks
    8,598
    Quote Originally Posted by Nubzgetkillz View Post
    who started? probably Solify? and his base?
    Probably some caveman a long time ago made it first. It's a shame we don't credit him/her.

  12. #10
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    Quote Originally Posted by ᴺᴼᴼᴮ View Post


    Probably some caveman a long time ago made it first. It's a shame we don't credit him/her.
    u are right

    credits:
    [IMG]http://1.bp.********.com/_bY-Gu4Mr7eU/RznVjwxKEwI/AAAAAAAAAyw/Rz5pjNX1LEQ/s400/GeicoCaveman.jpg[/IMG]

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  13. #11
    UGodly's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    http://www.mpgh.net/forum/members/645501-ugodly.html
    Posts
    1,234
    Reputation
    18
    Thanks
    160
    My Mood
    Yeehaw
    Quote Originally Posted by Nubzgetkillz View Post
    who started? probably Solify? and his base?
    but he is good