Results 1 to 1 of 1
  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,222
    Thanks Thanks Given 
    211
    Thanks Thanks Received 
    2,230
    Thanked in
    292 Posts
    Rep Power
    10

    Drawing Rects/Lines/Text

    First Add the Skeleton of the function like so, void drawlineorrect
    (LPDIRECT3DDEVICE9 pDevice,int tx,int ty,int tw,int th,D3DCOLOR COLORZ)

    now add the base rect
    RECT.x1 = tx-tw;//width one way
    RECT.y1 = ty-th;//high one way
    RECT.x2 = tx+tw;//width the other way
    RECT.y2 = tx+th;//high the other way

    now clear it
    pDevice->Clear(1,&RECT,D3DCLEAR_TARGET,COLORZ,0,0);

    Result :
    void drawlineorrect(LPDIRECT3DDEVICE9 pDevice,int tx,int ty,int tw,int th,D3DCOLOR COLORZ)
    {
    D3DRECT RECTONE;
    RECTONE.x1 = tx-tw;
    RECTONE.y1 = ty-th;
    RECTONE.x2 = tx+tw;
    RECTONE.y2 = ty+th;
    pDevice->Clear(1,&RECTONE,D3DCLEAR_TARGET,COLORZ,0,0);
    }

    line would be the same except the width = 1 (if you want it to be vertical line)
    or the height = 1 if you want it horizontal
    void drawtext(LPDIRECT3DDEVICE9 pDevice,int tx,int ty,D3DCOLOR COLORZ,font,char textstring[])
    {
    D3DRECT TEXTREC;
    TEXTREC.x1 = x;
    TEXTREC.y1 = y;
    TEXTREC.x2 = x+999;
    TEXTREC.y2 = y+400;
    font->DrawText(NULL,textstring,-1,&TEXTREC,DT_LEFT | DT_WORDBREAK,COLORZ)

    }


    by pyroctain666
    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •