Going to redo assets.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2025 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_TARGET_NAME}
|
||||
PRIVATE
|
||||
asset.c
|
||||
assetraw.c
|
||||
assetsystem.c
|
||||
)
|
||||
@@ -7,56 +7,12 @@
|
||||
|
||||
#include "asset.h"
|
||||
|
||||
assetcallbacks_t ASSET_CALLBACKS[ASSET_TYPE_COUNT] = {
|
||||
assetcallbacks_t ASSET_CALLBACKS[] = {
|
||||
{
|
||||
.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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,31 +6,12 @@
|
||||
*/
|
||||
|
||||
#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;
|
||||
#include "dusk.h"
|
||||
|
||||
typedef struct asset_s {
|
||||
void *arg;
|
||||
int32_t nothing;
|
||||
} asset_t;
|
||||
|
||||
extern assetcallbacks_t ASSET_CALLBACKS[];
|
||||
|
||||
void assetInit(void);
|
||||
|
||||
void assetDispose(void);
|
||||
14
src/asset/assetimage.h
Normal file
14
src/asset/assetimage.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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 {
|
||||
const int32_t width;
|
||||
const int32_t height;
|
||||
} assetimage_t;
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* 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) {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 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);
|
||||
20
src/asset/assetsystem.c
Normal file
20
src/asset/assetsystem.c
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "assetsystem.h"
|
||||
#include "util/memory.h"
|
||||
|
||||
assetsystem_t ASSET_SYSTEM;
|
||||
|
||||
void assetSystemInit(void) {
|
||||
memoryZero(&ASSET_SYSTEM, sizeof(assetsystem_t));
|
||||
// threadInit(&ASSET_SYSTEM.thread, NULL);
|
||||
}
|
||||
|
||||
void assetSystemDispose(void) {
|
||||
// threadDispose(&ASSET_SYSTEM.thread);
|
||||
}
|
||||
@@ -7,11 +7,9 @@
|
||||
|
||||
#pragma once
|
||||
#include "asset.h"
|
||||
#include "thread/thread.h"
|
||||
|
||||
typedef struct {
|
||||
void *args;
|
||||
thread_t loadThread;
|
||||
int32_t nothing;
|
||||
} assetsystem_t;
|
||||
|
||||
extern assetsystem_t ASSET_SYSTEM;
|
||||
|
||||
19
src/asset/assettileset.h
Normal file
19
src/asset/assettileset.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 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 assetimage_s assetimage_t;
|
||||
|
||||
typedef struct {
|
||||
const int32_t tileWidth;
|
||||
const int32_t tileHeight;
|
||||
const int32_t tileCount;
|
||||
const int32_t columns;
|
||||
const assetimage_t *image;
|
||||
} assettileset_t;
|
||||
Reference in New Issue
Block a user