Techneck/code/source-c/assets.h

74 lines
1.9 KiB
C
Raw Permalink Normal View History

#ifndef TC_ASSETS_H
#define TC_ASSETS_H
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
2023-10-12 06:18:43 +00:00
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;
2023-10-12 06:18:43 +00:00
struct tc_image
{
bool is_subimage;
bool is_uploaded;
tc_image_s *superimage;
uint32_t gl_identifier;
2023-10-12 06:18:43 +00:00
uint32_t image_id;
uint32_t len_name;
char *name;
uint32_t attributes_capacity;
uint32_t num_attributes;
tc_asset_attribute_s *attributes;
2023-10-12 06:18:43 +00:00
uint32_t x; // Only used if this is a subimage
uint32_t y; // Only used if this is a subimage
2023-10-14 14:48:09 +00:00
int32_t width;
int32_t height;
void *pixels;
2023-10-12 06:18:43 +00:00
};
typedef struct tc_asset_storage
{
uint32_t images_capacity;
uint32_t num_images;
tc_image_s **images;
2023-10-12 06:18:43 +00:00
// 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);
2023-10-12 06:18:43 +00:00
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