Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Box(int x, int y, int w, int h, D3DCOLOR Color, LPDIRECT3DDEVICE9 pD3D9)
- {
- pD3D9->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
- struct vertex
- {
- FLOAT x, y, z, rhw;
- DWORD color;
- };
- vertex p[4];
- p[0].x = float(x);
- p[0].y = float(y);
- p[0].z = 0;
- p[0].rhw = 1;
- p[0].color = Color;
- p[1].x = float(x + w);
- p[1].y = float(y);
- p[1].z = 0;
- p[1].rhw = 1;
- p[1].color = Color;
- p[2].x = float(x + w);
- p[2].y = float(y + h);
- p[2].z = 0;
- p[2].rhw = 1;
- p[2].color = Color;
- p[3].x = float(x);
- p[3].y = float(y + h);
- p[3].z = 0;
- p[3].rhw = 1;
- p[3].color = Color;
- pD3D9->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
- pD3D9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- pD3D9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
- pD3D9->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
- pD3D9->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
- pD3D9->SetRenderState(D3DRS_FOGENABLE, FALSE);
- pD3D9->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- pD3D9->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- pD3D9->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
- pD3D9->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- pD3D9->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
- pD3D9->SetTexture(0, NULL);
- pD3D9->SetPixelShader(0);
- pD3D9->SetRenderState(D3DRS_ZENABLE, FALSE);
- pD3D9->SetRenderState(D3DRS_STENCILENABLE, FALSE);
- pD3D9->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, p, sizeof(vertex));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement