hey guys i wanna show you how to draw a sprite correctly.
At first the declarations:
Code:
LPDIRECT3DTEXTURE9 SpriteTexture;
LPD3DXSPRITE Sprite;
int SpriteSize_X = 100; //Width of your sprite
int SpriteSize_Y = 100; //Height of your sprite
Then insert these functions in your Code:
Code:
void CreateSprite(LPDIRECT3DDEVICE9 pDevice)
{
{
D3DXCreateTextureFromFileInMemoryEx(pDevice, &myFile, sizeof(myFile), SpriteSize_X , SpriteSize_Y, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &SpriteTexture);
D3DXCreateSprite(pDevice,&Sprite);
}
}
void DrawSprite(LPDIRECT3DDEVICE9 pDevice){
D3DXVECTOR3 POS;
POS.x = 5;
POS.y = 5;
POS.z = 0;
if(SpriteTexture==NULL){CreateSprite(pDevice);}
Sprite->Begin(D3DXSPRITE_ALPHABLEND);
Sprite->Draw(SpriteTexture,NULL,NULL,&POS,0xFFFFFFFF);
Sprite->End();
}
myFile is the byte array from your picture (you have to generate it, the program to do this is in the attachments), Example:
Code:
BYTE myFile[] = { 0x00, 0x00, ... }
When your done just insert this in your present:
Code:
DrawSprite(pDevice);
FileToByteArray EXE Virus Scan: https://www.virustotal.com/file/a32b...is/1347228483/
FileToByteArray RAR Virus Scan #1: https://www.virustotal.com/file/3ee3...is/1347228532/
FileToByteArray RAR Virus Scan #2: https://www.virustotal.com/file/3ee3...is/1347228580/
Hope it works and have fun with it
Credits:
Me