Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  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

    Jetamay's D3D Form Class

    A class programmed by me(Jetamay) to render and manage forms in a D3D environment. When you make use of this class, please credit me.

    Download + Project information & license :
    https://code.google.com/p/jetatect-d3d-gui-creator/

    Library can be downloaded in attachments. The header is here :
    [php]#pragma once
    #include "d3d9.h"
    #include "d3dx9.h"


    #define CONTROL_APPEND_TEXT 0x00000001
    #define CONTROL_SET_TEXT 0x00000002
    #define CONTROL_GET_TEXT 0x00000003
    #define CONTROL_BUTTON_PRESS 0x00000004
    #define GAME_ROOTDIR(pCharBuffer, len) GetCurrentDirectoryA(len, pCharBuffer)

    typedef void (*FORMCALLBACK)(DWORD command, DWORD param1, DWORD param2); //P1 form name, p2 command
    enum ControlType{Textbox = 1, Button = 2, Caption = 3, Password = 4};

    struct Control {
    RECT bounds; //LEAVE NULL ON INIT, SET WHEN RENDERED;
    DWORD Command;

    char name[300];
    char text[300];
    bool enabled;
    int x, y;
    int type;
    };
    class CForm {
    private:
    int hoverControlIndex, activeControlIndex;
    int x, y, mouseX, mouseY;
    int numControls;

    Control controls[100];
    LPDIRECT3DTEXTURE9 formTexture;
    LPD3DXFONT d3dFont;

    void SetText(int index, char* source);
    void AppendText(int index, char* text);

    bool NameInUse(char* name);
    char* GetText(int index);
    int GetControlIndex(char* name);
    FORMCALLBACK formCallback;
    public:
    char name[300];
    CForm(FORMCALLBACK callback, char* objName, int formX, int formY, char* bgrLocalDir, LPDIRECT3DDEVICE9 d3ddev, LPD3DXFONT font);
    int CreateControl(char* name, char* text, int type, float x, float y, DWORD Command = 0, bool enabled = true);
    void ProcessMouse(POINT* mousePos, bool leftDown);
    void ProcessKey(char key);
    void Callback(DWORD Command, DWORD param1, DWORD param2);
    void MoveBy(int x, int y);
    void MoveTo(int posX, int posY);
    void Render(LPD3DXSPRITE d3dSprite);
    void Update();
    ~CForm();
    };[/php]Class Information :

    CForm(Constructor)
    Parameters
    callback :
    Pointer to callback method, read more in callback methods section
    objName :
    Parameter is useless without the CFormManager class, which will be posted in a couple hours. Use to name the form object, set to NULL if you're not using a method to manage numerous forms, or plan to use a different system to identify them.
    formX :
    Form's default X position to render all controls and the form itself. Control structure contains offset X cords to this number. Thus the X cords in the Control structure are relative to the form's X position.
    formY :
    Form's default Y position to render all controls and the form itself. Control structure contains offset Y cords to this number. Thus the Y cords in the Control structure are relative to the form's Y position.
    bgrLocalDir :
    Pointer to a string which is null terminated. This string is used to load the background of the form. This only works locally. E.X, if the executable is placed in C:\program\program.exe and you pass "\\background.png" the class will load the image at C:\Program\Background.png. Be sure to include the \ character.
    d3ddev :
    A pointer to an initialized D3D Device.
    font :
    A pointer to a d3d font interface.
    Description :
    This is the constructor for the CForm class. It will initialize the private members needed to create controls and render the form. This must be called.
    CreateControl
    Parameters
    name :
    Controls name. You use this to modify it's properties using the built in callback. Refer to Callback information section.
    text :
    Text of Control. This can be the caption of a button, label, or default text in a textbox & password textbox.
    type :
    Refer to the ControlType enumerator defined in the CForm header. Specifies which kind of control you wish to create it as.
    x :
    Controls x position which is relative to the forms X position.
    y :
    Controls y position which is relative to the forms y position.
    Command :
    DWORD that specified the controls command code, read callback section for more information on this parameter.
    Enabled :
    Useless without CGUIManager class. More description on this paremeter will be posted at later time. For now ignore, and allow the compile set it to true, or set it to true yourself.
    Description :
    Creates a desired control for the form. This form will then be rendered when the render method within the class is called.

    ProcessKey
    Parameters
    key :
    Key which was pressed to be processed. '%' character will cause a deletion of the last character.
    Description :
    Processes a given key. This can cause several actions to occur depending on the active control. It may sometimes be ignored.
    Callback
    Parameters
    Read callback section of this post for information on these parameters.
    Description :
    Read callback section of this post for information on these parameters.
    MoveBy
    Parameters
    x :
    Amount to change X coordination by.
    y :
    Amount to change Y coordination by.
    Description :
    Moves forms XY coordinations by a desired amount.
    MoveTo
    Parameters
    x :
    Set X coordination.
    y :
    Set Y coordination.
    Description :
    Moves forms XY coordinations to a desired position.
    Render
    Parameters
    d3dSprite :
    Pointer to initialized sprite interface.
    Description :
    Renders form.
    Update
    Ignore, useless without CGUIManager.

    Callback Methods
    A callback method has three parameters, the first is generally the command or the name of an object. Here's an example callback I write that should explain everything you need to know about them.
    Form Init :
    [php] mainForm = new CForm(FormCallback, "Form1",0,0, "FormDatatexturesdefaultForm.PNG", pd3ddev, d3dFont);
    mainForm->CreateControl("cap1", "Login Window", Caption, 5, 5, 0);
    mainForm->CreateControl("cap2", "Username:", Caption, 100, 80, 0);
    mainForm->CreateControl("cap3", "Password:", Caption, 100, 110, 0);
    mainForm->CreateControl("txtUsername", "Insert Username", Textbox, 170, 80, 0);
    mainForm->CreateControl("txtPassword", "Insert Password", Password, 170, 110, 0);
    mainForm->CreateControl("btnSubmit", "Submit", Button, 230, 130, BTN_SUBMIT);
    mainForm->CreateControl("btnTwo", "Quit", Button, 300, 130, BTN_QUIT);
    [/php]Callback :
    [php]
    void FormCallback(DWORD command, DWORD p1, DWORD p2) {
    if(command == CONTROL_BUTTON_PRESS) {
    if(!strcmp(mainForm->name, (char*)p1)) {
    switch(p2) {
    case BTN_QUIT:
    tinit();
    break;
    case BTN_SUBMIT:
    break;
    }
    }

    }
    }[/php]

    Built-in callback :
    [php]
    Callback(DWORD Command, DWORD param1, DWORD param2) {
    switch(Command) {
    case CONTROL_APPEND_TEXT:
    AppendText(GetControlIndex((char*)param1), (char*) param2);
    break;
    case CONTROL_GET_TEXT:
    memcpy((void*)param2,
    (void*)GetText(GetControlIndex((char*)param1)),
    4);
    break;
    case CONTROL_SET_TEXT:
    SetText(GetControlIndex((char*)param1), (char*) param2);
    break;
    case CONTROL_BUTTON_PRESS:
    formCallback(CONTROL_BUTTON_PRESS, (DWORD)this->name, (DWORD)param1);
    break;
    }
    }

    [/php]
    Last edited by radnomguywfq3; 05-08-2009 at 07:05 PM.

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

    -=ProUser=- (12-17-2009),[MPGH]Disturbed (07-02-2009),erasemyhead (07-17-2009),I-JlStepper-I (07-09-2010),jefe (07-18-2009),Jerry12358 (09-08-2009),Joshcarr2006 (07-22-2009),Legify (06-14-2009),Marsicano (10-17-2009),Matrix_NEO006 (11-23-2009),Nitrous (07-27-2009),sh00ter (05-22-2009),yak444 (01-08-2010)

  3. #2
    arunforce's Avatar
    Join Date
    Dec 2005
    Location
    A place for amigos
    Posts
    25,072
    Reputation
    4747
    Thanks
    12,626
    My Mood
    Yeehaw
    :O

    What kinda licensing does it have?



    BRING BACK BT, BRING BACK SAGA, BRING BACK VF, BRING BACK MPGHCRAFT, BRING BACK HABAMON


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

    Jerry12358 (09-08-2009)

  5. #3
    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
    Download + Project information & license : jetatect-d3d-gui-creator - Google Code

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

    Jerry12358 (09-08-2009),maon (09-15-2009)

  7. #4
    mastergeorge's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    423
    Reputation
    10
    Thanks
    24
    My Mood
    Twisted
    If only I got this..

  8. The Following User Says Thank You to mastergeorge For This Useful Post:

    Jerry12358 (09-08-2009)

  9. #5
    DjFunky's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    BehindYou!
    Posts
    824
    Reputation
    10
    Thanks
    70
    My Mood
    Brooding
    It is scripted wrongly. It takes to long... :s
    ~Back~

  10. The Following User Says Thank You to DjFunky For This Useful Post:

    Jerry12358 (09-08-2009)

  11. #6
    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
    Scripted wrongly? Wtf you talkin about boi? There is no scripting in this.

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

    Jerry12358 (09-08-2009)

  13. #7
    supernova2131's Avatar
    Join Date
    May 2009
    Gender
    male
    Location
    Under Your Bed
    Posts
    1,811
    Reputation
    7
    Thanks
    99
    My Mood
    Amazed
    Quote Originally Posted by DjFunky View Post
    It is scripted wrongly. It takes to long... :s
    Dude you need patience to code =@

  14. #8
    bobyjoeson's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    If i told you. i would have to kill you. *cough*im under your bed*cough*
    Posts
    9
    Reputation
    10
    Thanks
    1
    My Mood
    Hot
    Quote Originally Posted by supernova2131 View Post
    Dude you need patience to code =@
    PATIENCE!
    well this is off my to do list

  15. #9
    Thats the way it is's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    95
    Reputation
    9
    Thanks
    11
    My Mood
    Tired
    Link not working anymore + It says download is in attachment but there are no attachments ?
    Cause There ain't no rest for the wicked

  16. #10
    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
    Sorry guys, I deleted that project from my computer a looooong time ago. It didn't take long to write though. I'll look at it a little later.



    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?


  17. #11
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,204
    My Mood
    Flirty
    Weird I could have swore it was included one sec... Nope I didn't save it anywhere I can find... oh well. =/

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  18. #12
    HazXoD3D's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    46
    Reputation
    10
    Thanks
    6
    My Mood
    Psychedelic
    i have heard that people have done D3D menus in C++ with GUI o.O
    its looks like you base is GUI but still not ?!

    I have search google but i htink i have found it but im to newbie

    Is there any SIMPLE base?, that is just a nav funchion, and the draw funchion just that just its a box and 3,4 rows of items.







  19. #13
    crushed's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    My name is Jay. k?
    Posts
    415
    Reputation
    10
    Thanks
    113
    My Mood
    Sneaky
    Didn't this used to be stickied? O_o

  20. #14
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by crushed View Post
    Didn't this used to be stickied? O_o
    "Used to be"

  21. #15
    crushed's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    My name is Jay. k?
    Posts
    415
    Reputation
    10
    Thanks
    113
    My Mood
    Sneaky
    Quote Originally Posted by Davidm44 View Post
    "Used to be"
    Then...why is unstickied now? ._.;;
    I don't know, but I feel this is important?!

Page 1 of 2 12 LastLast

Similar Threads

  1. D3D Sprite Class
    By radnomguywfq3 in forum C++/C Programming
    Replies: 0
    Last Post: 03-01-2009, 12:37 PM
  2. Guild Wars New Classes
    By Chronologix in forum General Gaming
    Replies: 24
    Last Post: 07-23-2006, 08:46 AM
  3. Heavy Weapons Class mine bug. I had no idea.
    By NukeAssault in forum General Gaming
    Replies: 2
    Last Post: 07-20-2006, 06:54 AM
  4. [Help] D3D
    By SpiderByte in forum WarRock - International Hacks
    Replies: 7
    Last Post: 01-18-2006, 09:13 PM
  5. [Tutorial]Change class without respawn
    By vir2000 in forum Game Hacking Tutorials
    Replies: 0
    Last Post: 01-04-2006, 01:47 PM

Tags for this Thread