Asset pipeline for palette-swap
diff --git a/examples/palette-swap/CMakeLists.txt b/examples/palette-swap/CMakeLists.txt index e17dec1..b5d5f62 100644 --- a/examples/palette-swap/CMakeLists.txt +++ b/examples/palette-swap/CMakeLists.txt
@@ -2,3 +2,4 @@ project (palette-swap) include (../../32blit.cmake) blit_executable (palette-swap palette-swap.cpp) +blit_assets_yaml (palette-swap assets.yml) \ No newline at end of file
diff --git a/examples/palette-swap/assets.yml b/examples/palette-swap/assets.yml new file mode 100644 index 0000000..c171625 --- /dev/null +++ b/examples/palette-swap/assets.yml
@@ -0,0 +1,4 @@ +assets.hpp: + assets/boar_ship.png: + palette: assets/boar_ship_palette.png + name: boar_ship \ No newline at end of file
diff --git a/examples/palette-swap/assets/boar_ship.png b/examples/palette-swap/assets/boar_ship.png new file mode 100644 index 0000000..bcbef51 --- /dev/null +++ b/examples/palette-swap/assets/boar_ship.png Binary files differ
diff --git a/examples/palette-swap/assets/boar_ship_palette.png b/examples/palette-swap/assets/boar_ship_palette.png new file mode 100644 index 0000000..bd83684 --- /dev/null +++ b/examples/palette-swap/assets/boar_ship_palette.png Binary files differ
diff --git a/examples/palette-swap/palette-swap.cpp b/examples/palette-swap/palette-swap.cpp index 2325947..494155e 100644 --- a/examples/palette-swap/palette-swap.cpp +++ b/examples/palette-swap/palette-swap.cpp
@@ -1,4 +1,5 @@ #include "palette-swap.hpp" +#include "assets.hpp" #define NUM_PALETTES 4 #define SWATCH_SIZE 29
diff --git a/examples/palette-swap/palette-swap.hpp b/examples/palette-swap/palette-swap.hpp index fc417eb..b4df8bd 100644 --- a/examples/palette-swap/palette-swap.hpp +++ b/examples/palette-swap/palette-swap.hpp
@@ -1,77 +1 @@ #include "32blit.hpp" - - -uint8_t boar_ship[] = { - 0x53, 0x50, 0x52, 0x49, 0x54, 0x45, 0x00, 0x00, // type: sprite - 0x10, 0x03, // payload size (784) - - 0x31, 0x00, // width (49) - 0x20, 0x00, // height (32) - 0x01, 0x00, // cols (1) - 0x01, 0x00, // rows (1) - - 0x02, // format - - 0x09, // number of palette colours -// r g b a - 0x4e, 0xb3, 0xf7, 0x00, - 0x37, 0x3f, 0x75, 0xff, - 0x4b, 0x60, 0xcb, 0xff, - 0xbb, 0xde, 0xf6, 0xff, - 0x57, 0x25, 0x3b, 0xff, - 0x94, 0x35, 0x3d, 0xff, - 0xd5, 0x70, 0x33, 0xff, - 0xf2, 0xb6, 0x3d, 0xff, - 0xf7, 0xce, 0x7b, 0xff, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x87, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, - 0x87, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0x87, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x50, 0x00, 0x08, 0x88, 0x88, - 0x88, 0x77, 0x77, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x05, 0x55, 0x51, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x76, 0x66, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x11, 0x22, 0x22, 0x22, - 0x77, 0x77, 0x77, 0x76, 0x66, 0x65, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x51, 0x12, 0x23, 0x33, 0x22, 0x22, 0x77, 0x77, 0x77, 0x66, 0x66, 0x65, 0x50, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x22, 0x33, 0x33, 0x22, - 0x22, 0x21, 0x77, 0x77, 0x77, 0x66, 0x66, 0x55, 0x07, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x22, 0x33, 0x33, 0x22, 0x22, 0x22, 0x17, 0x77, 0x77, 0x77, 0x66, 0x66, - 0x55, 0x67, 0x87, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x22, 0x33, 0x32, 0x22, - 0x22, 0x22, 0x21, 0x77, 0x77, 0x77, 0x76, 0x66, 0x61, 0x16, 0x77, 0x87, 0x70, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x22, 0x33, 0x22, 0x22, 0x22, 0x22, 0x21, 0x17, 0x77, 0x77, 0x77, 0x76, - 0x61, 0x56, 0x67, 0x78, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x88, 0x74, 0x22, - 0x22, 0x22, 0x21, 0x77, 0x77, 0x77, 0x77, 0x88, 0x71, 0x65, 0x67, 0x77, 0x88, 0x77, 0x00, 0x00, - 0x00, 0x00, 0x07, 0x77, 0x77, 0x67, 0x88, 0x84, 0x22, 0x22, 0x21, 0x77, 0x77, 0x77, 0x78, 0x88, - 0x77, 0x76, 0x57, 0x77, 0x77, 0x87, 0x70, 0x00, 0x00, 0x00, 0x07, 0x67, 0x77, 0x76, 0x67, 0x88, - 0x64, 0x22, 0x22, 0x17, 0x77, 0x77, 0x88, 0x88, 0x77, 0x77, 0x78, 0x77, 0x77, 0x78, 0x87, 0x70, - 0x00, 0x00, 0x07, 0x76, 0x77, 0x76, 0x44, 0x67, 0x86, 0x44, 0x22, 0x17, 0x77, 0x78, 0x88, 0x87, - 0x77, 0x77, 0x77, 0x87, 0x77, 0x77, 0x78, 0x77, 0x00, 0x00, 0x00, 0x76, 0x44, 0x76, 0x44, 0x44, - 0x77, 0x64, 0x12, 0x17, 0x77, 0x78, 0x88, 0x87, 0x77, 0x77, 0x77, 0x87, 0x77, 0x77, 0x77, 0x88, - 0x70, 0x00, 0x00, 0x07, 0x64, 0x77, 0x76, 0x44, 0x47, 0x86, 0x41, 0x17, 0x77, 0x78, 0x66, 0x67, - 0x77, 0x77, 0x77, 0x68, 0x77, 0x77, 0x77, 0x78, 0x87, 0x70, 0x00, 0x00, 0x76, 0x77, 0x77, 0x76, - 0x67, 0x77, 0x64, 0x21, 0x77, 0x76, 0x66, 0x56, 0x66, 0x77, 0x77, 0x76, 0x87, 0x77, 0x77, 0x77, - 0x78, 0x77, 0x03, 0x00, 0x07, 0x76, 0x76, 0x77, 0x76, 0x77, 0x64, 0x12, 0x17, 0x77, 0x65, 0x55, - 0x55, 0x67, 0x77, 0x76, 0x68, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x33, 0x01, 0x17, 0x77, 0x77, - 0x77, 0x33, 0x64, 0x11, 0x12, 0x17, 0x66, 0x54, 0x44, 0x56, 0x77, 0x76, 0x65, 0x87, 0x77, 0x77, - 0x66, 0x66, 0x67, 0x00, 0x33, 0x31, 0x57, 0x77, 0x76, 0x54, 0x34, 0x41, 0x11, 0x21, 0x16, 0x54, - 0x44, 0x46, 0x67, 0x76, 0x66, 0x58, 0x66, 0x66, 0x67, 0x77, 0x77, 0x60, 0x00, 0x33, 0x17, 0x47, - 0x64, 0x76, 0x13, 0x33, 0x41, 0x11, 0x11, 0x65, 0x44, 0x44, 0x67, 0x76, 0x66, 0x50, 0x67, 0x77, - 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x01, 0x74, 0x76, 0x47, 0x61, 0x13, 0x34, 0x11, 0x11, 0x16, - 0x64, 0x44, 0x66, 0x76, 0x66, 0x65, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x07, - 0x17, 0x61, 0x76, 0x11, 0x44, 0x11, 0x11, 0x11, 0x56, 0x66, 0x66, 0x66, 0x66, 0x55, 0x00, 0x77, - 0x77, 0x44, 0x44, 0x44, 0x77, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x15, 0x56, 0x66, 0x66, 0x65, 0x55, 0x00, 0x00, 0x74, 0x44, 0x44, 0x45, 0x55, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x45, 0x55, 0x55, 0x66, 0x66, 0x65, 0x55, 0x50, 0x00, - 0x00, 0x05, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x45, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -
diff --git a/vs/examples/palette-swap/palette-swap.vcxproj b/vs/examples/palette-swap/palette-swap.vcxproj index 73a18fa..305d8ed 100644 --- a/vs/examples/palette-swap/palette-swap.vcxproj +++ b/vs/examples/palette-swap/palette-swap.vcxproj
@@ -71,15 +71,19 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> + <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> + <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> + <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> + <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)</IncludePath> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -96,6 +100,9 @@ <AdditionalDependencies>32blit.lib;32blit-sdl.lib;SDL2.lib;SDL2main.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(OutputPath);$(SolutionDir)sdl\lib\$(PlatformTarget)\</AdditionalLibraryDirectories> </Link> + <PreBuildEvent> + <Command>python -m ttblit pack --force --config $(ProjectDir)..\..\..\examples\palette-swap\assets.yml --output $(ProjectDir)</Command> + </PreBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> @@ -112,6 +119,9 @@ <AdditionalLibraryDirectories>$(OutputPath);$(SolutionDir)sdl\lib\$(PlatformTarget)\</AdditionalLibraryDirectories> <AdditionalDependencies>32blit.lib;32blit-sdl.lib;SDL2.lib;SDL2main.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> + <PreBuildEvent> + <Command>python -m ttblit pack --force --config $(ProjectDir)..\..\..\examples\palette-swap\assets.yml --output $(ProjectDir)</Command> + </PreBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> @@ -132,6 +142,9 @@ <AdditionalLibraryDirectories>$(OutputPath);$(SolutionDir)sdl\lib\$(PlatformTarget)\</AdditionalLibraryDirectories> <AdditionalDependencies>32blit.lib;32blit-sdl.lib;SDL2.lib;SDL2main.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> + <PreBuildEvent> + <Command>python -m ttblit pack --force --config $(ProjectDir)..\..\..\examples\palette-swap\assets.yml --output $(ProjectDir)</Command> + </PreBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> @@ -152,6 +165,9 @@ <AdditionalLibraryDirectories>$(OutputPath);$(SolutionDir)sdl\lib\$(PlatformTarget)\</AdditionalLibraryDirectories> <AdditionalDependencies>32blit.lib;32blit-sdl.lib;SDL2.lib;SDL2main.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> + <PreBuildEvent> + <Command>python -m ttblit pack --force --config $(ProjectDir)..\..\..\examples\palette-swap\assets.yml --output $(ProjectDir)</Command> + </PreBuildEvent> </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="..\..\..\examples\palette-swap\palette-swap.hpp" />