From e5e8c49f6cd2fd4e4ebf1ba8bfcd9235b361f075 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Fri, 13 Feb 2026 19:13:26 -0600 Subject: [PATCH] Mostly nuking old system --- CMakeLists.txt | 22 +- {tools => archive}/asset/args.py | 0 {tools => archive}/asset/bundle/__main__.py | 0 {tools => archive}/asset/cache.py | 0 {tools => archive}/asset/path.py | 0 {tools => archive}/asset/process/asset.py | 0 {tools => archive}/asset/process/image.py | 0 {tools => archive}/asset/process/language.py | 0 {tools => archive}/asset/process/map.py | 0 {tools => archive}/asset/process/palette.py | 0 {tools => archive}/asset/process/script.py | 0 {tools => archive}/asset/process/tileset.py | 0 {tools => archive}/dusk/chunk.py | 0 {tools => archive}/dusk/defs.py | 0 {tools => archive}/dusk/entity.py | 0 {tools => archive}/dusk/event.py | 0 {tools => archive}/dusk/map.py | 0 {tools => archive}/dusk/region.py | 0 {tools => archive}/dusk/tile.py | 0 {tools => archive}/editor/__main__.py | 0 .../editor/cutscene/cutsceneitemeditor.py | 0 .../editor/cutscene/cutscenemenubar.py | 0 .../editor/cutscene/cutscenetext.py | 0 .../editor/cutscene/cutscenewait.py | 0 {tools => archive}/editor/cutscenetool.py | 0 {tools => archive}/editor/langtool.py | 0 {tools => archive}/editor/map/camera.py | 0 {tools => archive}/editor/map/chunkpanel.py | 0 {tools => archive}/editor/map/entitypanel.py | 0 {tools => archive}/editor/map/glwidget.py | 0 {tools => archive}/editor/map/grid.py | 0 {tools => archive}/editor/map/mapinfopanel.py | 0 {tools => archive}/editor/map/mapleftpanel.py | 0 {tools => archive}/editor/map/menubar.py | 0 {tools => archive}/editor/map/regionpanel.py | 0 {tools => archive}/editor/map/selectbox.py | 0 {tools => archive}/editor/map/statusbar.py | 0 {tools => archive}/editor/map/vertexbuffer.py | 0 {tools => archive}/editor/maptool.py | 0 {assets => archive}/map/CMakeLists.txt | 0 .../map/testmap/CMakeLists.txt | 0 .../map/testmap/chunks/-1_-1_0.json | 0 .../map/testmap/chunks/-1_-1_1.json | 0 .../map/testmap/chunks/-1_0_0.json | 0 .../map/testmap/chunks/-2_1_0.json | 0 .../map/testmap/chunks/0_-1_0.json | 0 .../map/testmap/chunks/0_-1_1.json | 0 .../map/testmap/chunks/0_0_0.json | 0 .../map/testmap/chunks/1_0_0.json | 0 .../map/testmap/chunks/2_0_0.json | 0 .../map/testmap/chunks/3_0_0.json | 0 .../map/testmap/chunks/4_0_0.json | 0 .../map/testmap/chunks/5_0_0.json | 0 {assets => archive}/map/testmap/testmap.json | 0 assets/CMakeLists.txt | 22 - assets/entity/CMakeLists.txt | 6 - assets/entity/entities.png | Bin 336 -> 0 bytes assets/entity/entities.tsx | 4 - assets/locale/CMakeLists.txt | 6 - assets/locale/en_US.po | 6 - assets/palette/CMakeLists.txt | 7 - assets/palette/palette0.png | Bin 241 -> 0 bytes assets/palette/palette0.pxo | Bin 1576 -> 0 bytes assets/palette/paletteMinesweeper.png | Bin 168 -> 0 bytes assets/scene/CMakeLists.txt | 7 - assets/scene/initial.lua | 43 -- assets/tileset/prarie.png | Bin 758 -> 0 bytes assets/tileset/prarie.pxo | Bin 1314 -> 0 bytes assets/tileset/prarie.tsx | 4 - src/asset/asset.c | 74 +- src/asset/asset.h | 6 - src/asset/assettype.h | 47 +- src/asset/type/CMakeLists.txt | 3 +- src/asset/type/assetalphaimage.c | 34 - src/asset/type/assetalphaimage.h | 32 - src/asset/type/assetlanguage.h | 1 - src/asset/type/assetpaletteimage.h | 34 - .../{assetpaletteimage.c => assettexture.c} | 39 +- src/asset/type/assettexture.h | 34 + src/display/palette/CMakeLists.txt | 1 + src/display/palette/palette.c | 8 + src/display/palette/palette.h | 6 +- src/display/text.c | 5 +- src/display/text.h | 5 +- src/display/texture.c | 1 - src/display/tileset/tileset.c | 10 - src/display/tileset/tileset.h | 10 +- src/locale/locale.h | 13 + tools/CMakeLists.txt | 12 +- tools/display/color/csv/__main__.py | 1 - tools/input/csv/__main__.py | 1 - tools/item/csv/__main__.py | 1 - tools/palette-indexer.html | 698 ++++++++++++++++++ tools/story/csv/__main__.py | 1 - tools/tile-joiner.html | 223 ++++++ tools/tile-slicer.html | 391 ++++++++++ tools/util/type.py | 44 -- 97 files changed, 1454 insertions(+), 408 deletions(-) rename {tools => archive}/asset/args.py (100%) rename {tools => archive}/asset/bundle/__main__.py (100%) rename {tools => archive}/asset/cache.py (100%) rename {tools => archive}/asset/path.py (100%) rename {tools => archive}/asset/process/asset.py (100%) rename {tools => archive}/asset/process/image.py (100%) rename {tools => archive}/asset/process/language.py (100%) rename {tools => archive}/asset/process/map.py (100%) rename {tools => archive}/asset/process/palette.py (100%) rename {tools => archive}/asset/process/script.py (100%) rename {tools => archive}/asset/process/tileset.py (100%) rename {tools => archive}/dusk/chunk.py (100%) rename {tools => archive}/dusk/defs.py (100%) rename {tools => archive}/dusk/entity.py (100%) rename {tools => archive}/dusk/event.py (100%) rename {tools => archive}/dusk/map.py (100%) rename {tools => archive}/dusk/region.py (100%) rename {tools => archive}/dusk/tile.py (100%) rename {tools => archive}/editor/__main__.py (100%) rename {tools => archive}/editor/cutscene/cutsceneitemeditor.py (100%) rename {tools => archive}/editor/cutscene/cutscenemenubar.py (100%) rename {tools => archive}/editor/cutscene/cutscenetext.py (100%) rename {tools => archive}/editor/cutscene/cutscenewait.py (100%) rename {tools => archive}/editor/cutscenetool.py (100%) rename {tools => archive}/editor/langtool.py (100%) rename {tools => archive}/editor/map/camera.py (100%) rename {tools => archive}/editor/map/chunkpanel.py (100%) rename {tools => archive}/editor/map/entitypanel.py (100%) rename {tools => archive}/editor/map/glwidget.py (100%) rename {tools => archive}/editor/map/grid.py (100%) rename {tools => archive}/editor/map/mapinfopanel.py (100%) rename {tools => archive}/editor/map/mapleftpanel.py (100%) rename {tools => archive}/editor/map/menubar.py (100%) rename {tools => archive}/editor/map/regionpanel.py (100%) rename {tools => archive}/editor/map/selectbox.py (100%) rename {tools => archive}/editor/map/statusbar.py (100%) rename {tools => archive}/editor/map/vertexbuffer.py (100%) rename {tools => archive}/editor/maptool.py (100%) rename {assets => archive}/map/CMakeLists.txt (100%) rename {assets => archive}/map/testmap/CMakeLists.txt (100%) rename {assets => archive}/map/testmap/chunks/-1_-1_0.json (100%) rename {assets => archive}/map/testmap/chunks/-1_-1_1.json (100%) rename {assets => archive}/map/testmap/chunks/-1_0_0.json (100%) rename {assets => archive}/map/testmap/chunks/-2_1_0.json (100%) rename {assets => archive}/map/testmap/chunks/0_-1_0.json (100%) rename {assets => archive}/map/testmap/chunks/0_-1_1.json (100%) rename {assets => archive}/map/testmap/chunks/0_0_0.json (100%) rename {assets => archive}/map/testmap/chunks/1_0_0.json (100%) rename {assets => archive}/map/testmap/chunks/2_0_0.json (100%) rename {assets => archive}/map/testmap/chunks/3_0_0.json (100%) rename {assets => archive}/map/testmap/chunks/4_0_0.json (100%) rename {assets => archive}/map/testmap/chunks/5_0_0.json (100%) rename {assets => archive}/map/testmap/testmap.json (100%) delete mode 100644 assets/CMakeLists.txt delete mode 100644 assets/entity/CMakeLists.txt delete mode 100644 assets/entity/entities.png delete mode 100644 assets/entity/entities.tsx delete mode 100644 assets/locale/CMakeLists.txt delete mode 100644 assets/palette/CMakeLists.txt delete mode 100644 assets/palette/palette0.png delete mode 100644 assets/palette/palette0.pxo delete mode 100644 assets/palette/paletteMinesweeper.png delete mode 100644 assets/scene/CMakeLists.txt delete mode 100644 assets/scene/initial.lua delete mode 100644 assets/tileset/prarie.png delete mode 100644 assets/tileset/prarie.pxo delete mode 100644 assets/tileset/prarie.tsx delete mode 100644 src/asset/type/assetalphaimage.c delete mode 100644 src/asset/type/assetalphaimage.h delete mode 100644 src/asset/type/assetpaletteimage.h rename src/asset/type/{assetpaletteimage.c => assettexture.c} (51%) create mode 100644 src/asset/type/assettexture.h create mode 100644 src/display/palette/palette.c create mode 100644 src/locale/locale.h create mode 100644 tools/palette-indexer.html create mode 100644 tools/tile-joiner.html create mode 100644 tools/tile-slicer.html delete mode 100644 tools/util/type.py diff --git a/CMakeLists.txt b/CMakeLists.txt index caea886..d123bd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ endif() add_subdirectory(tools) # Assets -add_subdirectory(assets) +# add_subdirectory(assets) # Add libraries if(DUSK_TARGET_SYSTEM STREQUAL "linux") @@ -176,16 +176,16 @@ if(ENABLE_TESTS) endif() # Build assets -dusk_run_python( - DUSK_ASSETS_BUILT - tools.asset.bundle - --assets ${DUSK_ASSETS_DIR} - --output-assets ${DUSK_BUILT_ASSETS_DIR} - --output-file ${DUSK_BUILD_DIR}/dusk.dsk - --headers-dir ${DUSK_GENERATED_HEADERS_DIR} - --input ${DUSK_ASSETS} -) -add_dependencies(${DUSK_LIBRARY_TARGET_NAME} DUSK_ASSETS_BUILT) +# dusk_run_python( +# DUSK_ASSETS_BUILT +# tools.asset.bundle +# --assets ${DUSK_ASSETS_DIR} +# --output-assets ${DUSK_BUILT_ASSETS_DIR} +# --output-file ${DUSK_BUILD_DIR}/dusk.dsk +# --headers-dir ${DUSK_GENERATED_HEADERS_DIR} +# --input ${DUSK_ASSETS} +# ) +# add_dependencies(${DUSK_LIBRARY_TARGET_NAME} DUSK_ASSETS_BUILT) # Include generated headers target_include_directories(${DUSK_LIBRARY_TARGET_NAME} PUBLIC diff --git a/tools/asset/args.py b/archive/asset/args.py similarity index 100% rename from tools/asset/args.py rename to archive/asset/args.py diff --git a/tools/asset/bundle/__main__.py b/archive/asset/bundle/__main__.py similarity index 100% rename from tools/asset/bundle/__main__.py rename to archive/asset/bundle/__main__.py diff --git a/tools/asset/cache.py b/archive/asset/cache.py similarity index 100% rename from tools/asset/cache.py rename to archive/asset/cache.py diff --git a/tools/asset/path.py b/archive/asset/path.py similarity index 100% rename from tools/asset/path.py rename to archive/asset/path.py diff --git a/tools/asset/process/asset.py b/archive/asset/process/asset.py similarity index 100% rename from tools/asset/process/asset.py rename to archive/asset/process/asset.py diff --git a/tools/asset/process/image.py b/archive/asset/process/image.py similarity index 100% rename from tools/asset/process/image.py rename to archive/asset/process/image.py diff --git a/tools/asset/process/language.py b/archive/asset/process/language.py similarity index 100% rename from tools/asset/process/language.py rename to archive/asset/process/language.py diff --git a/tools/asset/process/map.py b/archive/asset/process/map.py similarity index 100% rename from tools/asset/process/map.py rename to archive/asset/process/map.py diff --git a/tools/asset/process/palette.py b/archive/asset/process/palette.py similarity index 100% rename from tools/asset/process/palette.py rename to archive/asset/process/palette.py diff --git a/tools/asset/process/script.py b/archive/asset/process/script.py similarity index 100% rename from tools/asset/process/script.py rename to archive/asset/process/script.py diff --git a/tools/asset/process/tileset.py b/archive/asset/process/tileset.py similarity index 100% rename from tools/asset/process/tileset.py rename to archive/asset/process/tileset.py diff --git a/tools/dusk/chunk.py b/archive/dusk/chunk.py similarity index 100% rename from tools/dusk/chunk.py rename to archive/dusk/chunk.py diff --git a/tools/dusk/defs.py b/archive/dusk/defs.py similarity index 100% rename from tools/dusk/defs.py rename to archive/dusk/defs.py diff --git a/tools/dusk/entity.py b/archive/dusk/entity.py similarity index 100% rename from tools/dusk/entity.py rename to archive/dusk/entity.py diff --git a/tools/dusk/event.py b/archive/dusk/event.py similarity index 100% rename from tools/dusk/event.py rename to archive/dusk/event.py diff --git a/tools/dusk/map.py b/archive/dusk/map.py similarity index 100% rename from tools/dusk/map.py rename to archive/dusk/map.py diff --git a/tools/dusk/region.py b/archive/dusk/region.py similarity index 100% rename from tools/dusk/region.py rename to archive/dusk/region.py diff --git a/tools/dusk/tile.py b/archive/dusk/tile.py similarity index 100% rename from tools/dusk/tile.py rename to archive/dusk/tile.py diff --git a/tools/editor/__main__.py b/archive/editor/__main__.py similarity index 100% rename from tools/editor/__main__.py rename to archive/editor/__main__.py diff --git a/tools/editor/cutscene/cutsceneitemeditor.py b/archive/editor/cutscene/cutsceneitemeditor.py similarity index 100% rename from tools/editor/cutscene/cutsceneitemeditor.py rename to archive/editor/cutscene/cutsceneitemeditor.py diff --git a/tools/editor/cutscene/cutscenemenubar.py b/archive/editor/cutscene/cutscenemenubar.py similarity index 100% rename from tools/editor/cutscene/cutscenemenubar.py rename to archive/editor/cutscene/cutscenemenubar.py diff --git a/tools/editor/cutscene/cutscenetext.py b/archive/editor/cutscene/cutscenetext.py similarity index 100% rename from tools/editor/cutscene/cutscenetext.py rename to archive/editor/cutscene/cutscenetext.py diff --git a/tools/editor/cutscene/cutscenewait.py b/archive/editor/cutscene/cutscenewait.py similarity index 100% rename from tools/editor/cutscene/cutscenewait.py rename to archive/editor/cutscene/cutscenewait.py diff --git a/tools/editor/cutscenetool.py b/archive/editor/cutscenetool.py similarity index 100% rename from tools/editor/cutscenetool.py rename to archive/editor/cutscenetool.py diff --git a/tools/editor/langtool.py b/archive/editor/langtool.py similarity index 100% rename from tools/editor/langtool.py rename to archive/editor/langtool.py diff --git a/tools/editor/map/camera.py b/archive/editor/map/camera.py similarity index 100% rename from tools/editor/map/camera.py rename to archive/editor/map/camera.py diff --git a/tools/editor/map/chunkpanel.py b/archive/editor/map/chunkpanel.py similarity index 100% rename from tools/editor/map/chunkpanel.py rename to archive/editor/map/chunkpanel.py diff --git a/tools/editor/map/entitypanel.py b/archive/editor/map/entitypanel.py similarity index 100% rename from tools/editor/map/entitypanel.py rename to archive/editor/map/entitypanel.py diff --git a/tools/editor/map/glwidget.py b/archive/editor/map/glwidget.py similarity index 100% rename from tools/editor/map/glwidget.py rename to archive/editor/map/glwidget.py diff --git a/tools/editor/map/grid.py b/archive/editor/map/grid.py similarity index 100% rename from tools/editor/map/grid.py rename to archive/editor/map/grid.py diff --git a/tools/editor/map/mapinfopanel.py b/archive/editor/map/mapinfopanel.py similarity index 100% rename from tools/editor/map/mapinfopanel.py rename to archive/editor/map/mapinfopanel.py diff --git a/tools/editor/map/mapleftpanel.py b/archive/editor/map/mapleftpanel.py similarity index 100% rename from tools/editor/map/mapleftpanel.py rename to archive/editor/map/mapleftpanel.py diff --git a/tools/editor/map/menubar.py b/archive/editor/map/menubar.py similarity index 100% rename from tools/editor/map/menubar.py rename to archive/editor/map/menubar.py diff --git a/tools/editor/map/regionpanel.py b/archive/editor/map/regionpanel.py similarity index 100% rename from tools/editor/map/regionpanel.py rename to archive/editor/map/regionpanel.py diff --git a/tools/editor/map/selectbox.py b/archive/editor/map/selectbox.py similarity index 100% rename from tools/editor/map/selectbox.py rename to archive/editor/map/selectbox.py diff --git a/tools/editor/map/statusbar.py b/archive/editor/map/statusbar.py similarity index 100% rename from tools/editor/map/statusbar.py rename to archive/editor/map/statusbar.py diff --git a/tools/editor/map/vertexbuffer.py b/archive/editor/map/vertexbuffer.py similarity index 100% rename from tools/editor/map/vertexbuffer.py rename to archive/editor/map/vertexbuffer.py diff --git a/tools/editor/maptool.py b/archive/editor/maptool.py similarity index 100% rename from tools/editor/maptool.py rename to archive/editor/maptool.py diff --git a/assets/map/CMakeLists.txt b/archive/map/CMakeLists.txt similarity index 100% rename from assets/map/CMakeLists.txt rename to archive/map/CMakeLists.txt diff --git a/assets/map/testmap/CMakeLists.txt b/archive/map/testmap/CMakeLists.txt similarity index 100% rename from assets/map/testmap/CMakeLists.txt rename to archive/map/testmap/CMakeLists.txt diff --git a/assets/map/testmap/chunks/-1_-1_0.json b/archive/map/testmap/chunks/-1_-1_0.json similarity index 100% rename from assets/map/testmap/chunks/-1_-1_0.json rename to archive/map/testmap/chunks/-1_-1_0.json diff --git a/assets/map/testmap/chunks/-1_-1_1.json b/archive/map/testmap/chunks/-1_-1_1.json similarity index 100% rename from assets/map/testmap/chunks/-1_-1_1.json rename to archive/map/testmap/chunks/-1_-1_1.json diff --git a/assets/map/testmap/chunks/-1_0_0.json b/archive/map/testmap/chunks/-1_0_0.json similarity index 100% rename from assets/map/testmap/chunks/-1_0_0.json rename to archive/map/testmap/chunks/-1_0_0.json diff --git a/assets/map/testmap/chunks/-2_1_0.json b/archive/map/testmap/chunks/-2_1_0.json similarity index 100% rename from assets/map/testmap/chunks/-2_1_0.json rename to archive/map/testmap/chunks/-2_1_0.json diff --git a/assets/map/testmap/chunks/0_-1_0.json b/archive/map/testmap/chunks/0_-1_0.json similarity index 100% rename from assets/map/testmap/chunks/0_-1_0.json rename to archive/map/testmap/chunks/0_-1_0.json diff --git a/assets/map/testmap/chunks/0_-1_1.json b/archive/map/testmap/chunks/0_-1_1.json similarity index 100% rename from assets/map/testmap/chunks/0_-1_1.json rename to archive/map/testmap/chunks/0_-1_1.json diff --git a/assets/map/testmap/chunks/0_0_0.json b/archive/map/testmap/chunks/0_0_0.json similarity index 100% rename from assets/map/testmap/chunks/0_0_0.json rename to archive/map/testmap/chunks/0_0_0.json diff --git a/assets/map/testmap/chunks/1_0_0.json b/archive/map/testmap/chunks/1_0_0.json similarity index 100% rename from assets/map/testmap/chunks/1_0_0.json rename to archive/map/testmap/chunks/1_0_0.json diff --git a/assets/map/testmap/chunks/2_0_0.json b/archive/map/testmap/chunks/2_0_0.json similarity index 100% rename from assets/map/testmap/chunks/2_0_0.json rename to archive/map/testmap/chunks/2_0_0.json diff --git a/assets/map/testmap/chunks/3_0_0.json b/archive/map/testmap/chunks/3_0_0.json similarity index 100% rename from assets/map/testmap/chunks/3_0_0.json rename to archive/map/testmap/chunks/3_0_0.json diff --git a/assets/map/testmap/chunks/4_0_0.json b/archive/map/testmap/chunks/4_0_0.json similarity index 100% rename from assets/map/testmap/chunks/4_0_0.json rename to archive/map/testmap/chunks/4_0_0.json diff --git a/assets/map/testmap/chunks/5_0_0.json b/archive/map/testmap/chunks/5_0_0.json similarity index 100% rename from assets/map/testmap/chunks/5_0_0.json rename to archive/map/testmap/chunks/5_0_0.json diff --git a/assets/map/testmap/testmap.json b/archive/map/testmap/testmap.json similarity index 100% rename from assets/map/testmap/testmap.json rename to archive/map/testmap/testmap.json diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt deleted file mode 100644 index b4d88af..0000000 --- a/assets/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2025 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DUSK_GAME_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Game assets directory") - -# Palette asset needs to be added before any images. -add_subdirectory(palette) - -# Languages need to be added before anything that uses text. -add_subdirectory(locale) - -# Rest, order doesn't matter -add_asset(SCRIPT init.lua) - -# Subdirs -# add_subdirectory(entity) -# add_subdirectory(map) -add_subdirectory(ui) -add_subdirectory(minesweeper) -add_subdirectory(scene) diff --git a/assets/entity/CMakeLists.txt b/assets/entity/CMakeLists.txt deleted file mode 100644 index 6cee926..0000000 --- a/assets/entity/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -add_asset(TILESET entities.tsx) \ No newline at end of file diff --git a/assets/entity/entities.png b/assets/entity/entities.png deleted file mode 100644 index fc417a8fb75b84aa16a7573ace42f3a51be8bd5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D%zxjbDQLn`LH zz3I)@B&-@joS{ z(|>~ZO*#FlIO<-_#;rA_vTFAHUz}WWPENn<-?02?d3;uG%%hv1Rqswewd|AF!KY_ntC-PW@`nINPfx=pN9LO39Fzuw(bu jCx1W34D=v5fW3_Q==p_uAC?$@0BQGh^>bP0l+XkKX3vC> diff --git a/assets/entity/entities.tsx b/assets/entity/entities.tsx deleted file mode 100644 index c7d7ecf..0000000 --- a/assets/entity/entities.tsx +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/assets/locale/CMakeLists.txt b/assets/locale/CMakeLists.txt deleted file mode 100644 index 49e7742..0000000 --- a/assets/locale/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -add_asset(LANGUAGE en_US.po) \ No newline at end of file diff --git a/assets/locale/en_US.po b/assets/locale/en_US.po index 41e2025..2b86067 100644 --- a/assets/locale/en_US.po +++ b/assets/locale/en_US.po @@ -7,9 +7,3 @@ msgstr "" msgid "ui.test" msgstr "Hello this is a test." - -msgid "map.test" -msgstr "This is a map test." - -msgid "test.test2" -msgstr "This is another test." diff --git a/assets/palette/CMakeLists.txt b/assets/palette/CMakeLists.txt deleted file mode 100644 index 52b3842..0000000 --- a/assets/palette/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2025 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -add_asset(PALETTE palette0.png) -add_asset(PALETTE paletteMinesweeper.png) \ No newline at end of file diff --git a/assets/palette/palette0.png b/assets/palette/palette0.png deleted file mode 100644 index e60ee7f03b8203942557e7c074c2a48812e84763..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 241 zcmeAS@N?(olHy`uVBq!ia0vp^W*#=i1b8AR%#qqQstn z``@3-=$>}U=4HrSV4$B{aFadA`RJL~3YUHQdn=`K602tM@4fuB_ppWURp#AXdeZx9 z0{IV}KNR?5ckQNooqyjRu<-Ahf9j=YjQB&5ca2UOuD|BJbJ!dpx^({}zmS$!E+5@? oElzfP-Bo8T#q8FVdQ&MBb@0Pmh#umAu6 diff --git a/assets/palette/palette0.pxo b/assets/palette/palette0.pxo deleted file mode 100644 index 070274afbdfd1fc0eef1d4f6e873b51cbf7d8a86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1576 zcmWIWW@Zs#VBp|jU=1>g4oRH7^$jxv!v$dm22KVBhLpsTM7^xy{Jh>7uZvb02po?; zdUE+?$=iw(3aZ;avu!=RM9Ose9k!&^r8VCta|dqZJuN=bq3%uIxBV@)i@(3S@V>JD z)AjADQRbtuI@m$Y`#bJ@IGS7+y8P7xaM%-k15v~!x zXVvFcxtJY^w!1F*t7gi)Jl@-X>e+J9C_dveN-rcE<#y=&-J;^flUnoT!Uq%I!6{X_|CBC`e7{YP+Gc(Aw`-+rb|G#}*eQd>-?ht5A5Fzt8H;lJyck zb+e9El-)}TVAk~f@aIOO)q+fibuZltg?>ja;F^=!Huaa|0){pI#m;Q64m^C;%5%lZ z=kk|VYJ4wQxI>z>CCY=oibe*oo%3B@F}uP}MuWM%c&qNh#AnAFjdr-{@=ZRNEYE$V z!C3c5B+mv1Mw@51z9=N-yS-s_LPMSmo-Xpq*-yK{oj$GJ?&(IJfGMBf#n;Y)LH~En8h7VOFZOj z@U=O5pMN9AoG;E#%lq6C-Tqh@yq7G_)e2$Qu|v`&9ldZ zbH=ZJ#m(9e51;)l#Id$@vc8(p`{Vo1EHPo+oWLPd>s|)7g7x_uj9p zFZEot`(kDu)C#Nlw9edC`b%g02kzQ;s+VPXOM|cfd7K@&!|ck1GZN)9cH|juJ^t+2 zLhmadb;Ep(w{=UjWmz_e5f9str1MB@yao(KUwM}qq=EsCp(=@6$ugIJ% zJDjs}cJwaq5Si}sYu)!2*2P)Oe0DbXPs!{LuXk*9?*D%0>kK~I_guG6IPN-sIP2p3 z(&$%NPj5f94?rmr(kFREZ3Gqt42%p6(m*ORH!(dm9#k;srxhjUrWWfP>gOa@rWVB; zhMrO6V=@$Ay$?uCb2R_0tEz4cpc$VDLSGu zKb|>p(sVWBzxFK*f{S~~W)@CTc8g5NVJTF*v6ki0N@e%x>XfwR=l(ulvyzJ!HoI$I|6IDEm^;<%rOdiF54W`M;o9^4zKzA< z6c5ipkJS&`zCY%w?z`|P@XBW8z{VMc%kTeTNA+p%d!|dkvJd1@24x&R&CE;5OinG1 zhx#~~fg!+~k%@r;cM%FS2y7yVMk-LzwV?+yL^+5QX2Bci=mw$t0%6c!90sBJDZrbR Q4Wx+~2rmL@M^+FI09ARJfdBvi diff --git a/assets/palette/paletteMinesweeper.png b/assets/palette/paletteMinesweeper.png deleted file mode 100644 index 71936304d05a4506181c731d097dba73911ee2db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^ia^ZB!2~4lYX$HDseDft$B>FSj42GW|1(x@`7bD( zoc`|z-!8-7vS-e{Z=D?cRd3GhLr?skD9!HpeCEeF7e3wtyZ_c4_V~xUZtnb<-A4}{ zla=N-TYl)^#fz7cle3b;ZaN1nxpCv6mzSrf=ZhCF?CtHZ@T^Phf6Fjy79%6$i-o34 UUwBkCfL1ejy85}Sb4q9e06<7Y6#xJL diff --git a/assets/scene/CMakeLists.txt b/assets/scene/CMakeLists.txt deleted file mode 100644 index dae18d6..0000000 --- a/assets/scene/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2025 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -add_asset(SCRIPT initial.lua) -add_asset(SCRIPT minesweeper.lua) \ No newline at end of file diff --git a/assets/scene/initial.lua b/assets/scene/initial.lua deleted file mode 100644 index d029c63..0000000 --- a/assets/scene/initial.lua +++ /dev/null @@ -1,43 +0,0 @@ -module('spritebatch') -module('camera') -module('color') -module('text') -module('screen') -module('time') -module('glm') - -screenSetBackground(colorBlack()) -camera = cameraCreate(CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC) - -text = "Hello World" - -function sceneDispose() -end - -function sceneUpdate() -end - -function sceneRender() - -- UI Test - cameraPushMatrix(camera) - camera.bottom = screenGetHeight() - camera.right = screenGetWidth() - - width, height = textMeasure(text) - x = (screenGetWidth() - width) - x = math.sin(TIME.time * 2) * (x / 2) + (x / 2) - y = (screenGetHeight() - height) / 2 - y = math.cos(TIME.time * 3) * (y) + (y) - - -- For each letter - for i = 1, #text do - letter = text:sub(i, i) - letterWidth, _ = textMeasure(letter) - - -- Draw letter with rainbow color - textDraw(x, y, letter, colorRainbow((i - 1) * 0.1, 8)) - x = x + letterWidth - end - - cameraPopMatrix() -end \ No newline at end of file diff --git a/assets/tileset/prarie.png b/assets/tileset/prarie.png deleted file mode 100644 index 324cdd09d8cb1b4929f7ce648f19ad4458cc1977..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 758 zcmVPx%ut`KgRCt{2oIP@bFc5_w424UMpwfp)nIc6FkR!NA>4Jl#NRcv!N$De`Oy?9q zuu_ot@fx&?zL|_XM8Jl}uJ%F31zvDP4d5H-Mzo`8N4u>?kKOi;0*d%}#r59jcs%o6 zvkE{jhR>xP4f!0KFPxvR(`@lR-x@qTpXQzC8P~(HVG*$e&DM_-_!?KRwt6wVUy zQlR=L)>wAgGHXlj2um)Ey*oqu9*#|6e>au^V|V(;E3R`hhyxq{t(o{&LJiy!Y1)yl zhgLW{FCyL?(S`*0`8q{Q%$(!Xxm;x{CCW~`8h^rtGOQ*elXx-iQPQNA$rx299^hsn z;C7!Ez!5u>1Z5`%%{T)$DowqAT3d!Zw+gpoKPRO zhVPpi%MvPQ%>&$wGw4g^1$}b^Ov=Dpy1OO*YV!W){^knJx$F4@u`Ho-N~j%&8W{t3 zjif?nHlqxhb6+6(*?6NMv{{L=`!w{N)6Y(8HNL&=LeM52Kp&+Ic|KZ3#~!x{K%);V zoopHsrS?Vy=0V0Cu1&-;`eeoTi1rmzCK*^WW@}G16 zQ+*#uo0(A6SS$Wp8>`)|f!f%WjR0iCI0yC&ly-p*$EKh^Yo3?mIP3zZ-if9VpB0Zo z#9i8mP@GcYr|hzc*|N-YpL_Q{P&#+>fm7MSFG_2)V(hYnYJyEbNezIcSjWg2D4Z;y zaI%2H$pQ+8t(}(Q0fFoTgGhWID4kqFg_8vo4%@%h18!+bZB5ivHYuz9QK4@pihUbX o>^OFgzrR+Y#GvUhS0*#cFXX^M?6Ie02mk;807*qoM6N<$f>V`Pq5uE@ diff --git a/assets/tileset/prarie.pxo b/assets/tileset/prarie.pxo deleted file mode 100644 index 34d9b812c8f176bb3d4f8494c1ad3e6256d0c214..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1314 zcmWIWW@Zs#VBp|junIGZmSWqzav~!GgC{cs11AFmLrP*vqFz>UeqQUOyLpEUcv|CG zpJq+wiV`rml72(lCpaZa+~$&sSJ1Vlitm<7pSt_p@||k+?c>ikbB-J{Pi%L5GCzK% z#+q$$SGT!L)c?8tqnvNZ)b?4*`P)0%_-f@3UW+`hxg;?3+I4~XhnB4uJJ+l(GINE@ z_UN+~tHu5H`Y&>*wY(y+u!Td(ey(w%tcZy9#M4vmPk5!f>DFm!b~XO_;n(c6j8wP1 zd3eSq^|9h4Q|F(1OLpBe3+a1dd-3Q&x5b+6nks3&=O*4SM7wm zF`vmX3n%NWiB}h}l_vbE3worGUbJma8;586^I+D#Gh**IZ=IvR)9O&!h0d40 zOW&>t%T);2(PekPiq(PQenoy$~JDw(**wqfB0Z~jNGzQ6v%9e@&V z7u@e1U}FMCSO^1yG?2>7O-xUX2gRO#T2W$dYO%hdeokU#YEiu5+Zlm*%?3PemTK-N z1S@V#EL$L(nxEt0%sbCnh~wwmFaMXUSY)#HV|e=vO`q3W{`CDQl`bx^`QNK>EibclSbx$}BJynP)OgJ?E%OvUU zf}aj?Ma7Sccm8?$X!orDyZ_CqoZ|N_dFM2*{pw$@Kl`eR0pND^(uDm>NBWwJ>EvMxV&A&7KM3uK~a`7|&)6=W#)4%Vzv+v82`VFuApPkve ze~$jm-Rbk{FU6N;xL?*u zH|I~&2U2(EpOO5#*CEFK?^fo!-W&h#X5Y2W>-q8|w Jq^(&%JOIM1O<({3 diff --git a/assets/tileset/prarie.tsx b/assets/tileset/prarie.tsx deleted file mode 100644 index dfaa242..0000000 --- a/assets/tileset/prarie.tsx +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/asset/asset.c b/src/asset/asset.c index aa03e7a..877353c 100644 --- a/src/asset/asset.c +++ b/src/asset/asset.c @@ -232,6 +232,20 @@ errorret_t assetLoad(const char_t *filename, void *output) { assertStrLenMax(filename, FILENAME_MAX, "Filename too long."); assertNotNull(output, "Output pointer cannot be NULL."); + // Determine the asset type by reading the extension + const assettypedef_t *def = NULL; + for(uint_fast8_t i = 0; i < ASSET_TYPE_COUNT; i++) { + const assettypedef_t *cmp = &ASSET_TYPE_DEFINITIONS[i]; + assertNotNull(cmp, "Asset type definition cannot be NULL."); + assertNotNull(cmp->extension, "Asset type definition has NULL extension."); + if(!stringEndsWithCaseInsensitive(filename, cmp->extension)) continue; + def = cmp; + break; + } + if(def == NULL) { + errorThrow("Unknown asset type for file: %s", filename); + } + // Get file size of the asset. zip_stat_t st; zip_stat_init(&st); @@ -241,8 +255,8 @@ errorret_t assetLoad(const char_t *filename, void *output) { // Minimum file size. zip_int64_t fileSize = (zip_int64_t)st.size; - if(fileSize < sizeof(assetheader_t)) { - errorThrow("Asset file too small to contain header: %s", filename); + if(fileSize <= 0) { + errorThrow("Asset file is empty: %s", filename); } // Try to open the file @@ -250,61 +264,19 @@ errorret_t assetLoad(const char_t *filename, void *output) { if(file == NULL) { errorThrow("Failed to open asset file: %s", filename); } - - // Read the header. - zip_int64_t bytesRemaining = fileSize; - assetheader_t header; - memoryZero(&header, sizeof(assetheader_t)); - zip_int64_t bytesRead = zip_fread( - file, - &header, - (zip_uint64_t)sizeof(assetheader_t) - ); - if((size_t)bytesRead != sizeof(assetheader_t)) { - zip_fclose(file); - errorThrow("Failed to read asset header for: %s", filename); - } - bytesRemaining -= (zip_uint64_t)bytesRead; - assertTrue(sizeof(assetheader_t) == ASSET_HEADER_SIZE, "Asset header size mismatch."); - assertTrue(bytesRead == ASSET_HEADER_SIZE, "Asset header read size mismatch."); - - // Find the asset type based on the header - const assettypedef_t *def = NULL; - for(uint_fast8_t i = 0; i < ASSET_TYPE_COUNT; i++) { - const assettypedef_t *cmp = &ASSET_TYPE_DEFINITIONS[i]; - if(cmp->header == NULL) continue; - - // strcmp didn't work because it's a fixed char_t[3] I think, or maybe - // because of the packed struct? - bool_t match = true; - for(size_t h = 0; h < ASSET_HEADER_SIZE; h++) { - if(header.header[h] == cmp->header[h]) continue; - match = false; - break; - } - if(!match) continue; - - def = cmp; - break; - } - if(def == NULL) { - zip_fclose(file); - errorThrow("Unknown asset type for file: %s", filename); - } - - // We found the asset type, now load the asset data + // Load the asset data switch(def->loadStrategy) { case ASSET_LOAD_STRAT_ENTIRE: assertNotNull(def->entire, "Asset load function cannot be NULL."); // Must have more to read - if(bytesRemaining <= 0) { + if(fileSize <= 0) { zip_fclose(file); errorThrow("No data remaining to read for asset: %s", filename); } - if(bytesRemaining > def->dataSize) { + if(fileSize > def->dataSize) { zip_fclose(file); errorThrow( "Asset file has too much data remaining after header: %s", @@ -313,20 +285,20 @@ errorret_t assetLoad(const char_t *filename, void *output) { } // Create space to read the entire asset data - void *data = memoryAllocate(bytesRemaining); + void *data = memoryAllocate(fileSize); if(!data) { zip_fclose(file); errorThrow("Failed to allocate memory for asset data of file: %s", filename); } // Read in the asset data. - bytesRead = zip_fread(file, data, bytesRemaining); - if(bytesRead == 0 || bytesRead > bytesRemaining) { + zip_int64_t bytesRead = zip_fread(file, data, fileSize); + if(bytesRead == 0 || bytesRead > fileSize) { memoryFree(data); zip_fclose(file); errorThrow("Failed to read asset data for file: %s", filename); } - bytesRemaining -= bytesRead; + fileSize -= bytesRead; // Close the file now we have the data zip_fclose(file); diff --git a/src/asset/asset.h b/src/asset/asset.h index fbcd8ec..b786952 100644 --- a/src/asset/asset.h +++ b/src/asset/asset.h @@ -72,12 +72,6 @@ static const char_t *ASSET_SEARCH_PATHS[] = { NULL }; -#pragma pack(push, 1) -typedef struct { - char_t header[ASSET_HEADER_SIZE]; -} assetheader_t; -#pragma pack(pop) - typedef struct { zip_t *zip; char_t systemPath[FILENAME_MAX]; diff --git a/src/asset/assettype.h b/src/asset/assettype.h index c7cbcc9..91de6d2 100644 --- a/src/asset/assettype.h +++ b/src/asset/assettype.h @@ -6,8 +6,7 @@ */ #pragma once -#include "type/assetpaletteimage.h" -#include "type/assetalphaimage.h" +#include "type/assettexture.h" #include "type/assetlanguage.h" #include "type/assetscript.h" #include "type/assetmap.h" @@ -17,8 +16,7 @@ typedef enum { ASSET_TYPE_NULL, - ASSET_TYPE_PALETTE_IMAGE, - ASSET_TYPE_ALPHA_IMAGE, + ASSET_TYPE_TEXTURE, ASSET_TYPE_LANGUAGE, ASSET_TYPE_SCRIPT, ASSET_TYPE_MAP, @@ -38,7 +36,7 @@ typedef struct assetcustom_s { } assetcustom_t; typedef struct { - const char_t *header; + const char_t *extension; const size_t dataSize; const assetloadstrat_t loadStrategy; union { @@ -52,41 +50,34 @@ static const assettypedef_t ASSET_TYPE_DEFINITIONS[ASSET_TYPE_COUNT] = { 0 }, - [ASSET_TYPE_PALETTE_IMAGE] = { - .header = "DPI", + [ASSET_TYPE_TEXTURE] = { + .extension = "dpt", .loadStrategy = ASSET_LOAD_STRAT_ENTIRE, - .dataSize = sizeof(assetpaletteimage_t), - .entire = assetPaletteImageLoad - }, - - [ASSET_TYPE_ALPHA_IMAGE] = { - .header = "DAI", - .loadStrategy = ASSET_LOAD_STRAT_ENTIRE, - .dataSize = sizeof(assetalphaimage_t), - .entire = assetAlphaImageLoad + .dataSize = sizeof(assettexture_t), + .entire = assetTextureLoad }, [ASSET_TYPE_LANGUAGE] = { - .header = "DLF", + .extension = "DLF", .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, .custom = assetLanguageHandler }, [ASSET_TYPE_SCRIPT] = { - .header = "DSF", + .extension = "lua", .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, .custom = assetScriptHandler }, - [ASSET_TYPE_MAP] = { - .header = "DMF", - .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, - .custom = assetMapHandler - }, + // [ASSET_TYPE_MAP] = { + // .extension = "DMF", + // .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, + // .custom = assetMapHandler + // }, - [ASSET_TYPE_MAP_CHUNK] = { - .header = "DMC", - .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, - .custom = assetMapChunkHandler - }, + // [ASSET_TYPE_MAP_CHUNK] = { + // .extension = "DMC", + // .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, + // .custom = assetMapChunkHandler + // }, }; \ No newline at end of file diff --git a/src/asset/type/CMakeLists.txt b/src/asset/type/CMakeLists.txt index 32eb64a..b43aa18 100644 --- a/src/asset/type/CMakeLists.txt +++ b/src/asset/type/CMakeLists.txt @@ -6,8 +6,7 @@ # Sources target_sources(${DUSK_LIBRARY_TARGET_NAME} PUBLIC - assetalphaimage.c - assetpaletteimage.c + assettexture.c assetlanguage.c assetscript.c assetmap.c diff --git a/src/asset/type/assetalphaimage.c b/src/asset/type/assetalphaimage.c deleted file mode 100644 index bdf80d6..0000000 --- a/src/asset/type/assetalphaimage.c +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2025 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#include "assetalphaimage.h" -#include "assert/assert.h" -#include "display/texture.h" - -#include "debug/debug.h" - -errorret_t assetAlphaImageLoad(void *data, void *output) { - assertNotNull(data, "Data pointer cannot be NULL."); - assertNotNull(output, "Output pointer cannot be NULL."); - - assetalphaimage_t *dataPtr = (assetalphaimage_t *)data; - texture_t *outputPtr = (texture_t *)output; - - // Fix endian - dataPtr->width = le32toh(dataPtr->width); - dataPtr->height = le32toh(dataPtr->height); - - textureInit( - outputPtr, - dataPtr->width, - dataPtr->height, - TEXTURE_FORMAT_ALPHA, - (texturedata_t){ .alpha = { .data = dataPtr->pixels } } - ); - - errorOk(); -} \ No newline at end of file diff --git a/src/asset/type/assetalphaimage.h b/src/asset/type/assetalphaimage.h deleted file mode 100644 index c197c82..0000000 --- a/src/asset/type/assetalphaimage.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2025 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -#include "error/error.h" - -#define ASSET_ALPHA_IMAGE_WIDTH_MAX 256 -#define ASSET_ALPHA_IMAGE_HEIGHT_MAX 256 -#define ASSET_ALPHA_IMAGE_SIZE_MAX ( \ - ASSET_ALPHA_IMAGE_WIDTH_MAX * ASSET_ALPHA_IMAGE_HEIGHT_MAX \ -) - -#pragma pack(push, 1) -typedef struct { - uint32_t width; - uint32_t height; - uint8_t pixels[ASSET_ALPHA_IMAGE_SIZE_MAX]; -} assetalphaimage_t; -#pragma pack(pop) - -/** - * Loads an alpha image asset from the given asset structure. The asset must - * be of type ASSET_TYPE_ALPHA_IMAGE and must be loaded. - * - * @param asset The asset to load the alpha image from. - * @return An error code. - */ -errorret_t assetAlphaImageLoad(void *data, void *output); \ No newline at end of file diff --git a/src/asset/type/assetlanguage.h b/src/asset/type/assetlanguage.h index 676a6b3..5ece212 100644 --- a/src/asset/type/assetlanguage.h +++ b/src/asset/type/assetlanguage.h @@ -6,7 +6,6 @@ */ #pragma once -#include "locale/language/keys.h" #include "error/error.h" #include "duskdefs.h" #include diff --git a/src/asset/type/assetpaletteimage.h b/src/asset/type/assetpaletteimage.h deleted file mode 100644 index d5d45ae..0000000 --- a/src/asset/type/assetpaletteimage.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2025 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -#include "error/error.h" - -#define ASSET_PALETTE_IMAGE_WIDTH_MAX 256 -#define ASSET_PALETTE_IMAGE_HEIGHT_MAX 256 -#define ASSET_PALETTE_IMAGE_SIZE_MAX ( \ - ASSET_PALETTE_IMAGE_WIDTH_MAX * ASSET_PALETTE_IMAGE_HEIGHT_MAX \ -) - -#pragma pack(push, 1) -typedef struct { - uint32_t width; - uint32_t height; - uint8_t paletteIndex; - uint8_t palette[ASSET_PALETTE_IMAGE_SIZE_MAX]; -} assetpaletteimage_t; -#pragma pack(pop) - -/** - * Loads a palette image asset from the given data pointer into the output - * texture. - * - * @param data Pointer to the raw assetpaletteimage_t data. - * @param output Pointer to the texture_t to load the image into. - * @return An error code. - */ -errorret_t assetPaletteImageLoad(void *data, void *output); \ No newline at end of file diff --git a/src/asset/type/assetpaletteimage.c b/src/asset/type/assettexture.c similarity index 51% rename from src/asset/type/assetpaletteimage.c rename to src/asset/type/assettexture.c index 3baada1..4d8a8c5 100644 --- a/src/asset/type/assetpaletteimage.c +++ b/src/asset/type/assettexture.c @@ -5,37 +5,38 @@ * https://opensource.org/licenses/MIT */ -#include "assetpaletteimage.h" +#include "assettexture.h" #include "assert/assert.h" #include "display/texture.h" -#include "display/palette/palettelist.h" errorret_t assetPaletteImageLoad(void *data, void *output) { assertNotNull(data, "Data pointer cannot be NULL."); assertNotNull(output, "Output pointer cannot be NULL."); - assetpaletteimage_t *assetData = (assetpaletteimage_t *)data; + assettexture_t *assetData = (assettexture_t *)data; texture_t *texture = (texture_t *)output; // Fix endian assetData->width = le32toh(assetData->width); assetData->height = le32toh(assetData->height); - - const palette_t *pal = PALETTE_LIST[assetData->paletteIndex]; - assertNotNull(pal, "Palette index is out of bounds"); - textureInit( - texture, - assetData->width, - assetData->height, - TEXTURE_FORMAT_PALETTE, - (texturedata_t){ - .palette = { - .palette = pal, - .data = assetData->palette - } - } - ); + errorThrow("Hello World\n"); - errorOk(); + // const palette_t *pal = PALETTE_LIST[assetData->paletteIndex]; + // assertNotNull(pal, "Palette index is out of bounds"); + + // textureInit( + // texture, + // assetData->width, + // assetData->height, + // TEXTURE_FORMAT_PALETTE, + // (texturedata_t){ + // .palette = { + // .palette = pal, + // .data = assetData->palette + // } + // } + // ); + + // errorOk(); } \ No newline at end of file diff --git a/src/asset/type/assettexture.h b/src/asset/type/assettexture.h new file mode 100644 index 0000000..68bfa43 --- /dev/null +++ b/src/asset/type/assettexture.h @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "error/error.h" + +#define ASSET_TEXTURE_WIDTH_MAX 256 +#define ASSET_TEXTURE_HEIGHT_MAX 256 +#define ASSET_TEXTURE_SIZE_MAX ( \ + ASSET_TEXTURE_WIDTH_MAX * ASSET_TEXTURE_HEIGHT_MAX \ +) + +#pragma pack(push, 1) +typedef struct { + uint32_t width; + uint32_t height; + uint8_t paletteIndex; + uint8_t palette[ASSET_TEXTURE_SIZE_MAX]; +} assettexture_t; +#pragma pack(pop) + +/** + * Loads a palettized texture from the given data pointer into the output + * texture. + * + * @param data Pointer to the raw assettexture_t data. + * @param output Pointer to the texture_t to load the image into. + * @return An error code. + */ +errorret_t assetTextureLoad(void *data, void *output); \ No newline at end of file diff --git a/src/display/palette/CMakeLists.txt b/src/display/palette/CMakeLists.txt index 0b31e39..be5f8fb 100644 --- a/src/display/palette/CMakeLists.txt +++ b/src/display/palette/CMakeLists.txt @@ -6,4 +6,5 @@ # Sources target_sources(${DUSK_LIBRARY_TARGET_NAME} PUBLIC + palette.c ) \ No newline at end of file diff --git a/src/display/palette/palette.c b/src/display/palette/palette.c new file mode 100644 index 0000000..288a243 --- /dev/null +++ b/src/display/palette/palette.c @@ -0,0 +1,8 @@ +/** + * Copyright (c) 2026 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "palette.h" \ No newline at end of file diff --git a/src/display/palette/palette.h b/src/display/palette/palette.h index ecce9e8..fe8a594 100644 --- a/src/display/palette/palette.h +++ b/src/display/palette/palette.h @@ -8,7 +8,11 @@ #pragma once #include "display/color.h" +#define PALETTE_COUNT 4 + typedef struct { const uint8_t colorCount; const color_t *colors; -} palette_t; \ No newline at end of file +} palette_t; + +extern palette_t PALETTES[PALETTE_COUNT]; \ No newline at end of file diff --git a/src/display/text.c b/src/display/text.c index d1a0f5a..9e6d5fa 100644 --- a/src/display/text.c +++ b/src/display/text.c @@ -12,14 +12,15 @@ #include "asset/asset.h" texture_t DEFAULT_FONT_TEXTURE; +tileset_t DEFAULT_FONT_TILESET; errorret_t textInit(void) { - errorChain(assetLoad(DEFAULT_FONT_TILESET.image, &DEFAULT_FONT_TEXTURE)); + // errorChain(assetLoad(DEFAULT_FONT_TILESET.image, &DEFAULT_FONT_TEXTURE)); errorOk(); } void textDispose(void) { - textureDispose(&DEFAULT_FONT_TEXTURE); + // textureDispose(&DEFAULT_FONT_TEXTURE); } void textDrawChar( diff --git a/src/display/text.h b/src/display/text.h index cfdddc8..4f622ed 100644 --- a/src/display/text.h +++ b/src/display/text.h @@ -9,12 +9,11 @@ #include "asset/asset.h" #include "display/texture.h" #include "display/tileset/tileset.h" -#include "display/tileset/tileset_minogram.h" #define TEXT_CHAR_START '!' -extern texture_t DEFAULT_FONT_TEXTURE; -#define DEFAULT_FONT_TILESET TILESET_MINOGRAM +// extern texture_t DEFAULT_FONT_TEXTURE; +// #define DEFAULT_FONT_TILESET TILESET_MINOGRAM /** * Initializes the text system. diff --git a/src/display/texture.c b/src/display/texture.c index 03d6a02..f368a2a 100644 --- a/src/display/texture.c +++ b/src/display/texture.c @@ -10,7 +10,6 @@ #include "util/memory.h" #include "util/math.h" #include "util/string.h" -#include "display/palette/palettelist.h" #include "debug/debug.h" const texture_t *TEXTURE_BOUND = NULL; diff --git a/src/display/tileset/tileset.c b/src/display/tileset/tileset.c index de618e7..a4c782f 100644 --- a/src/display/tileset/tileset.c +++ b/src/display/tileset/tileset.c @@ -6,7 +6,6 @@ */ #include "tileset.h" -#include "display/tileset/tilesetlist.h" #include "assert/assert.h" #include "util/string.h" @@ -34,13 +33,4 @@ void tilesetPositionGetUV( outUV[1] = ((float_t)row) * tileset->uv[1]; outUV[2] = outUV[0] + tileset->uv[0]; outUV[3] = outUV[1] + tileset->uv[1]; -} - -const tileset_t * tilesetGetByName(const char_t *name) { - assertStrLenMin(name, 1, "Tileset name cannot be empty"); - for(uint32_t i = 0; i < TILESET_LIST_COUNT; i++) { - if(stringCompare(TILESET_LIST[i]->name, name) != 0) continue; - return TILESET_LIST[i]; - } - return NULL; } \ No newline at end of file diff --git a/src/display/tileset/tileset.h b/src/display/tileset/tileset.h index d8ffce6..01e3405 100644 --- a/src/display/tileset/tileset.h +++ b/src/display/tileset/tileset.h @@ -45,12 +45,4 @@ void tilesetPositionGetUV( const uint16_t column, const uint16_t row, vec4 outUV -); - -/** - * Gets a tileset by its name. - * - * @param name The name of the tileset to get. - * @return The tileset with the given name, or NULL if not found. - */ -const tileset_t* tilesetGetByName(const char_t *name); \ No newline at end of file +); \ No newline at end of file diff --git a/src/locale/locale.h b/src/locale/locale.h new file mode 100644 index 0000000..2b1ac0d --- /dev/null +++ b/src/locale/locale.h @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2026 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dusk.h" + +typedef struct { + void *nothing; +} dusklocale_t; \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 72d1f95..fc27de7 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -4,14 +4,4 @@ # https://opensource.org/licenses/MIT add_subdirectory(run_python) -add_subdirectory(env_to_h) - -# Function that adds an asset to be compiled -function(add_asset ASSET_TYPE ASSET_PATH) - set(FULL_ASSET_PATH "${CMAKE_CURRENT_LIST_DIR}/${ASSET_PATH}") - string(JOIN "%" ASSETS_ARGS ${ARGN}) - list(APPEND DUSK_ASSETS - "${ASSET_TYPE}#${FULL_ASSET_PATH}#${ASSETS_ARGS}" - ) - set(DUSK_ASSETS ${DUSK_ASSETS} CACHE INTERNAL ${DUSK_CACHE_TARGET}) -endfunction() \ No newline at end of file +add_subdirectory(env_to_h) \ No newline at end of file diff --git a/tools/display/color/csv/__main__.py b/tools/display/color/csv/__main__.py index 1536334..7a97686 100644 --- a/tools/display/color/csv/__main__.py +++ b/tools/display/color/csv/__main__.py @@ -1,7 +1,6 @@ import argparse import os import csv -from tools.util.type import detectType, stringToCType, typeToCType parser = argparse.ArgumentParser(description="Color CSV to .h defines") parser.add_argument("--csv", required=True, help="Path to color CSV file") diff --git a/tools/input/csv/__main__.py b/tools/input/csv/__main__.py index 5e954b8..f10f9d6 100644 --- a/tools/input/csv/__main__.py +++ b/tools/input/csv/__main__.py @@ -1,7 +1,6 @@ import argparse import os import csv -from tools.util.type import detectType, stringToCType, typeToCType parser = argparse.ArgumentParser(description="Input CSV to .h defines") parser.add_argument("--csv", required=True, help="Path to Input CSV file") diff --git a/tools/item/csv/__main__.py b/tools/item/csv/__main__.py index bf2dffe..f065aec 100644 --- a/tools/item/csv/__main__.py +++ b/tools/item/csv/__main__.py @@ -1,7 +1,6 @@ import argparse import os import csv -from tools.util.type import detectType, stringToCType, typeToCType parser = argparse.ArgumentParser(description="Item CSV to .h defines") parser.add_argument("--csv", required=True, help="Path to item CSV file") diff --git a/tools/palette-indexer.html b/tools/palette-indexer.html new file mode 100644 index 0000000..06e97ec --- /dev/null +++ b/tools/palette-indexer.html @@ -0,0 +1,698 @@ + + + + + + Dusk Tools / Palette Indexer + + + + + +

