Solved C++ Directx9 (7th june, 2010 release) | how to draw & erase shapes?

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Apr 29, 2018
2
4
0
I'm working with Visual studio 2017 & my OS is windows 10 if that information is needed.

I managed to draw a filled rectangle & text but I don't know how to erase it.
On top of that I don't know how to draw an unfilled rectangle with a specific line thickness, A circle if I will want to make a circular crosshair, or fov circle.

I would like to know how to draw: unfilled rectangle, circle, line, images (Optional) & how to erase everything.

If you need my source code or anything else to help, I will provide that, I really need your help.

Code:
#define white D3DCOLOR_ARGB(200, 255, 255, 255)

struct Vertex {
    float x, y, z, ht;
    DWORD Color;
}
    
void  drawRectangle(int x, int y, int w, int h, D3DCOLOR Color, LPDIRECT3DDEVICE9 device) {
    Vertex V[4] = { { x, y + h, 0.0f, 0.0f, Color },{ x, y, 0.0f, 0.01, Color },
    { x + w, y + h, 0.0f, 0.0f, Color },{ x + w, y, 0.0f, 0.0f, Color } };
    device->SetTexture(0, NULL);
    device->SetPixelShader(0);
    device->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
    device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
    device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
    device->SetRenderState(D3DRS_ZENABLE, FALSE);
    device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, V, sizeof(Vertex));
    
}

LPD3DXFONT font;

void drawText(int x, int y, LPCSTR text, D3DCOLOR color) {
    RECT rect;
    SetRect(&rect, x, y, x, y);
    font->DrawTextA(NULL, text, -1, &rect, DT_LEFT | DT_NOCLIP, color);
}

//This block using some methods & variables to hook ignore them
HRESULT WINAPI  My_EndScene(LPDIRECT3DDEVICE9 device) {

   HRESULT res;

   D3DXCreateFont(device, 14, 0, FW_BOLD, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &font);


    drawRectangle(20, 20, 200, 400, white, device);

    drawText(20, 20, "Some menu", D3DCOLOR_ARGB(255, 200, 0, 0));
        

    Unhook((void*)Original_EndScene, EndScene_Bytes, 5);

    res = Original_EndScene(device);

    Hook((void*)Original_EndScene, (void*)My_EndScene, 5, EndScene_Bytes);


    return res;
}
This is the result of my code:
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,177
78,998
2,399
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods