Skip to content
Snippets Groups Projects
Commit 10cba1fc authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '38-normalize-game-architecture' into 'master'

Resolve "Normalize game architecture"

Closes #38

See merge request !36
parents 66d03459 bcd6a446
No related branches found
No related tags found
1 merge request!36Resolve "Normalize game architecture"
Pipeline #5822 passed
...@@ -3,7 +3,7 @@ description: Jeweled Game ...@@ -3,7 +3,7 @@ description: Jeweled Game
publish_to: "none" publish_to: "none"
version: 0.0.31+31 version: 0.1.0+32
environment: environment:
sdk: "^3.0.0" sdk: "^3.0.0"
...@@ -12,6 +12,7 @@ dependencies: ...@@ -12,6 +12,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# base
easy_localization: ^3.0.1 easy_localization: ^3.0.1
equatable: ^2.0.5 equatable: ^2.0.5
flutter_bloc: ^8.1.1 flutter_bloc: ^8.1.1
...@@ -21,13 +22,16 @@ dependencies: ...@@ -21,13 +22,16 @@ dependencies:
path_provider: ^2.0.11 path_provider: ^2.0.11
unicons: ^2.1.1 unicons: ^2.1.1
# specific
# (none)
dev_dependencies: dev_dependencies:
flutter_lints: ^3.0.1 flutter_lints: ^4.0.0
flutter: flutter:
uses-material-design: true uses-material-design: true
assets: assets:
- assets/icons/ - assets/ui/
- assets/translations/ - assets/translations/
fonts: fonts:
...@@ -41,3 +45,4 @@ flutter: ...@@ -41,3 +45,4 @@ flutter:
weight: 400 weight: 400
- asset: assets/fonts/Nunito-Light.ttf - asset: assets/fonts/Nunito-Light.ttf
weight: 300 weight: 300
...@@ -6,7 +6,7 @@ command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not ins ...@@ -6,7 +6,7 @@ command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not ins
command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; } command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; }
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_DIR="$(dirname "${CURRENT_DIR}")" BASE_DIR="$(dirname "$(dirname "${CURRENT_DIR}")")"
SOURCE_ICON="${CURRENT_DIR}/icon.svg" SOURCE_ICON="${CURRENT_DIR}/icon.svg"
SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg" SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg"
......
File moved
File moved
#! /bin/bash
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
${CURRENT_DIR}/app/build_application_resources.sh
${CURRENT_DIR}/ui/build_ui_resources.sh
...@@ -6,7 +6,7 @@ command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not ins ...@@ -6,7 +6,7 @@ command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not ins
command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; } command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; }
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_DIR="$(dirname "${CURRENT_DIR}")" BASE_DIR="$(dirname "$(dirname "${CURRENT_DIR}")")"
ASSETS_DIR="${BASE_DIR}/assets" ASSETS_DIR="${BASE_DIR}/assets"
OPTIPNG_OPTIONS="-preserve -quiet -o7" OPTIPNG_OPTIONS="-preserve -quiet -o7"
...@@ -14,16 +14,23 @@ ICON_SIZE=192 ...@@ -14,16 +14,23 @@ ICON_SIZE=192
####################################################### #######################################################
# Game images # Game images (svg files found in `images` folder)
AVAILABLE_GAME_IMAGES=" AVAILABLE_GAME_IMAGES=""
button_back if [ -d "${CURRENT_DIR}/images" ]; then
button_start AVAILABLE_GAME_IMAGES="$(find "${CURRENT_DIR}/images" -type f -name "*.svg" | awk -F/ '{print $NF}' | cut -d"." -f1 | sort)"
button_resume_game fi
button_delete_saved_game
game_fail # Skins (subfolders found in `skins` folder)
game_win AVAILABLE_SKINS=""
placeholder if [ -d "${CURRENT_DIR}/skins" ]; then
" AVAILABLE_SKINS="$(find "${CURRENT_DIR}/skins" -mindepth 1 -type d | awk -F/ '{print $NF}')"
fi
# Images per skin (svg files found recursively in `skins` folder and subfolders)
SKIN_IMAGES=""
if [ -d "${CURRENT_DIR}/skins" ]; then
SKIN_IMAGES="$(find "${CURRENT_DIR}/skins" -type f -name "*.svg" | awk -F/ '{print $NF}' | cut -d"." -f1 | sort | uniq)"
fi
####################################################### #######################################################
...@@ -45,7 +52,7 @@ function optimize_svg() { ...@@ -45,7 +52,7 @@ function optimize_svg() {
} }
# build icons # build icons
function build_icon() { function build_image() {
SOURCE="$1" SOURCE="$1"
TARGET="$2" TARGET="$2"
...@@ -58,27 +65,46 @@ function build_icon() { ...@@ -58,27 +65,46 @@ function build_icon() {
optimize_svg "${SOURCE}" optimize_svg "${SOURCE}"
mkdir -p "$(dirname "${TARGET}")"
inkscape \ inkscape \
--export-width=${ICON_SIZE} \ --export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \ --export-height=${ICON_SIZE} \
--export-filename=${TARGET} \ --export-filename=${TARGET} \
${SOURCE} "${SOURCE}"
optipng ${OPTIPNG_OPTIONS} ${TARGET} optipng ${OPTIPNG_OPTIONS} "${TARGET}"
} }
####################################################### function build_image_for_skin() {
SKIN_CODE="$1"
# skin images
for SKIN_IMAGE in ${SKIN_IMAGES}
do
build_image ${CURRENT_DIR}/skins/${SKIN_CODE}/${SKIN_IMAGE}.svg ${ASSETS_DIR}/skins/${SKIN_CODE}_${SKIN_IMAGE}.png
done
}
# Create output folders #######################################################
mkdir -p ${ASSETS_DIR}/icons
mkdir -p ${ASSETS_DIR}/skins
# Delete existing generated images # Delete existing generated images
find ${ASSETS_DIR}/icons -type f -name "*.png" -delete if [ -d "${ASSETS_DIR}/ui" ]; then
find ${ASSETS_DIR}/ui -type f -name "*.png" -delete
fi
if [ -d "${ASSETS_DIR}/skins" ]; then
find ${ASSETS_DIR}/skins -type f -name "*.png" -delete find ${ASSETS_DIR}/skins -type f -name "*.png" -delete
fi
# build game images # build game images
for GAME_IMAGE in ${AVAILABLE_GAME_IMAGES} for GAME_IMAGE in ${AVAILABLE_GAME_IMAGES}
do do
build_icon ${CURRENT_DIR}/${GAME_IMAGE}.svg ${ASSETS_DIR}/icons/${GAME_IMAGE}.png build_image ${CURRENT_DIR}/images/${GAME_IMAGE}.svg ${ASSETS_DIR}/ui/${GAME_IMAGE}.png
done done
# build skins images
for SKIN in ${AVAILABLE_SKINS}
do
build_image_for_skin "${SKIN}"
done
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment