This commit is contained in:
2025-08-23 17:43:22 -05:00
parent c8a3ebfcec
commit 329925ea54
6 changed files with 168 additions and 0 deletions

0
src/asset/CMakeLists.txt Normal file
View File

65
src/asset/asset.c Normal file
View File

@@ -0,0 +1,65 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "asset.h"
assetcallbacks_t ASSET_CALLBACKS[ASSET_TYPE_COUNT] = {
{
.init = assetRawInit,
.loadAsync = assetRawLoadAsync,
.loadSync = assetRawLoadSync,
.dispose = assetRawDispose
},
{
.init = NULL,
.loadAsync = NULL,
.loadSync = NULL,
.dispose = NULL
},
{
.init = NULL,
.loadAsync = NULL,
.loadSync = NULL,
.dispose = NULL
},
{
.init = NULL,
.loadAsync = NULL,
.loadSync = NULL,
.dispose = NULL
},
{
.init = NULL,
.loadAsync = NULL,
.loadSync = NULL,
.dispose = NULL
},
{
.init = NULL,
.loadAsync = NULL,
.loadSync = NULL,
.dispose = NULL
},
{
.init = NULL,
.loadAsync = NULL,
.loadSync = NULL,
.dispose = NULL
},
{
.init = NULL,
.loadAsync = NULL,
.loadSync = NULL,
.dispose = NULL
}
};
void assetInit() {
}

36
src/asset/asset.h Normal file
View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "assetraw.h"
typedef enum {
ASSET_TYPE_RAW,
ASSET_TYPE_TEXTURE,
ASSET_TYPE_JSON,
ASSET_TYPE_MODEL,
ASSET_TYPE_AUDIO,
ASSET_TYPE_COUNT
} assettype_t;
typedef struct {
void (*init)(asset_t *asset);
void (*loadAsync)(asset_t *asset);
void (*loadSync)(asset_t *asset);
void (*dispose)(asset_t *asset);
} assetcallbacks_t;
typedef struct asset_s {
void *arg;
} asset_t;
extern assetcallbacks_t ASSET_CALLBACKS[];
void assetInit(void);
void assetDispose(void);

24
src/asset/assetraw.c Normal file
View File

@@ -0,0 +1,24 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "assetraw.h"
void assetRawInit(asset_t *asset) {
}
void assetRawLoadAsync(asset_t *asset) {
}
void assetRawLoadSync(asset_t *asset) {
}
void assetRawDispose(asset_t *asset) {
}

16
src/asset/assetraw.h Normal file
View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusk.h"
typedef struct asset_s asset_t;
void assetRawInit(asset_t *asset);
void assetRawLoadAsync(asset_t *asset);
void assetRawLoadSync(asset_t *asset);
void assetRawDispose(asset_t *asset);

27
src/asset/assetsystem.h Normal file
View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "asset.h"
#include "thread/thread.h"
typedef struct {
void *args;
thread_t loadThread;
} assetsystem_t;
extern assetsystem_t ASSET_SYSTEM;
/**
* Initializes the asset system.
*/
void assetSystemInit(void);
/**
* Disposes/cleans up the asset system.
*/
void assetSystemDispose(void);