Dusk Palette Indexer

+

+ This tool takes an input image and creates a palettized version of it. + You will get two files, a .dpf (Dusk Palette File) and a .dpt + (Dusk Palettized Texture). The first being the palette, which I recommend + reusing across multiple images, and the second being the indexed image, + which uses the colors from the palette. +

+

+ Also, dusk previously supported Alpha textures, but due to so many little + platform differences I realized it is simpler and about as much work to + get palettized textures working instead. As a result I suggest creating a + single palette for your alpha textures, and reusing that globally. +

+ +
+

Input Image

+
+ +
+

+ +
+ +
+

Palette

+
+ + + + +
+ +
+
+ +
+ +
+ + +
+

Palette Preview

+ +

Palette

+
+ +
+ +

+ +

Indexed Image

+
+ +
+
+
+ +
+ +
+ + + + \ No newline at end of file diff --git a/tools/story/csv/__main__.py b/tools/story/csv/__main__.py index a230ccd..e99e3b4 100644 --- a/tools/story/csv/__main__.py +++ b/tools/story/csv/__main__.py @@ -1,7 +1,6 @@ import argparse import os import csv -from tools.util.type import detectType, stringToCType, typeToCType parser = argparse.ArgumentParser(description="Story CSV to .h defines") parser.add_argument("--csv", required=True, help="Path to story CSV file") diff --git a/tools/tile-joiner.html b/tools/tile-joiner.html new file mode 100644 index 0000000..adb303f --- /dev/null +++ b/tools/tile-joiner.html @@ -0,0 +1,223 @@ + + + + + + Dusk Tools / Tile Joiner + + + + + +

