How to change opacity

Posts 1–15 of 30 · Page 1 of 2
How to change opacity
How do i change the opacity of the drawbox?,
i have this
and i want the box allmost see through.
the normal DrawBox?
If it is, I dont think you can.

Use:

Code:
void DrawTransBox( int x, int y, int w, int h, D3DCOLOR BackColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
	const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;
	struct Vertex 
	{
		float x,y,z,ht;
		DWORD BackColor;
	}

	V[4] =
	{
		{(float)x,(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)x,(float)y, 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)y, 0.0f, 0.0f, BackColor}
	};

	pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
	pDevice->SetRenderState( D3DRS_FOGENABLE, false );

	pDevice->SetFVF(D3D_FVF);
	pDevice->SetTexture(0, NULL);
	pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));

	DrawBorder( x, y, w, h, 1,	BorderColor, pDevice );
}
Then to set the transparency, Change the A value of ARGB
wtf i can thank you but thank's..
Quote Originally Posted by wassup40 View Post
wtf i can thank you but thank's..
Why wouldn't you thank him?

Sounds a bit ungrateful.
Quote Originally Posted by Spookerzz View Post


Why wouldn't you thank him?

Sounds a bit ungrateful.
No... there wasnt a thank button for some reason..,
1 other thing how do i make it open as a menu becouse the border is allways there
Quote Originally Posted by wassup40 View Post


No... there wasnt a thank button for some reason..,
1 other thing how do i make it open as a menu becouse the border is allways there
You put it under MenuShow?
or Mvisible == true
Quote Originally Posted by ac1d_buRn View Post


You put it under MenuShow?
or Mvisible == true
and how do i do that...
Quote Originally Posted by wassup40 View Post


and how do i do that...
LOCATE WHERE YOU DETERMINE WHETHER YOU DRAW YOUR MENU. NOW, REPLACE THE 'A' OF THE ARGB VALUE WITH YOUR ALPHA. THEN, GO TO YOUR DRAWBOX CODE, AND REPLACE THE CODE YOU HAVE WITH THE ONE CRASH POSTED.

This is clearly not your base, so I'm not saying "your code".
I now have no inside's....
Who says the dickhead put A to 0?
Looks better that way
There no ARGB in here
Code:
void DrawTransBox( int x, int y, int w, int h, D3DCOLOR BackColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
	const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;
	struct Vertex 
	{
		float x,y,z,ht;
		DWORD BackColor;
	}

	V[4] =
	{
		{(float)x,(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)x,(float)y, 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)y, 0.0f, 0.0f, BackColor}
	};

	pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
	pDevice->SetRenderState( D3DRS_FOGENABLE, false );

	pDevice->SetFVF(D3D_FVF);
	pDevice->SetTexture(0, NULL);
	pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));

	DrawBorder( x, y, w, h, 1,	BorderColor, pDevice );
}
Quote Originally Posted by wassup40 View Post
There no ARGB in here
Code:
void DrawTransBox( int x, int y, int w, int h, D3DCOLOR BackColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
	const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;
	struct Vertex 
	{
		float x,y,z,ht;
		DWORD BackColor;
	}

	V[4] =
	{
		{(float)x,(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)x,(float)y, 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)y, 0.0f, 0.0f, BackColor}
	};

	pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
	pDevice->SetRenderState( D3DRS_FOGENABLE, false );

	pDevice->SetFVF(D3D_FVF);
	pDevice->SetTexture(0, NULL);
	pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));

	DrawBorder( x, y, w, h, 1,	BorderColor, pDevice );
}
You cant code. Nuff proven
Learn C++ & DirectX.
My spoon aeroplane just ran out of fuel.
Quote Originally Posted by wassup40 View Post
There no ARGB in here
Code:
void DrawTransBox( int x, int y, int w, int h, D3DCOLOR BackColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
	const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;
	struct Vertex 
	{
		float x,y,z,ht;
		DWORD BackColor;
	}

	V[4] =
	{
		{(float)x,(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)x,(float)y, 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)(y+h), 0.0f, 0.0f, BackColor},
		{(float)(x+w),(float)y, 0.0f, 0.0f, BackColor}
	};

	pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
	pDevice->SetRenderState( D3DRS_FOGENABLE, false );

	pDevice->SetFVF(D3D_FVF);
	pDevice->SetTexture(0, NULL);
	pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));

	DrawBorder( x, y, w, h, 1,	BorderColor, pDevice );
}
Look, your signature and avatar are misleading.

You got us to spoonfeed you yesterday once already, but you didn't know how to eat the spoonfed food.

And now that you want us to do it again, we have overlooked your previous failures and tried to help you once more. But again, despite watching 40 videos on C++, you don't get this either, another spoonfeeding.
Code:
void FillRGB( int x, int y, int w, int h, D3DCOLOR yourcolor, IDirect3DDevice9* pDevice )
{
const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;
struct Vertex
{
float x,y,z,ht;
DWORD yourcolor;
}

V[4] =
{
{(float)x,(float)(y+h), 0.0f, 0.0f, yourcolor},
{(float)x,(float)y, 0.0f, 0.0f, yourcolor},
{(float)(x+w),(float)(y+h), 0.0f, 0.0f, yourcolor},
{(float)(x+w),(float)y, 0.0f, 0.0f, yourcolor}
};
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );

pDevice->SetFVF(D3D_FVF);
pDevice->SetTexture(0, NULL);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));

}
Figure out the rest by yourself, i'm sure your smart enough.
Maybe -_-;
Posts 1–15 of 30 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us