Solved DirectX9 Sprites

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

F4DE

Newbie
Full Member
Mar 28, 2016
17
98
0
Hi,
I am trying to draw an image to the screen using directx9 and sprites, but I have no clue how to do it. I've tried some random stuff, but I just get errors and I can't seem to find any good examples online.
Could someone tell me how / give me an example?
Thanks
 

speedy

Newbie
May 10, 2015
4
97
1
Hi,
I am trying to draw an image to the screen using directx9 and sprites, but I have no clue how to do it. I've tried some random stuff, but I just get errors and I can't seem to find any good examples online.
Could someone tell me how / give me an example?
Thanks
here is a simple example:
C++:
//globals
bool SpriteCreated0 = NULL;
LPDIRECT3DTEXTURE9 IMAGE0;
LPD3DXSPRITE SPRITE0;
D3DXVECTOR3 ImagePos0;
bool DoInit = true;

//in any d3d func (which is called)
if (DoInit)
{
	//create sprite only once
	D3DXCreateSprite(Device, &SPRITE0);
	DoInit = false;
}

//in endscene or present
if (SpriteCreated0 == FALSE)
{
	D3DXCreateTextureFromFile(Device, GetDirectoryFile("target.png"), &IMAGE0); //make sure the pic is in the right directory
	//D3DXCreateTextureFromFile(Device, "C:\\image.png", &IMAGE0); 
	SpriteCreated0 = TRUE;
}
ImagePos0.x = 100; //or esp coordinates
ImagePos0.y = 100;
ImagePos0.z = 0.0f;

SPRITE0->Begin(D3DXSPRITE_ALPHABLEND);
SPRITE0->Draw(IMAGE0, NULL, NULL, &ImagePos0, 0xFFFFFFFF);
SPRITE0->End();

//in reset somewhere
if (SPRITE0 != NULL) { SPRITE0->Release(); }SPRITE0 = NULL;
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods