Sprite atlases
Defines
-
BINOCLE_MAX_ATLAS_FILENAME_LENGTH
Typedefs
-
typedef enum binocle_atlas_file_format binocle_atlas_file_format
The format of the atlas. We currently support libGDX and TexturePacker
-
typedef struct binocle_atlas_animation binocle_atlas_animation
-
typedef struct binocle_atlas_slice_key binocle_atlas_slice_key
-
typedef struct binocle_atlas_slice binocle_atlas_slice
-
typedef struct binocle_atlas_tp_meta binocle_atlas_tp_meta
-
typedef struct binocle_atlas_tp_frame binocle_atlas_tp_frame
-
typedef struct binocle_atlas_texturepacker binocle_atlas_texturepacker
-
typedef struct binocle_atlas_texturepacker_load_desc binocle_atlas_texturepacker_load_desc
Enums
Functions
-
bool binocle_atlas_load_texturepacker(binocle_atlas_texturepacker *atlas, binocle_atlas_texturepacker_load_desc *desc)
Load a TexturePacker JSON atlas into the
atlasstruct.- Parameters:
atlas – an instance of binocle_atlas_texturepacker
desc – The descriptor of the file to load
- Returns:
true if successful, false otherwise
-
void binocle_atlas_texturepacker_create_subtextures(binocle_atlas_texturepacker *atlas, struct sg_image *texture, struct binocle_subtexture *subtextures, int *num_subtextures)
Creates the subtexttures from the frames of an already loaded TexturePacker JSON atlas.
- Parameters:
atlas – an instance of binocle_atlas_texturepacker with the data of the atlas
texture – the corresponding texture associated to this atlas. It has to be already loaded.
subtextures – an array of subtextures to store those coming from the JSON
num_subtextures – the number of subtextures that have been loaded by this function
-
void binocle_atlas_destroy_texturepacker(binocle_atlas_texturepacker *atlas)
Frees the resources of the atlas
- Parameters:
atlas – an instance of binocle_atlas_texturepacker to release
-
void binocle_atlas_load_libgdx(char *filename, struct sg_image *texture, struct binocle_subtexture *subtextures, int *num_subtextures)
Load a libGDX atlas
Note
Not yet implemented
- Parameters:
filename – the JSON file path and name
texture – the corresponding texture that we already loaded
subtextures – an array of subtextures to store those coming from the JSON
num_subtextures – the number of subtextures that have been loaded by this function
-
void binocle_atlas_animation_destroy(binocle_atlas_animation *animations, size_t num_animations)
Frees the memory allocated while loading animations
- Parameters:
animations – a pointer to the binocle_atlas_animation struct to free
num_animations – the number of animations previously loaded
-
void binocle_atlas_texturepacker_create_animations(binocle_atlas_texturepacker *atlas, struct sg_image texture, struct binocle_sprite *sprite)
Creates the animations in a given sprite based on the content of the atlas
- Parameters:
atlas – the TexturePacker atlas
texture – the texture with the image of the atlas
sprite – the sprite instance whose animations have to be created
-
struct binocle_atlas_animation
-
struct binocle_atlas_slice_key
-
struct binocle_atlas_slice
-
struct binocle_atlas_tp_meta
-
struct binocle_atlas_tp_frame
-
struct binocle_atlas_texturepacker
Public Members
-
char asset_filename[BINOCLE_MAX_ATLAS_FILENAME_LENGTH]
-
binocle_atlas_tp_frame *frames
-
size_t num_frames
-
char asset_filename[BINOCLE_MAX_ATLAS_FILENAME_LENGTH]
-
struct binocle_atlas_texturepacker_load_desc