Refactor asset loading
This commit is contained in:
41
src/asset/assettype.h
Normal file
41
src/asset/assettype.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "type/assetpaletteimage.h"
|
||||
#include "type/assetalphaimage.h"
|
||||
|
||||
typedef enum {
|
||||
ASSET_TYPE_NULL,
|
||||
ASSET_TYPE_PALETTE_IMAGE,
|
||||
ASSET_TYPE_ALPHA_IMAGE,
|
||||
ASSET_TYPE_COUNT,
|
||||
} assettype_t;
|
||||
|
||||
typedef struct {
|
||||
const char_t *header;
|
||||
const size_t dataSize;
|
||||
errorret_t (*load)(void *data, void *output);
|
||||
} assettypedef_t;
|
||||
|
||||
static const assettypedef_t ASSET_TYPE_DEFINITIONS[ASSET_TYPE_COUNT] = {
|
||||
[ASSET_TYPE_NULL] = {
|
||||
0
|
||||
},
|
||||
|
||||
[ASSET_TYPE_PALETTE_IMAGE] = {
|
||||
.header = "DPI",
|
||||
.dataSize = sizeof(assetpaletteimage_t),
|
||||
.load = assetPaletteImageLoad
|
||||
},
|
||||
|
||||
[ASSET_TYPE_ALPHA_IMAGE] = {
|
||||
.header = "DAI",
|
||||
.dataSize = sizeof(assetalphaimage_t),
|
||||
.load = assetAlphaImageLoad
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user