71 lines
1.8 KiB
C
71 lines
1.8 KiB
C
#ifndef ARC_GRAPHICS_SPRITE_H_
|
|
#define ARC_GRAPHICS_SPRITE_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "arc/graphics/renderer.h"
|
|
#include "arc/graphics/spritesheet.h"
|
|
#include "arc/math/rectangle.h"
|
|
#include "arc/std/array.h"
|
|
|
|
/**
|
|
* @brief a sprite type
|
|
*
|
|
* @note the actual type should be define by overriding for a graphics api
|
|
*/
|
|
typedef struct ARC_Sprite ARC_Sprite;
|
|
|
|
/**
|
|
* @brief creates ARC_Sprite type
|
|
*
|
|
* @param sprite ARC_Sprite that is being created
|
|
* @param spritesheet ARC_Spritesheet that ARC_Sprite will be pulled from
|
|
* @param bounds ARC_Array of bounds of sprite on spritesheet
|
|
*/
|
|
void ARC_Sprite_Create(ARC_Sprite **sprite, ARC_Spritesheet *spritesheet, ARC_Array *bounds);
|
|
|
|
/**
|
|
* @brief destroys ARC_Sprite type
|
|
*
|
|
* @param sprite ARC_Sprite to destroy
|
|
*/
|
|
void ARC_Sprite_Destroy(ARC_Sprite *sprite);
|
|
|
|
/**
|
|
* @brief copies ARC_Sprite to a new ARC_Sprite
|
|
*
|
|
* @param newSprite ARC_Sprite that is being copied to and created
|
|
* @param oldSprite ARC_Sprite contents that are being copied
|
|
*/
|
|
void ARC_Sprite_Copy(ARC_Sprite **newSprite, ARC_Sprite *oldSprite);
|
|
|
|
/**
|
|
* @brief renders ARC_Sprite type
|
|
*
|
|
* @param sprite ARC_Sprite that will be rendered
|
|
* @param renderer ARC_Renderer that is handling rendering
|
|
* @param renderBounds area of renderer that ARC_Sprite will be rendered to
|
|
*/
|
|
void ARC_Sprite_Render(ARC_Sprite *sprite, ARC_Renderer *renderer, ARC_Rect *renderBounds);
|
|
|
|
/**
|
|
* @brief switches ARC_Sprite's frames to next for animation
|
|
*
|
|
* @param sprite ARC_Sprite that is having its frame updated
|
|
*/
|
|
void ARC_Sprite_IterateFrame(ARC_Sprite *sprite);
|
|
|
|
/**
|
|
* @brief returns the current bounds based on the ARC_Sprite's frames
|
|
*
|
|
* @param sprite ARC_Sprite to get bounds from
|
|
*/
|
|
ARC_Rect *ARC_Sprite_GetBounds(ARC_Sprite *sprite);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // !ARC_GRAPHICS_SPRITE_H_
|