HelpDirectX Draw Sprite "Bug"

Posts 16 of 6 · Page 1 of 1
DirectX Draw Sprite "Bug"
Hey guys
Hope someone of you can help me with this problem!
I made an awesome menu with photoshop, and I wanted to put it as my hackmenu.
I searched for drawing sprites with scale function, and I found a cool working method:

Code:
void CDirectx::DrawSprite(LPDIRECT3DDEVICE9 pDevice, LPDIRECT3DTEXTURE9 pTexture, int x, int y, int w, int h)
{
	if(!cHacks.ValidPointer(pDevice) || !cHacks.ValidPointer(pTexture))
		return;

	struct tVertex
	{
		float X, Y, Z, RHW;
		float IU, IV;
		 enum FVF
		{
			FVF_Flags = (D3DFVF_XYZRHW | D3DFVF_TEX1)
		};
	
	};

	tVertex Veri[4] =
	{
		{(float)x		,(float)y		, 0.0f, 1.0f, 0.0f, 0.0f },
		{(float)(x+w)	,(float)y		, 0.0f, 1.0f, 1.0f, 0.0f },
		{(float)x		,(float)(y+h)	, 0.0f, 1.0f, 0.0f, 1.0f },
		{(float)(x+w)	,(float)(y+h)	, 0.0f, 1.0f, 1.0f, 1.0f },
	};
	
	pDevice->SetTexture( 0, pTexture );
	pDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );
	pDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
	pDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_TEXTURE );
	pDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1  );
	pDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE );
	pDevice->SetTextureStageState( 1, D3DTSS_COLOROP,   D3DTOP_DISABLE );
	pDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP,   D3DTOP_DISABLE );

	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( tVertex::FVF_Flags  );
	pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,Veri,sizeof(tVertex));
}
But sometimes, my menu keeps crashing!
Its not detected, if I comment all my spritedrawing out it works, my old d3d-menu works too!
Could it be, that this function is crashing me, because Im drawing too much sprites?
Is there a fix for it?
Please help me
you resetting the sprite when the device changes?
Thank you for replying, but as you see in the code, there is no sprite.
Its using the device directly to draw, thats the good thing!
But something is crashing me :/

EDIT: I know why it crashed. I hooked soemthing with mc detours. Using now selfmade detours and works fine. But what I dont know is, why it crashed just with my new menu o_0
Thanks for help
So it's solved then?
Quote Originally Posted by Xipher View Post
So it's solved then?
Yeah, you can close it
Hope people learn from it that microsoft detours isn't the best way
Im writing my own atm
:3 Closed.
Posts 16 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?