• Advertisement
Sign in to follow this  

Drra

This topic is 444 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I will use Google translator, so if something is not clear to you, I'm sorry.
 I have a function for drawing pictures.
[spoiler]

void DrawImage(float posX, float posY, stTextureInfo *texture, float width, float height, float angel = 0) {
if (texture == nullptr)
return;
D3DXMATRIX mat;
D3DSURFACE_DESC surfaceDesc;
texture->pTexture->GetLevelDesc(0, &surfaceDesc);
D3DXVECTOR2 axisPos = D3DXVECTOR2(posX, posY);
D3DXVECTOR2 size(1 / (float)surfaceDesc.Width * (float)width, 1 / (float)surfaceDesc.Height * (float)height);
D3DXVECTOR2 axisCenter = D3DXVECTOR2((width / 2), (height / 2));
D3DXMatrixTransformation2D(&mat, NULL, 0.0f, &size, &axisCenter, DegreesToRadians(angel), &axisPos);
texture->pSprite->Begin(D3DXSPRITE_ALPHABLEND);
texture->pSprite->SetTransform(&mat);
texture->pSprite->Draw(texture->pTexture, NULL, NULL, NULL, -1);
texture->pSprite->End();
}

[/spoiler]
It works perfectly in the game.
I want it modified to only draw her a certain part of which will depend on the percentage ratio. To make it understand made an example of how I see it. 
[spoiler]

void DrawImage(float posX, float posY, stTextureInfo *texture, float width, float height, float angel = 0, float percent = 100)
[/spoiler]

 

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement