I've found this code to display a sprite.
//Health Bar
// globals
LPDIRECT3DTEXTURE9 DisplayTexture;
float enemyX = 60.0f, enemyY = 60.0f;
int health = 300;
int maxhealth = 1000;
void LoadDisplay()
{
LoadTexture(&DisplayTexture, L"DisplaySprites.png");
return;
}
void DrawDisplay()
{
RECT Part;
// DRAW THE RADAR
// display the backdrop
SetRect(&Part, 2, 14, 169, 181);
DrawTexture(DisplayTexture, Part, 10, 10, 127);
// if the enemy is within 84 units of the player, display the enemy
if(sqrt((92 - enemyX) * (92 - enemyX) + (92 - enemyY) * (92 - enemyY)) < 84)
{
SetRect(&Part, 341, 14, 344, 17);
DrawTexture(DisplayTexture, Part, enemyX, enemyY, 255);
}
// display the border
SetRect(&Part, 171, 13, 340, 182);
DrawTexture(DisplayTexture, Part, 9, 9, 255);
// DRAW THE HEALTHBAR
// display the bar
SetRect(&Part, 1, 1, 505, 12);
DrawTexture(DisplayTexture, Part, 11, 456, 255);
// display the health "juice"
SetRect(&Part, 506, 1, 507, 12);
for(int index = 0; index < (health * 490 / maxhealth); index++)
DrawTexture(DisplayTexture, Part, index + 18, 456, 255);
return;
}
...I'll do some experiments....