Dusk Tile Joiner

+

+ Joins multiple tiles together into a single tileset image. Optimizing and + allowing it to work on multiple platforms. Output width and height will + always be a power of two. This tool will take a while to process images, + since all images need to be loaded into memory. +

+ +
+
+ +
+

+ +
+ +
+

Settings

+ +
+ +
+
+ +
+

Joined Preview

+
+ +
+ +
+ + + + \ No newline at end of file diff --git a/tools/tile-slicer.html b/tools/tile-slicer.html new file mode 100644 index 0000000..dcc6247 --- /dev/null +++ b/tools/tile-slicer.html @@ -0,0 +1,391 @@ + + + + + + Dusk Tools / Tile Slicer + + + + + +

Dusk Tile Slicer

+

+ Tool allows you to take a single image and slice it into individual tiles. + This should be done as the first step of optimizing tilesets for your + dusk game. +

+ +
+
+ +
+

+ +

Input Preview

+ +
+ +
+

Settings

+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+

Sliced Preview

+
+
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/tools/util/type.py b/tools/util/type.py deleted file mode 100644 index 32dd36a..0000000 --- a/tools/util/type.py +++ /dev/null @@ -1,44 +0,0 @@ -def detectType(value: str) -> str: - val = value.strip() - # Boolean check - if val.lower() in {'true', 'false'}: - return 'Boolean' - - # Int check - try: - int(val) - return 'Int' - except ValueError: - pass - - # Float check - try: - float(val) - return 'Float' - except ValueError: - pass - - # Default to String - return 'String' - -def typeToCType(valType: str) -> str: - if valType == 'Int': - return 'int' - elif valType == 'Float': - return 'float' - elif valType == 'Boolean': - return 'bool' - else: - return 'char_t*' - -def stringToCType(value: str) -> str: - valType = detectType(value) - if valType == 'Int': - return str(int(value)) - elif valType == 'Float': - return str(float(value)) - elif valType == 'Boolean': - return 'true' if value.lower() == 'true' else 'false' - else: - escaped = value.replace('\\', '\\\\').replace('"', '\\"') - return f'"{escaped}"' \ No newline at end of file