Unify the library on an akgl_ namespace
This commit is contained in:
@@ -1,44 +1,44 @@
|
||||
#ifndef _SPRITE_H_
|
||||
#define _SPRITE_H_
|
||||
#ifndef _AKGL_SPRITE_H_
|
||||
#define _AKGL_SPRITE_H_
|
||||
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <akerror.h>
|
||||
|
||||
|
||||
#define SPRITE_MAX_FRAMES 16
|
||||
#define SPRITE_MAX_NAME_LENGTH 128
|
||||
#define SPRITE_MAX_REGISTRY_SIZE 1024
|
||||
#define SPRITE_SHEET_MAX_FILENAME_LENGTH 512
|
||||
#define AKGL_SPRITE_MAX_FRAMES 16
|
||||
#define AKGL_SPRITE_MAX_NAME_LENGTH 128
|
||||
#define AKGL_SPRITE_MAX_REGISTRY_SIZE 1024
|
||||
#define AKGL_SPRITE_SHEET_MAX_FILENAME_LENGTH 512
|
||||
|
||||
#define MAX_HEAP_SPRITE (MAX_HEAP_ACTOR * 16)
|
||||
#define MAX_HEAP_SPRITESHEET MAX_HEAP_SPRITE
|
||||
#define AKGL_MAX_HEAP_SPRITE (AKGL_MAX_HEAP_ACTOR * 16)
|
||||
#define AKGL_MAX_HEAP_SPRITESHEET AKGL_MAX_HEAP_SPRITE
|
||||
|
||||
typedef struct {
|
||||
int refcount;
|
||||
SDL_Texture *texture;
|
||||
char name[SPRITE_SHEET_MAX_FILENAME_LENGTH];
|
||||
char name[AKGL_SPRITE_SHEET_MAX_FILENAME_LENGTH];
|
||||
int sprite_w;
|
||||
int sprite_h;
|
||||
} spritesheet;
|
||||
} akgl_SpriteSheet;
|
||||
|
||||
typedef struct {
|
||||
int refcount;
|
||||
spritesheet *sheet;
|
||||
int frameids[SPRITE_MAX_FRAMES]; // which IDs on the spritesheet belong to our frames
|
||||
akgl_SpriteSheet *sheet;
|
||||
int frameids[AKGL_SPRITE_MAX_FRAMES]; // which IDs on the spritesheet belong to our frames
|
||||
int frames; // how many frames are in this animation
|
||||
int width;
|
||||
int height;
|
||||
long int speed; // how many milliseconds a given sprite frame should be visible before cycling
|
||||
bool loop; // when this sprite is done playing, it should immediately start again
|
||||
bool loopReverse; // when this sprite is done playing, it should go in reverse order through its frames
|
||||
char name[SPRITE_MAX_NAME_LENGTH];
|
||||
} sprite;
|
||||
char name[AKGL_SPRITE_MAX_NAME_LENGTH];
|
||||
} akgl_Sprite;
|
||||
|
||||
// initializes a new sprite to use the given sheet and otherwise sets to zero
|
||||
akerr_ErrorContext AKERR_NOIGNORE *sprite_initialize(sprite *spr, char *name, spritesheet *sheet);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_sprite_initialize(akgl_Sprite *spr, char *name, akgl_SpriteSheet *sheet);
|
||||
// loads a given image file into a new spritesheet
|
||||
akerr_ErrorContext AKERR_NOIGNORE *spritesheet_initialize(spritesheet *sheet, int sprite_w, int sprite_h, char *filename);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *sprite_load_json(char *filename);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_spritesheet_initialize(akgl_SpriteSheet *sheet, int sprite_w, int sprite_h, char *filename);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_sprite_load_json(char *filename);
|
||||
|
||||
#endif //_SPRITE_H_
|
||||
#endif //_AKGL_SPRITE_H_
|
||||
|
||||
Reference in New Issue
Block a user