Guest User

Untitled

a guest
Nov 19th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. sprites = new SpriteSheet(L"./Sprites/index.png", gfx ,64 ,64);
  2.  
  3. void SpriteSheet::Draw(int index, int x, int y , float mag)
  4. {
  5. D2D1_RECT_F src = D2D1::RectF(
  6. (float)((index % spriteAcross) * spriteWidth),
  7. (float)((index % spriteAcross) * spriteHeight),
  8. (float)(((index % spriteAcross) * spriteWidth) + spriteWidth),
  9. (float)(((index % spriteAcross) * spriteHeight) + spriteHeight)
  10. );
  11.  
  12. D2D1_RECT_F dest = D2D1::RectF(
  13. x, y,
  14. x + spriteWidth,
  15. y + spriteHeight
  16. );
  17.  
  18. gfx->GetRenderTarget()->DrawBitmap( bmp.Get(), dest, 1.0f , D2D1_BITMAP_INTERPOLATION_MODE_LINEAR , src);
  19. }
  20.  
  21. sprites->Draw((frame/20)%4 , 100, 100 , 2.0);
Add Comment
Please, Sign In to add comment