sprite frames added

This commit is contained in:
herbglitch 2023-01-02 18:05:44 -07:00
parent 12a28fea88
commit f337113932
2 changed files with 8 additions and 0 deletions

View file

@ -8,6 +8,7 @@ extern "C" {
#include "arc/graphics/renderer.h"
#include "arc/graphics/spritesheet.h"
#include "arc/math/rectangle.h"
#include "arc/std/array.h"
typedef struct ARC_Sprite ARC_Sprite;
@ -19,6 +20,8 @@ void ARC_Sprite_Render(ARC_Sprite *sprite, ARC_Renderer *renderer, ARC_Rect *ren
void ARC_Sprite_IterateFrame(ARC_Sprite *sprite);
void ARC_Sprite_SetFrames(ARC_Sprite *sprite, ARC_Array *frames);
ARC_Rect *ARC_Sprite_GetBounds(ARC_Sprite *sprite);
#ifdef __cplusplus

View file

@ -31,6 +31,11 @@ void ARC_Sprite_IterateFrame(ARC_Sprite *sprite){
}
}
void ARC_Sprite_SetFrames(ARC_Sprite *sprite, ARC_Array *frames){
sprite->frames = frames->data;
*sprite->frameIndex = 0;
}
ARC_Rect *ARC_Sprite_GetBounds(ARC_Sprite *sprite){
return sprite->frames + *sprite->frameIndex;
}