Click here to Skip to main content
15,887,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Whole Operating system is getting hanged. Pin
Rage29-Aug-06 1:30
professionalRage29-Aug-06 1:30 
GeneralRe: Whole Operating system is getting hanged. Pin
toxcct29-Aug-06 2:19
toxcct29-Aug-06 2:19 
GeneralRe: Whole Operating system is getting hanged. Pin
Rage29-Aug-06 2:23
professionalRage29-Aug-06 2:23 
AnswerRe: Whole Operating system is getting hanged. Pin
Hamid_RT30-Aug-06 7:54
Hamid_RT30-Aug-06 7:54 
QuestionNetValidateName() Issue?? Pin
Programm3r28-Aug-06 22:52
Programm3r28-Aug-06 22:52 
AnswerRe: NetValidateName() Issue?? Pin
Programm3r28-Aug-06 23:42
Programm3r28-Aug-06 23:42 
GeneralRe: NetValidateName() Issue?? Pin
David Crow29-Aug-06 3:21
David Crow29-Aug-06 3:21 
QuestionDirectx8 - drawing a square - messing up things [modified] Pin
seq-28-Aug-06 22:41
seq-28-Aug-06 22:41 
Hello,

I wrote a code on directx9 to draw and fill a square using ID3DXLine which looked like that:
(I should add that this code is inject/hooked into a game).

<br />
ID3DXLine *pLine;<br />
<br />
void fillrgba(int x, int y, int w, int h, int r, int g, int b, int a)<br />
{<br />
    D3DXVECTOR2 vLine[2];<br />
<br />
    pLine->SetWidth( w );<br />
    pLine->SetAntialias( false );<br />
    pLine->SetGLLines( true );<br />
    <br />
    vLine[0].x = x + w/2;<br />
    vLine[0].y = y;<br />
    vLine[1].x = x + w/2;<br />
    vLine[1].y = y + h;<br />
<br />
    pLine->Begin( );<br />
    pLine->Draw( vLine, 2, D3DCOLOR_RGBA( r, g, b, a ) );<br />
    pLine->End( );<br />
}<br />


But now I have to make it work under DirectX8! And there exist no ID3DXLine, so I tried something like this

<br />
float PanelWidth = 150.0f;<br />
float PanelHeight = 200.0f;<br />
<br />
pDevice->CreateVertexBuffer(4 * sizeof(PANELVERTEX), D3DUSAGE_WRITEONLY,<br />
                                 D3DFVF_PANELVERTEX, D3DPOOL_MANAGED, &g_pVertices);<br />
<br />
PANELVERTEX* pVertices = NULL;<br />
g_pVertices->Lock(0, 4 * sizeof(PANELVERTEX), (BYTE**)&pVertices, 0);<br />
<br />
//Set all the colors to white<br />
pVertices[0].color = pVertices[1].color = pVertices[2].color = pVertices[3].color = 0xffffffff;<br />
<br />
//Set positions and texture coordinates<br />
pVertices[0].x = pVertices[3].x = -PanelWidth / 2.0f;<br />
pVertices[1].x = pVertices[2].x = PanelWidth / 2.0f;<br />
<br />
pVertices[0].y = pVertices[1].y = PanelHeight / 2.0f;<br />
pVertices[2].y = pVertices[3].y = -PanelHeight / 2.0f;<br />
<br />
pVertices[0].z = pVertices[1].z = pVertices[2].z = pVertices[3].z = 1.0f;<br />
<br />
pVertices[1].u = pVertices[2].u = 1.0f;<br />
pVertices[0].u = pVertices[3].u = 0.0f;<br />
<br />
pVertices[0].v = pVertices[1].v = 0.0f;<br />
pVertices[2].v = pVertices[3].v = 1.0f;<br />
<br />
g_pVertices->Unlock();<br />
<br />
pDevice->SetVertexShader(D3DFVF_PANELVERTEX);<br />
pDevice->SetStreamSource(0, g_pVertices, sizeof(PANELVERTEX));<br />
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);<br />
<br />


When I use the above code it messess the game up, is there any similar thing like ID3DXLine in DX8 ? I would rather avoid using vertexes, just make it as easy as possible without the BeginScene()/Endscene() and so on, just like ID3DXLine did.

Regards,
Pawel


-- modified at 4:42 Tuesday 29th August, 2006
QuestionHow to implement "edit contour"? Pin
skycaption28-Aug-06 22:24
skycaption28-Aug-06 22:24 
AnswerRe: How to implement "edit contour"? Pin
benjymous29-Aug-06 2:38
benjymous29-Aug-06 2:38 
Questioncontrolling 2 apps Pin
jamni28-Aug-06 22:18
jamni28-Aug-06 22:18 
AnswerRe: controlling 2 apps Pin
Programm3r28-Aug-06 22:54
Programm3r28-Aug-06 22:54 
GeneralRe: controlling 2 apps Pin
toxcct28-Aug-06 23:04
toxcct28-Aug-06 23:04 
GeneralRe: controlling 2 apps Pin
Programm3r28-Aug-06 23:14
Programm3r28-Aug-06 23:14 
AnswerRe: controlling 2 apps Pin
khan++29-Aug-06 0:24
khan++29-Aug-06 0:24 
GeneralRe: controlling 2 apps Pin
Rage29-Aug-06 1:32
professionalRage29-Aug-06 1:32 
GeneralRe: controlling 2 apps Pin
John M. Drescher29-Aug-06 1:40
John M. Drescher29-Aug-06 1:40 
GeneralRe: controlling 2 apps Pin
khan++29-Aug-06 1:50
khan++29-Aug-06 1:50 
GeneralRe: controlling 2 apps [modified] Pin
jamni29-Aug-06 16:03
jamni29-Aug-06 16:03 
GeneralRe: controlling 2 apps Pin
khan++29-Aug-06 21:10
khan++29-Aug-06 21:10 
GeneralRe: controlling 2 apps Pin
jamni30-Aug-06 15:50
jamni30-Aug-06 15:50 
AnswerRe: controlling 2 apps Pin
Stephen Hewitt29-Aug-06 13:52
Stephen Hewitt29-Aug-06 13:52 
Questionhow to know [modified] Pin
RockyJames28-Aug-06 22:09
RockyJames28-Aug-06 22:09 
AnswerRe: how to know Pin
velayudhan_raj28-Aug-06 22:20
velayudhan_raj28-Aug-06 22:20 
GeneralRe: how to know Pin
RockyJames28-Aug-06 22:27
RockyJames28-Aug-06 22:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.