switch from png to qoi textures
[fishladder.git] / build.sh
index ab013e2b2371ec28eaa18311d656abe52d0b7a41..a6a260a8ef77d16db94383b991df196187f0b1d9 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -54,6 +54,7 @@ if [ "$compile_tools" = true ]; then
        mkdir tools -p
        gcc -Wall -Wstrict-aliasing=3 $lib $flags mdlcomp.c gl/glad.c -o tools/mdlcomp $libs -Wl,-rpath=./ $defines
        gcc -Wall -Wstrict-aliasing=3 $lib $flags fontcomp.c gl/glad.c -o tools/fontcomp $libs -Wl,-rpath=./ $defines
+       gcc $lib qoiconv.c -std=c99 -O3 -o tools/qoiconv
 fi
 
 # Resources
@@ -65,6 +66,14 @@ if [ "$compile_models" = true ]; then
        done
 fi
 
+# Convert all png to qoi
+echo "Compiling textures"
+mkdir _temp_textures
+for f in textures/*.png;
+       do echo "-> qoi: $f";
+       ./tools/qoiconv $f ./_temp_textures/"$(basename "$f" .png).qoi"
+done
+
 # Main build
 if [ "$do_build" = true ]; then
        gcc -Wall -Wstrict-aliasing=3 $lib $flags $src gl/glad.c -o $target $libs -Wl,-rpath=./ $defines
@@ -86,7 +95,8 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
 
        cp $target ./build.linux/$target
        cp ./steam/libsteam_api.so ./build.linux/libsteam_api.so
-       cp -r ./textures/ ./build.linux/
+       rm -r ./build.linux/textures
+       mv ./_temp_textures/ ./build.linux/textures
        cp -r ./sound/ ./build.linux/
        cp -r ./maps/ ./build.linux/
 
@@ -104,7 +114,8 @@ else
        mkdir build.win32/maps -p
        
        cp $target ./build.win32/$target
-       cp -r ./textures/ ./build.win32/
+       rm -r ./build.win32/textures
+       mv ./_temp_textures/ ./build.win32/textures
        cp -r ./sound/ ./build.win32/
        cp -r ./maps/ ./build.win32/
        cp ./lib/glfw3.dll ./build.win32/glfw3.dll