diff --git a/src/asset/CMakeLists.txt b/src/asset/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/asset/asset.c b/src/asset/asset.c new file mode 100644 index 0000000..407e507 --- /dev/null +++ b/src/asset/asset.c @@ -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() { + +} \ No newline at end of file diff --git a/src/asset/asset.h b/src/asset/asset.h new file mode 100644 index 0000000..9ec7cb2 --- /dev/null +++ b/src/asset/asset.h @@ -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); \ No newline at end of file diff --git a/src/asset/assetraw.c b/src/asset/assetraw.c new file mode 100644 index 0000000..25d4f70 --- /dev/null +++ b/src/asset/assetraw.c @@ -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) { + +} \ No newline at end of file diff --git a/src/asset/assetraw.h b/src/asset/assetraw.h new file mode 100644 index 0000000..0bb4af5 --- /dev/null +++ b/src/asset/assetraw.h @@ -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); \ No newline at end of file diff --git a/src/asset/assetsystem.h b/src/asset/assetsystem.h new file mode 100644 index 0000000..5917182 --- /dev/null +++ b/src/asset/assetsystem.h @@ -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); \ No newline at end of file