Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad

    D3D GUI Interface

    Currently, I'm developing a GUI editor in C++ using DirectX, and I've created a couple of classes some people may find useful. Soon, I will be releasing the whole project, but at the moment, you may find these objects I've created useful. I'm not going to bother explaining it until I've completed the GUI editor, when I do finish it though, there will be an indepth description of all the methods and how to use the GUIEditer to compile GUIs and how to use the GUIReader library(which I will be creating) that you can use to read and display the GUIs created with the GUIEditor. Please note the below code isn't finished nor cleaned up. There are some parts were I was really lazzy and defined variabled that are constant over and over in the Render methods.

    Form.h
    [highlight=cpp]#pragma once

    #include "stdafx.h"
    #include <windows.h>
    #include "d3d9.h"
    #include "d3dx9.h"
    #include "Button.h"
    class Form {
    private:
    LPDIRECT3DSURFACE9 surface;
    LPD3DXFONT d3dFont;
    char caption[100];
    int buttonCount;
    bool visible;
    D3DCOLOR bgrColor;
    D3DCOLOR capColor;
    RECT destRect;
    RECT capBounds;

    public:
    Button* childButtons[100]; //You sure as hell shouldn't ever need more then 100 buttons..
    Form(LPDIRECT3DDEVICE9 d3dDev, D3DCOLOR srcBgrColor, D3DCOLOR srcCapColor, RECT srcDestRect, char *srcCaption, bool vis);
    void AddButton(Button *btn);
    bool isVisible();
    int Save(char* path);
    void Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 destSurface);
    void SetVisible(bool vis);

    };[/highlight]Form.cpp
    [highlight=cpp]
    #include "stdafx.h"
    #include "Form.h"
    Form::Form(LPDIRECT3DDEVICE9 d3dDev, D3DCOLOR srcBgrColor, D3DCOLOR srcCapColor, RECT srcDestRect, char* srcCaption, bool vis)
    {
    strcpy(caption, srcCaption);
    visible = vis;
    buttonCount = 0;

    destRect = RECT(srcDestRect);
    capBounds = RECT(destRect);
    capBounds.left = 0;
    capBounds.top = 0;
    capBounds.bottom = 20;

    //REWRITE BELOW METHOD


    D3DXCreateFont( d3dDev, 12, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
    DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &d3dFont );

    d3dDev->CreateOffscreenPlainSurface(srcDestRect.right - srcDestRect.left, srcDestRect.bottom - srcDestRect.top,
    D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &surface, NULL);

    bgrColor = srcBgrColor;
    capColor = srcCapColor;
    }
    void Form::AddButton(Button *btn) {
    childButtons[buttonCount] = btn;
    buttonCount++;
    }
    bool Form::isVisible()
    {
    return visible;
    }
    int Form::Save(char* path) {
    //This is gunna be a hell of a method :X
    return 1;
    }

    void Form::Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 d3dSurface) {
    if(!visible)
    return;

    RECT capRendLoc = RECT(capBounds);
    capRendLoc.left += destRect.left + 20;
    capRendLoc.top += destRect.top + 3;
    capRendLoc.right = capRendLoc.left + (10 * strlen(caption));
    capRendLoc.bottom = capRendLoc.top + 10;

    d3dDev->ColorFill(surface, NULL, bgrColor);
    d3dDev->ColorFill(surface, &capBounds, capColor);

    for(int i = 0; i < buttonCount; i++)
    childButtons[i]->Render(d3dDev, surface, destRect);

    d3dDev->StretchRect(surface, NULL, d3dSurface, &destRect, D3DTEXF_NONE);
    d3dFont->DrawTextA(NULL, caption, -1, &capRendLoc, 0, D3DCOLOR_XRGB(0,0,0));


    }

    void Form::SetVisible(bool vis) {
    visible = vis;
    }
    [/highlight]Button.h
    [highlight=cpp]
    #pragma once
    #include "stdafx.h"
    #include "d3d9.h"
    #include "d3dx9.h"
    #include "windows.h"


    class Button {
    private:
    void (*methodToExecute)();
    char caption[100]; //You shouldn't have a captions larger then 100 characters, but if you do Feel free to change this.
    bool visible;
    RECT destRect;
    LPD3DXFONT d3dFont;
    LPDIRECT3DSURFACE9 surface;
    public:
    Button(LPDIRECT3DDEVICE9 d3dDev, void *srcMethodToExecute, char* caption, int x, int y, bool vis);
    void Button::SetCaption(char* srcCaption);
    bool isVisible();
    void SetVisible(bool vis);
    void SetRect(RECT &newRect);
    void Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 d3dSurface, RECT frmRect);
    };
    [/highlight]
    button.cpp

    [highlight=cpp]
    #include "stdafx.h"
    #include "Button.h"
    #include "rectTools.h"
    #include <windows.h>
    #define _CRT_SECURE_NO_WARNINGS
    Button::Button(LPDIRECT3DDEVICE9 d3dDev, void *srcMethodToExecute, char* srcCaption, int x, int y, bool vis) {

    strncpy(caption, srcCaption, sizeof(caption));
    this->visible = vis;
    destRect.top = y;
    destRect.left = x;
    destRect.right = destRect.left + strlen(caption) * 10;
    destRect.bottom = destRect.top + 20;



    D3DXCreateFont( d3dDev, 12, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
    DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &d3dFont );

    HRESULT res = d3dDev->CreateOffscreenPlainSurface(destRect.right, destRect.bottom, D3DFMT_X8R8G8B8,
    D3DPOOL_DEFAULT, &surface, NULL);

    methodToExecute = (void (__cdecl *)())srcMethodToExecute;
    }

    void Button::SetRect(RECT &newRect) {
    destRect = RECT(newRect);
    }

    void Button::SetVisible(bool vis) {
    visible = vis;
    }

    void Button::Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 d3dSurface, RECT frmRect) {
    if(!isVisible())
    return;

    POINT mPos;
    D3DCOLOR btnColor = D3DCOLOR_XRGB(200,200,200);
    GetCursorPos(&mPos);

    RECT posTestRect(destRect);
    posTestRect.left += frmRect.left;
    posTestRect.top += frmRect.top;
    posTestRect.right += frmRect.left;
    posTestRect.bottom += frmRect.top;
    if(isInRect(mPos, posTestRect)) {
    btnColor = D3DCOLOR_XRGB(100,100,200);
    if(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
    methodToExecute();
    }


    RECT btnRect = RECT(destRect);
    btnRect.left += 2;
    btnRect.right -= 2;
    btnRect.top += 2;
    btnRect.bottom -= 2;
    d3dDev->ColorFill(d3dSurface, &destRect, D3DCOLOR_XRGB(0,0,0));
    d3dDev->ColorFill(d3dSurface, &btnRect, btnColor);
    }
    bool Button::isVisible(){
    return visible;
    }
    void Button::SetCaption(char* srcCaption) {
    strncpy(caption, srcCaption, sizeof(caption));
    }
    [/highlight]
    Last edited by NextGen1; 02-07-2011 at 06:09 PM.



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  2. The Following 4 Users Say Thank You to radnomguywfq3 For This Useful Post:

    apezwijn (03-24-2009),sph4ck (09-05-2010),topblast (06-19-2010),[D]evliin (03-24-2009)

  3. #2
    jeremy6996's Avatar
    Join Date
    Jul 2006
    Gender
    male
    Posts
    154
    Reputation
    10
    Thanks
    7
    Thanks jetamay, I hope other people actually read this fucking thread.

  4. #3
    Synns's Avatar
    Join Date
    May 2007
    Gender
    male
    Posts
    5,174
    Reputation
    170
    Thanks
    2,557
    My Mood
    Bitchy
    Quote Originally Posted by jeremy6996 View Post
    Thanks jetamay, I hope other people actually read this fucking thread.
    Posting in your own thread?

    Come on .

  5. #4
    Obama's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    The Black house
    Posts
    22,195
    Reputation
    870
    Thanks
    6,076
    My Mood
    Cool
    Quote Originally Posted by Longevity View Post
    Posting in your own thread?

    Come on .
    There the same people lol?

  6. The Following User Says Thank You to Obama For This Useful Post:

    jeremym2435 (04-16-2009)

  7. #5
    apezwijn's Avatar
    Join Date
    Feb 2007
    Gender
    male
    Location
    The Netherlands
    Posts
    1,525
    Reputation
    22
    Thanks
    682
    Is this like a menu?

  8. #6
    NatureSkillz's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    In This Thread
    Posts
    652
    Reputation
    17
    Thanks
    222
    My Mood
    Yeehaw
    u know, i always wanted to make a D3d GUI ^^
    Great Sig From TryMe, And Resized by bugmenot

    Click here to feed me a Nude Girl!!
    How To Create A MapleStory Private Server, Odin Based, And
    Fully Updated Aswel!:

    Click Here For A New MapleStory TUT V55

    Ever wanted to Spam/Troll/Flame without getting banned?<Free for Everyone!?!?>


    People I Respect;
    *- Natureskillz
    Contact me if you want to be on the Respect list, You must do something good against me, or have a good reason >.>

    +1 Post Count!

  9. #7
    [D]evliin's Avatar
    Join Date
    Apr 2008
    Gender
    male
    Location
    Meh.
    Posts
    1,388
    Reputation
    22
    Thanks
    73
    My Mood
    Happy
    cheers helped alot
    [IMG]https://i157.photobucke*****m/albums/t54/murckleman/nub1.jpg[/IMG]

  10. #8
    ultimate-tester's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    2
    My Mood
    Relaxed
    Can you tell me where I can find the rectTools.h file or class?

  11. #9
    NatureSkillz's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    In This Thread
    Posts
    652
    Reputation
    17
    Thanks
    222
    My Mood
    Yeehaw
    google, or use search at your pc
    Great Sig From TryMe, And Resized by bugmenot

    Click here to feed me a Nude Girl!!
    How To Create A MapleStory Private Server, Odin Based, And
    Fully Updated Aswel!:

    Click Here For A New MapleStory TUT V55

    Ever wanted to Spam/Troll/Flame without getting banned?<Free for Everyone!?!?>


    People I Respect;
    *- Natureskillz
    Contact me if you want to be on the Respect list, You must do something good against me, or have a good reason >.>

    +1 Post Count!

  12. #10
    Synns's Avatar
    Join Date
    May 2007
    Gender
    male
    Posts
    5,174
    Reputation
    170
    Thanks
    2,557
    My Mood
    Bitchy
    I need 101 buttons .

  13. #11
    ultimate-tester's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    2
    My Mood
    Relaxed
    Just gimme the recttools file! I used google, but my google seems to fail! The file is NOT included in the directX sdk as far as I know. And he uses " instead of < and > to include it, so it must be a custom file! Please post it here!! i really need this

  14. #12
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    Quote Originally Posted by ultimate-tester View Post
    Just gimme the recttools file! I used google, but my google seems to fail! The file is NOT included in the directX sdk as far as I know. And he uses " instead of < and > to include it, so it must be a custom file! Please post it here!! i really need this
    <> means it's from the compiler's directives, "" means it from the project directive. Anyway, I updated this for my game engine, so I'll be posting that instead sometime next week. The rectTools is a source file I programmed myself. To be honest, this class wasn't really 100% completed, it will be next week and I'll post the whole thing.
    Last edited by radnomguywfq3; 04-24-2009 at 08:30 PM.



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  15. The Following User Says Thank You to radnomguywfq3 For This Useful Post:

    ultimate-tester (05-06-2009)

  16. #13
    ultimate-tester's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    2
    My Mood
    Relaxed
    Well yes, I know c++ That's why I asked you the file! LOOK:

    #include "rectTools.h"

    (between " and not <>

  17. #14
    breeze's Avatar
    Join Date
    May 2009
    Gender
    male
    Posts
    96
    Reputation
    10
    Thanks
    9
    My Mood
    Breezy
    could of been written better, but this is a nice share xD

    going to work on a gui class with this one

  18. #15
    breeze's Avatar
    Join Date
    May 2009
    Gender
    male
    Posts
    96
    Reputation
    10
    Thanks
    9
    My Mood
    Breezy
    Quote Originally Posted by ultimate-tester View Post
    Just gimme the recttools file! I used google, but my google seems to fail! The file is NOT included in the directX sdk as far as I know. And he uses " instead of < and > to include it, so it must be a custom file! Please post it here!! i really need this
    Try this

    [php]

    #ifndef MYRECTTOOLS_H
    #define MYRECTTOOLS_H
    #ifndef MAC_PLATFORM
    #include "PIHeaders.h"
    #endif

    /**
    * Function for Activation of Sign Tool
    */
    extern ACCB1 void ACCB2 ActivateSignTool (void *clientData);

    /**
    * Function for Activation of SignExpert Tool
    */
    //extern ACCB1 void ACCB2 ActivateSignExpertTool (void *clientData);

    /**
    * Sets up the Tool for SignMode
    */
    extern void SetUpSignTool(void);


    #endif /* MYRECTTOOLS_H */[/php]

Page 1 of 2 12 LastLast

Similar Threads

  1. New D3D Hack has been released!
    By Dave84311 in forum Hack/Release News
    Replies: 23
    Last Post: 05-29-2009, 08:02 AM
  2. WR D3D Hook - =o - 03/22/07
    By Dave84311 in forum Hack/Release News
    Replies: 14
    Last Post: 10-06-2007, 09:59 AM
  3. D3D Hack (Old)
    By PBFUCKER in forum WarRock - International Hacks
    Replies: 10
    Last Post: 06-09-2007, 09:00 AM
  4. Loading Interface... Problems =(
    By doratehexploda in forum Gunz General
    Replies: 13
    Last Post: 06-03-2006, 05:29 AM
  5. [Help] D3D
    By SpiderByte in forum WarRock - International Hacks
    Replies: 7
    Last Post: 01-18-2006, 09:13 PM

Tags for this Thread