DrawSquare() Function [by Topblast]

Posts 115 of 58 · Page 1 of 4
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]
Why the need for Vertex?
Quote Originally Posted by seaplusplus View Post
Why the need for Vertex?
This from the guy who Told me he KNOW D3D

It was ok if u didnt kno D3D but lying to be kool is just WRONG.
Quote Originally Posted by Nubzgetkillz View Post
More like a rectangle
yea
Quote Originally Posted by topblast View Post


yea
wats your msn? I? NEVER GOTS IT! lol.. bad engliesh
looks like a french fry
I'm sorry to say but this doesn't match my menu base
it looks good, but ya, dont think it will match menus like flames said.
I didnt see his menu base 0.0

Wait.. ahh fuck it. Ur base need GUI Editions everyone got the same blue.
Quote Originally Posted by topblast View Post
I didnt see his menu base 0.0

Wait.. ahh fuck it. Ur base need GUI Editions everyone got the same blue.
i was the first one to use that color scheme, It took me a wile actually to get good matching colors
Then like every noob, start copying it and ripping it.

eg; Zane



Im in the process of making a new menu, but not really good with classes/structs D:
Quote Originally Posted by ac1d_buRn View Post


i was the first one to use that color scheme, It took me a wile actually to get good matching colors
Then like every noob, start copying it and ripping it.

eg; Zane



Im in the process of making a new menu, but not really good with classes/structs D:
I can help u, not really good with GUI
best menu.

Quote Originally Posted by NOOB View Post
best menu.

I'm loving it XD
Posts 115 of 58 · Page 1 of 4
This thread is closed for replies.

Tags for this Thread

None

Need help?