Going to redo assets.
This commit is contained in:
@@ -26,13 +26,14 @@ target_sources(${DUSK_TARGET_NAME}
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(assert)
|
||||
add_subdirectory(asset)
|
||||
add_subdirectory(console)
|
||||
add_subdirectory(display)
|
||||
add_subdirectory(ecs)
|
||||
add_subdirectory(engine)
|
||||
add_subdirectory(error)
|
||||
add_subdirectory(input)
|
||||
add_subdirectory(locale)
|
||||
# add_subdirectory(locale)
|
||||
add_subdirectory(scene)
|
||||
add_subdirectory(thread)
|
||||
add_subdirectory(time)
|
||||
|
@@ -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;
|
@@ -12,6 +12,7 @@
|
||||
#include "display/display.h"
|
||||
#include "ecs/ecssystem.h"
|
||||
#include "scene/node.h"
|
||||
#include "asset/assetsystem.h"
|
||||
|
||||
#include "scene/test/scenetest.h"
|
||||
|
||||
@@ -25,6 +26,7 @@ errorret_t engineInit(void) {
|
||||
timeInit();
|
||||
consoleInit();
|
||||
ecsSystemInit();
|
||||
assetSystemInit();
|
||||
errorChain(displayInit());
|
||||
|
||||
sceneTestAdd();
|
||||
@@ -43,6 +45,7 @@ errorret_t engineUpdate(void) {
|
||||
errorret_t engineDispose(void) {
|
||||
ecsSystemDispose();
|
||||
errorChain(displayDispose());
|
||||
assetSystemDispose();
|
||||
consoleDispose();
|
||||
|
||||
errorOk();
|
||||
|
Reference in New Issue
Block a user