diff --git a/Configs/Git/.gitconfig b/Configs/Git/.gitconfig new file mode 100644 index 0000000..fcde201 --- /dev/null +++ b/Configs/Git/.gitconfig @@ -0,0 +1,18 @@ +[color] + ui = auto + +[color "branch"] + current = yellow reverse + local = yellow + remote = green + +[color "diff"] + meta = yellow bold + frag = magenta bold # line info + old = red # deletions + new = green # additions + +[color "status"] + added = yellow + changed = green + untracked = cyan diff --git a/ShellScripts/split-sprites.sh b/ShellScripts/split-sprites.sh new file mode 100755 index 0000000..abec727 --- /dev/null +++ b/ShellScripts/split-sprites.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Function to display help message +function usage { + echo "Usage: $0 -i image_path [-s width height] [-n columns rows]" + echo " -i image_path : Path to the sprite sheet image" + echo " -s width height : Size of a single sprite (in pixels)" + echo " -n columns rows : Number of columns and rows in the sprite sheet" + exit 1 +} + +# Initialize variables +img_path="" +sprite_width="" +sprite_height="" +columns="" +rows="" + +# Parse command line options +while getopts "i:s:n:" opt; do + case $opt in + i) img_path=$OPTARG ;; + s) + sprite_width=${OPTARG} + sprite_height=${!OPTIND} + OPTIND=$(($OPTIND + 1)) + ;; + n) + columns=${OPTARG} + rows=${!OPTIND} + OPTIND=$(($OPTIND + 1)) + ;; + *) usage ;; + esac +done + +# Ensure image path is provided +if [[ -z "$img_path" ]]; then + echo "Error: Image path is required." + usage +fi + +# Get image dimensions +img_info=$(magick identify "$img_path") +img_width=$(echo "$img_info" | cut -d ' ' -f 3 | cut -d 'x' -f 1) +img_height=$(echo "$img_info" | cut -d ' ' -f 3 | cut -d 'x' -f 2) + +# Calculate sprite width/height from columns/rows, if provided +if [[ -n "$columns" && -n "$rows" ]]; then + sprite_width=$((img_width / columns)) + sprite_height=$((img_height / rows)) +elif [[ -z "$sprite_width" || -z "$sprite_height" ]]; then + echo "Error: Either sprite size (-s) or number of columns and rows (-n) must be specified." + usage +fi + +# Output info +echo "Splitting image $img_path into sprites of size ${sprite_width}x${sprite_height}..." + +# Use ImageMagick to split the sprite sheet +magick convert "$img_path" -crop "${sprite_width}x${sprite_height}" +repage sprite_%d.png + +echo "Sprites successfully split into individual images (sprite_0.png, sprite_1.png, etc.)"