Saturday, August 13, 2022
HomeGame Developmentdirectx11 - RTS recreation object choice in DirectX 11 Traces

directx11 – RTS recreation object choice in DirectX 11 Traces


After choosing an object, how would I’m going about drawing the traces across the object in display screen house.

enter image description here

I do not know on what strategies to make use of. I have to be pointed in the correct path how you’d put these traces/bins across the object after choosing the item utilizing choosing.

I’m studying “Programming an RTS recreation with direct3d”
The guide makes use of Directx 9 and plenty of stuff has modified since then.

That is the code pulled from the guide, however it’s directx 9

D3DXVECTOR2 corner1[] = {D3DXVECTOR2(pmin.x, pmin.y + s), D3DXVECTOR2(pmin.x, pmin.y), D3DXVECTOR2(pmin.x + s, pmin.y)};
                    D3DXVECTOR2 corner2[] = {D3DXVECTOR2(pmax.x - s, pmin.y),
 D3DXVECTOR2(pmax.x, pmin.y), D3DXVECTOR2(pmax.x, pmin.y + s)};
                    D3DXVECTOR2 corner3[] = {D3DXVECTOR2(pmax.x, pmax.y - s), 
D3DXVECTOR2(pmax.x, pmax.y), D3DXVECTOR2(pmax.x - s, pmax.y)};
                    D3DXVECTOR2 corner4[] = {D3DXVECTOR2(pmin.x + s, pmax.y), 
D3DXVECTOR2(pmin.x, pmax.y), D3DXVECTOR2(pmin.x, pmax.y - s)};
            
    
                    ID3DXLine *line = NULL;
                    D3DXCreateLine(System, &line);
                    
            
                    //Draw the 4 corners
                    line->SetWidth(2.0f);
                    line->Start();
                    line->Draw(corner1, 3, 0xffffffff); 
                    line->Draw(corner2, 3, 0xffffffff); 
                    line->Draw(corner3, 3, 0xffffffff); 
                    line->Draw(corner4, 3, 0xffffffff); 
                    line->Finish();

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments