74 lines
1.9 KiB
C
74 lines
1.9 KiB
C
|
|
#ifndef TC_ASSETS_H
|
|
#define TC_ASSETS_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
typedef struct tc_image tc_image_s;
|
|
|
|
typedef struct tc_asset_attribute
|
|
{
|
|
char *issuer;
|
|
char *name;
|
|
|
|
union
|
|
{
|
|
void *pointer;
|
|
int64_t integer;
|
|
char *text;
|
|
|
|
} data;
|
|
|
|
} tc_asset_attribute_s;
|
|
|
|
struct tc_image
|
|
{
|
|
bool is_subimage;
|
|
bool is_uploaded;
|
|
|
|
tc_image_s *superimage;
|
|
|
|
uint32_t gl_identifier;
|
|
uint32_t image_id;
|
|
|
|
uint32_t len_name;
|
|
char *name;
|
|
|
|
uint32_t attributes_capacity;
|
|
uint32_t num_attributes;
|
|
tc_asset_attribute_s *attributes;
|
|
|
|
uint32_t x; // Only used if this is a subimage
|
|
uint32_t y; // Only used if this is a subimage
|
|
int32_t width;
|
|
int32_t height;
|
|
void *pixels;
|
|
|
|
};
|
|
|
|
typedef struct tc_asset_storage
|
|
{
|
|
uint32_t images_capacity;
|
|
uint32_t num_images;
|
|
tc_image_s **images;
|
|
|
|
// todo: meshes
|
|
|
|
} tc_asset_storage_s;
|
|
|
|
tc_asset_storage_s tc_init_asset_storage (char *asset_folder_path);
|
|
tc_image_s * tc_load_image_from_disk (char *path);
|
|
void tc_upload_image (tc_image_s *image);
|
|
|
|
tc_image_s * tc_resolve_id_to_image (uint32_t id);
|
|
tc_image_s * tc_resolve_name_to_image (char *name);
|
|
|
|
tc_image_s * tc_create_subimage(tc_image_s *superimage,
|
|
uint32_t x, uint32_t y,
|
|
uint32_t width, uint32_t height);
|
|
|
|
#endif
|
|
|