fixing sprites idk...
This commit is contained in:
parent
b1230534c5
commit
9f616e196c
3 changed files with 43 additions and 13 deletions
|
@ -37,7 +37,24 @@ void UpdateSpriteAnimation(SpriteAnimation self, float dt) {
|
|||
}
|
||||
|
||||
void DrawSpriteAnimation(SpriteAnimation spriteAnimation, Vector2 position) {
|
||||
Vector2 drawpos = Vector2Add(position, Vector2Scale(spriteAnimation->size, 2.f));
|
||||
#ifdef _DEBUG
|
||||
DrawCircleV(position, 5, DARKGREEN);
|
||||
#endif
|
||||
Rectangle destination = (Rectangle){
|
||||
0,
|
||||
0,
|
||||
spriteAnimation->size.x * spriteAnimation->scale,
|
||||
spriteAnimation->size.y * spriteAnimation->scale
|
||||
} ;
|
||||
|
||||
Vector2 origin = (Vector2){
|
||||
.x = position.x + destination.width/2.f,
|
||||
.y = position.y + destination.height/2.f
|
||||
};
|
||||
#ifdef _DEBUG
|
||||
DrawCircleV(origin, 5, RED);
|
||||
#endif
|
||||
|
||||
DrawTexturePro(
|
||||
spriteAnimation->texture,
|
||||
(Rectangle){
|
||||
|
@ -46,16 +63,14 @@ void DrawSpriteAnimation(SpriteAnimation spriteAnimation, Vector2 position) {
|
|||
spriteAnimation->sourceRect.width,
|
||||
spriteAnimation->sourceRect.height
|
||||
},
|
||||
(Rectangle){
|
||||
position.x,
|
||||
position.y,
|
||||
spriteAnimation->size.x * spriteAnimation->scale,
|
||||
spriteAnimation->size.y * spriteAnimation->scale
|
||||
},
|
||||
position,
|
||||
destination,
|
||||
origin,
|
||||
spriteAnimation->rotation,
|
||||
WHITE
|
||||
);
|
||||
#ifdef _DEBUG
|
||||
DrawRectangleLinesEx(destination, 2, BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DestroySpriteAnimation(SpriteAnimation spriteAnimation)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue