Render text working.

This commit is contained in:
2025-09-02 22:47:07 -05:00
parent 87f18d0e13
commit 1af2b8f47b
19 changed files with 340 additions and 157 deletions

View File

@@ -12,7 +12,12 @@
#include "console/console.h"
assetdef_t ASSET_DEFINITIONS[ASSET_TYPE_COUNT] = {
[ASSET_TYPE_PALETTE_IMAGE] = { "DPI", assetPaletteImageLoad },
[ASSET_TYPE_PALETTE_IMAGE] = {
"DPI", assetPaletteImageLoad, assetPaletteImageDispose
},
[ASSET_TYPE_ALPHA_IMAGE] = {
"DAI", assetAlphaImageLoad, assetAlphaImageDispose
},
};
errorret_t assetInit(asset_t *asset, const char_t *filename) {
@@ -50,7 +55,6 @@ ref_t assetLock(asset_t *asset) {
void assetUnlock(asset_t *asset, const ref_t ref) {
assertNotNull(asset, "Asset cannot be NULL.");
assertTrue(ref > 0, "Reference must be greater than 0.");
// Just unlock the reference in the reference list.
refListUnlock(&asset->refList, ref);
@@ -121,9 +125,16 @@ errorret_t assetLoad(asset_t *asset) {
errorOk();
}
void assetDispose(asset_t *asset) {
errorret_t assetDispose(asset_t *asset) {
assertNotNull(asset, "Asset cannot be NULL.");
if(asset->state == ASSET_STATE_LOADED) {
// Dispose of the asset based on its type.
assetdef_t *def = &ASSET_DEFINITIONS[asset->type];
if(def->dispose) errorChain(def->dispose(asset));
asset->state = ASSET_STATE_NOT_LOADED;
}
if(asset->file) {
zip_fclose(asset->file);
asset->file = NULL;