Jump to content
  • Advertisement
Sign in to follow this  
Barashuk

Drra

This topic is 679 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!