diff --git a/src/asset/CMakeLists.txt b/src/asset/CMakeLists.txt index b3ca339..f542548 100644 --- a/src/asset/CMakeLists.txt +++ b/src/asset/CMakeLists.txt @@ -9,6 +9,7 @@ target_sources(${DUSK_TARGET_NAME} asset.c assetpalette.c assettileset.c + assetpaletteimage.c ) # Compile definitions diff --git a/src/asset/asset.h b/src/asset/asset.h index d6a03a7..89df0b0 100644 --- a/src/asset/asset.h +++ b/src/asset/asset.h @@ -9,6 +9,7 @@ #include "dusk.h" #include "assetpalette.h" #include "assettileset.h" +#include "assetpalleteimage.h" #include "error/error.h" #include #include "display/texture/texture.h" @@ -28,6 +29,7 @@ typedef struct { union { assetpalette_t palette; assettileset_t tileset; + assetpaletteimage_t paletteImage; }; } assetdata_t; #pragma pack(pop) @@ -36,6 +38,7 @@ typedef struct { union { texture_t palette; assettileset_t *tileset; + texture_t paletteImage; }; } assetloaded_t; @@ -80,6 +83,7 @@ static const char_t ASSET_SEARCH_PATHS[][FILENAME_MAX] = { static const assetmap_t ASSET_MAP[] = { { "DPF", ".dpf", assetParsePalette }, { "DPT", ".dpt", assetParseTileset }, + { "DPI", ".dpi", assetParsePaletteImage }, { NULL, NULL, NULL } }; diff --git a/src/asset/assetpalette.h b/src/asset/assetpalette.h index ff2c9fb..585275c 100644 --- a/src/asset/assetpalette.h +++ b/src/asset/assetpalette.h @@ -19,4 +19,4 @@ typedef struct { /** * Parse the palette from the loaded raw data. */ -void assetParsePalette(); \ No newline at end of file +void assetParsePalette(void); \ No newline at end of file diff --git a/src/asset/assetpaletteimage.c b/src/asset/assetpaletteimage.c new file mode 100644 index 0000000..049732f --- /dev/null +++ b/src/asset/assetpaletteimage.c @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "asset.h" + +void assetParsePaletteImage(void) { + printf("nothin doin\n"); +} \ No newline at end of file diff --git a/src/asset/assetpalleteimage.h b/src/asset/assetpalleteimage.h new file mode 100644 index 0000000..dbcd483 --- /dev/null +++ b/src/asset/assetpalleteimage.h @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dusk.h" + +#define ASSET_PALETTE_IMAGE_PIXELS_MAX (256*256) + +typedef struct { + int32_t width; + int32_t height; + uint8_t paletteIndex; + uint8_t paletteIndexes[ASSET_PALETTE_IMAGE_PIXELS_MAX]; +} assetpaletteimage_t; + +/** + * Parse the palette image from the loaded raw data. + */ +void assetParsePaletteImage(void); \ No newline at end of file diff --git a/src/asset/assettileset.h b/src/asset/assettileset.h index 2f957d1..e2ba190 100644 --- a/src/asset/assettileset.h +++ b/src/asset/assettileset.h @@ -21,4 +21,4 @@ typedef struct { /** * Parse the tileset from the loaded raw data. */ -void assetParseTileset(); \ No newline at end of file +void assetParseTileset(void); \ No newline at end of file diff --git a/src/engine/engine.c b/src/engine/engine.c index 58ff9ff..b63c9e0 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -20,8 +20,8 @@ engine_t ENGINE; void assetLoadCallback(void *data) { consolePrint("Asset load callback called!"); - test = ASSET.loaded.palette; - consolePrint("Loaded palette with %d colors", ASSET.data.palette.colorCount); + // test = ASSET.loaded.palette; + // consolePrint("Loaded palette with %d colors", ASSET.data.palette.colorCount); } errorret_t engineInit(void) { @@ -35,7 +35,7 @@ errorret_t engineInit(void) { errorChain(assetInit()); errorChain(displayInit()); - assetLoad("first.palette.dpf", assetLoadCallback, NULL); + assetLoad("entities.dpi", assetLoadCallback, NULL); if(ASSET.state == ASSET_STATE_ERROR) errorChain(ASSET.error); sceneTestAdd(); diff --git a/tools/assetstool/processimage.py b/tools/assetstool/processimage.py index 372daa7..0deed0c 100644 --- a/tools/assetstool/processimage.py +++ b/tools/assetstool/processimage.py @@ -102,7 +102,7 @@ def processImage(assetPath): f.write(b"DPI") # Dusk Palettized Image f.write(struct.pack("