DrawSquare() Function [by Topblast]
Draw Square Function
I promise u a Function that will have a little more effect to it instead of just Old dead boxes of color. even MPGH's GUI uses something like it. DrawSquare() is simple.
CREDIT : TOPBLAST!


[php]
void DrawSquare(
__in LPDIRECT3DDEVICE9 pDevice,
__in int x,
__in int y,
__in int w,
__in int h,
__in DWORD color1);
Parameters
pDevice [in]
LPDIRECT3DDEVICE9
Pointer to an IDirect3DDevice9 interface, the device to be associated with the drawing of the object.
X [in]
INT
Specifies the x-coordinate of the rectangle''s upper-left corner.
Y [in]
INT
Specifies the y-coordinate of the rectangle''s upper-left corner.
W (Weight) [in]
INT
The width of the Square in logical units.
H (Height) [in]
INT
The height of the Square in logical units.
Color1 [in]
DWORD
The General color of the Square.
[/php]
[php]
//-----------------------------------------------------------------------------
// Name: sVertex
// Desc: This is a structure a Point/Vertex.
//-----------------------------------------------------------------------------
struct sVertex
{
float x, y, z, ht;
DWORD color;
enum FVF
{
FVF_Flags = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
};
};
//-----------------------------------------------------------------------------
// Name: DrawSquare()
// Desc: Draws a Square with an EFFECT.
//-----------------------------------------------------------------------------
void DrawSquare(LPDIRECT3DDEVICE9 pDevice,
int x,
int y,
int w,
int h,
DWORD color1)
{
sVertex Veri[6] =
{
{(float)x ,(float)y , 0.0f, 0.0f, (color1-0x00888888)},
{(float)(x+w) ,(float)y , 0.0f, 0.0f, (color1-0x00888888)},
{(float)x ,(float)(y+(h/2)) , 0.0f, 0.0f, (color1)},
{(float)(x+w) ,(float)(y+(h/2)) , 0.0f, 0.0f, (color1)},
{(float)x ,(float)(y+h) , 0.0f, 0.0f, (color1+0x00555555)},
{(float)(x+w) ,(float)(y+h) , 0.0f, 0.0f, (color1+0x00555555)},
};
pDevice->SetTexture( 0, NULL );
pDevice->SetRenderState( D3DRS_LIGHTING, FALSE);
pDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW);
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
pDevice->SetFVF( sVertex::FVF_Flags );
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,4,Veri,sizeof (sVertex));
}
[/php]








