Results 1 to 1 of 1
  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,221
    Thanks
    211
    Thanked 2,224 Times in 289 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

Visitors found this page by searching for:

d3d draw line

d3d drawrect

drawbox D3D

c d3d text

D3D Text

d3d draw rect

D3D Line

D3D Draw Box

c d3d draw line

C d3d lined3d draw Rectangled3d10 draw lined3dx draw lined3dx draw rectangledirect3d line drawdrawline d3dd3d10 draw linesd3d drawboxLPDIRECT3DDEVICE9 draw textdraw box in d3dDrawlineorrectc d3d boxc draw d3d linedrawbox c d3ddrawrect d3d

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
  •