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

Add minimal home page, settings and gameplay

parent 62756e34
No related branches found
No related tags found
1 merge request!2Resolve "Add minimal gameplay"
Pipeline #1363 passed
Showing
with 197 additions and 1 deletion
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; } command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; }
command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not installed. Aborting."; exit 1; } command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour 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; } command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; }
command -v convert >/dev/null 2>&1 || { echo >&2 "I require convert (imagemagick) 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 "${CURRENT_DIR}")"
......
#! /bin/bash
# Check dependencies
command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; }
command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour 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)"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
# optimize svg
function optimize_svg() {
SOURCE="$1"
cp ${SOURCE} ${SOURCE}.tmp
scour \
--remove-descriptive-elements \
--enable-id-stripping \
--enable-viewboxing \
--enable-comment-stripping \
--nindent=4 \
-i ${SOURCE}.tmp \
-o ${SOURCE}
rm ${SOURCE}.tmp
}
# build icons
function build_icon() {
ICON_SIZE=192
SOURCE="$1"
TARGET="$2"
optimize_svg "${SOURCE}"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET} \
${SOURCE}
optipng ${OPTIPNG_OPTIONS} ${TARGET}
}
function build_icon_for_skin() {
SKIN_CODE="$1"
for VALUE in {1..9};
do
build_icon ${CURRENT_DIR}/skins/${SKIN_CODE}/${VALUE}.svg ${BASE_DIR}/assets/skins/${SKIN_CODE}_${VALUE}.png
done
}
# Game icons
build_icon ${CURRENT_DIR}/button_start.svg ${BASE_DIR}/assets/icons/button_start.png
build_icon ${CURRENT_DIR}/difficulty_easy.svg ${BASE_DIR}/assets/icons/difficulty_easy.png
build_icon ${CURRENT_DIR}/difficulty_medium.svg ${BASE_DIR}/assets/icons/difficulty_medium.png
build_icon ${CURRENT_DIR}/difficulty_hard.svg ${BASE_DIR}/assets/icons/difficulty_hard.png
build_icon ${CURRENT_DIR}/size_2.svg ${BASE_DIR}/assets/icons/size_2.png
build_icon ${CURRENT_DIR}/size_3.svg ${BASE_DIR}/assets/icons/size_3.png
build_icon ${CURRENT_DIR}/skin_default.svg ${BASE_DIR}/assets/icons/skin_default.png
build_icon ${CURRENT_DIR}/skins/empty.svg ${BASE_DIR}/assets/skins/empty.png
# Skins
build_icon_for_skin "default"
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="m46.835 0c-25.826 0-46.835 21.009-46.835 46.841 0 25.826 21.009 46.835 46.835 46.835s46.83-21.009 46.83-46.835c0-25.832-21.004-46.841-46.83-46.841zm0 83.709c-20.36 0-36.875-16.508-36.875-36.868 0-20.369 16.515-36.874 36.875-36.874 20.361 0 36.873 16.505 36.873 36.874 0 20.36-16.512 36.868-36.873 36.868z"/><path d="m34.852 25.44c-1.1248-1.1302-4.0012-1.1302-4.0012 0v45.921c0 1.1316 2.8832 1.1316 4.0121 0l37.693-20.918c1.1289-1.1248 1.1479-2.9551 0.02171-4.084z" fill="#479fee" stroke-width="1.3568"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#41ff6a"/><path d="m22.408 52.415 20.8 13.7c0.2 0.1 0.3 0.2 0.5 0.3 1.3 0.5 2.8-0.1 3.3-1.3 0.5-1.3-0.1-2.8-1.3-3.3l-23.2-9.6c-0.2 0-0.3 0.2-0.1 0.2zm23.7 11.6c0.1 0.8-0.5 1.4-1.3 1.5s-1.4-0.5-1.5-1.3 0.5-1.4 1.3-1.5c0.8 0 1.5 0.5 1.5 1.3z"/><path d="m40.708 35.515c0.1 0.4 0.6 0.7 1 0.7 0.9-0.1 1.9-0.1 2.8-0.1 1.5 0 2.9 0.1 4.3 0.3 0.6 0.1 1.2-0.4 1.2-1v-6.9c0-0.6-0.5-1-1-1-3.2 0.1-6.4 0.7-9.3 1.6-0.5 0.2-0.8 0.7-0.6 1.3z"/><path d="m51.508 36.815c2.1 0.5 4.2 1.3 6.2 2.2 0.5 0.3 1.2 0 1.4-0.6l2.7-8.2c0.2-0.5-0.1-1.1-0.6-1.3-3-0.9-6.1-1.5-9.3-1.6-0.6 0-1 0.4-1 1v7.5c-0.1 0.5 0.2 0.9 0.6 1z"/><path d="m80.508 45.115-8.4 6.1c-0.4 0.3-0.5 0.8-0.3 1.3 0.9 1.6 1.6 3.2 2.2 4.9 0.2 0.5 0.7 0.8 1.2 0.6l9.8-3.2c0.5-0.2 0.8-0.7 0.6-1.3-1-2.9-2.3-5.7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2-0.9 0.7-0.7 1.2z"/><path d="m14.808 66.115c0.1-3.2 0.7-6.3 1.7-9.2 0.2-0.5-0.1-1.1-0.6-1.3l-0.4-0.1c-0.5-0.2-1.1 0.1-1.3 0.7-0.8 3.2-1.3 6.5-1.3 9.9z"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#d31158"/><path d="m68.154 58.254-24.4 5.1c-0.2 0-0.4 0.1-0.5 0.1-1.3 0.6-1.9 2-1.4 3.3 0.6 1.3 2 1.9 3.3 1.4l23-9.7c0.2 0 0.1-0.2 0-0.2zm-25 8.7c-0.6-0.5-0.6-1.4-0.1-2s1.4-0.6 2-0.1 0.6 1.4 0.1 2c-0.5 0.5-1.4 0.6-2 0.1z"/><path d="m40.054 37.354c0.1 0.4 0.6 0.7 1 0.7 0.9-0.1 1.9-0.1 2.8-0.1 1.5 0 2.9 0.1 4.3 0.3 0.6 0.1 1.2-0.4 1.2-1v-6.9c0-0.6-0.5-1-1-1-3.2 0.1-6.4 0.7-9.3 1.6-0.5 0.2-0.8 0.7-0.6 1.3z"/><path d="m50.854 38.754c2.1 0.5 4.2 1.3 6.2 2.2 0.5 0.3 1.2 0 1.4-0.6l2.7-8.2c0.2-0.5-0.1-1.1-0.6-1.3-3-0.9-6.1-1.5-9.3-1.6-0.6 0-1 0.4-1 1v7.5c-0.2 0.5 0.1 0.9 0.6 1z"/><path d="m81.754 45.554-12.2 8.9c-0.4 0.3-0.5 0.8-0.3 1.3 0.9 1.6 1.2 2.6 1.8 4.3 0.2 0.5 0.7 0.8 1.2 0.6l14.4-4.7c0.5-0.2 0.8-0.7 0.6-1.3-1-2.9-2.6-6.4-4.1-8.9-0.3-0.5-1-0.6-1.4-0.2z"/><path d="m31.154 40.854c2.3-1.1 4.7-2 7.2-2.5 0.6-0.1 1-0.7 0.8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.3-0.1c-0.5-0.2-1.1 0.1-1.3 0.7-0.8 3.2-1.3 6.5-1.3 9.9z"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#eeb517"/><path d="m52.928 42.009-11 21.7c-0.1 0.2-0.1 0.3-0.2 0.5-0.4 1.4 0.4 2.7 1.7 3.2 1.4 0.4 2.7-0.4 3.2-1.7l6.6-23.7c0-0.1-0.2-0.2-0.3 0zm-8.5 24.3c-0.8 0.1-1.5-0.4-1.6-1.1-0.1-0.8 0.4-1.5 1.1-1.6 0.8-0.1 1.5 0.4 1.6 1.1 0.1 0.8-0.4 1.5-1.1 1.6z"/><path d="m40.128 36.409c0.1 0.4 0.6 0.7 1 0.7 0.9-0.1 1.9-0.1 2.8-0.1 1.5 0 2.9 0.1 4.3 0.3 0.6 0.1 1.2-0.4 1.2-1v-6.9c0-0.6-0.5-1-1-1-3.2 0.1-6.4 0.7-9.3 1.6-0.5 0.2-0.8 0.7-0.6 1.3z"/><path d="m50.928 40.209c2.1 0.5 3.5 1 5.5 2 0.5 0.3 1.2 0 1.4-0.6l4.2-12.8c0.2-0.5-0.1-1.1-0.6-1.3-3-0.9-6.9-1.5-10.1-1.7-0.6 0-1 0.4-1 1v12.4c-0.1 0.5 0.2 0.9 0.6 1z"/><path d="m79.928 46.009-8.4 6.1c-0.4 0.3-0.5 0.8-0.3 1.3 0.9 1.6 1.6 3.2 2.2 4.9 0.2 0.5 0.7 0.8 1.2 0.6l9.8-3.2c0.5-0.2 0.8-0.7 0.6-1.3-1-2.9-2.3-5.7-3.8-8.2-0.2-0.4-0.9-0.5-1.3-0.2z"/><path d="m31.328 39.909c2.3-1.1 4.7-2 7.2-2.5 0.6-0.1 1-0.7 0.8-1.3l-1.5-4.7c-0.2-0.5-0.8-0.8-1.3-0.6-2.9 1.2-5.7 2.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 9.9z"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#6afffe"/><path d="m8.016 8.1944v83.701h83.701v-83.701zm60.683 60.683h-14.648v-14.648h14.648zm0 4.185v14.648h-14.648v-14.648zm4.185 0h14.648v14.648h-14.648zm0-4.185v-14.648h14.648v14.648zm0-23.018v-14.648h14.648v14.648zm-4.185 0h-14.648v-14.648h14.648zm-23.018 0h-14.648v-14.648h14.648zm0 8.3701v14.648h-14.648v-14.648zm0 18.833v14.648h-14.648v-14.648zm41.85-46.035h-14.648v-14.648h14.648zm-18.833-14.648v14.648h-14.648v-14.648zm-23.018 14.648h-14.648v-14.648h14.648zm-33.48-14.648h14.648v14.648h-14.648zm0 18.833h14.648v14.648h-14.648zm0 23.018h14.648v14.648h-14.648zm0 18.833h14.648v14.648h-14.648z" stroke-width="2.0925"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#6afffe"/><path d="m65.824 4.0024h-62v90h90v-90zm9 79v-8h8v8zm8 2v7h-8v-7zm-38-2v-8h8v8zm8 2v7h-8v-7zm-38-2v-8h8v8zm8 2v7h-8v-7zm0-70v8h-8v-8zm-8-2v-7h8v7zm38 2v8h-8v-8zm-8-2v-7h8v7zm0 30v-7h8v7zm8 2v8h-8v-8zm-10-2h-7v-7h7zm0 2v8h-7v-8zm0 10v7h-7v-7zm2 0h8v7h-8zm10 0h7v7h-7zm0-2v-8h7v8zm0-10v-7h7v7zm0-11v-7h7v7zm-2 0h-8v-7h8zm-10 0h-7v-7h7zm-11 0h-7v-7h7zm0 4v7h-7v-7zm0 9v8h-7v-8zm0 10v7h-7v-7zm0 11v7h-7v-7zm4 0h7v7h-7zm9 0h8v7h-8zm10 0h7v7h-7zm11 0h7v7h-7zm0-4v-7h7v7zm0-9v-8h7v8zm0-10v-7h7v7zm0-11v-7h7v7zm0-9v-8h7v8zm-4 0h-7v-8h7zm-19 0h-7v-8h7zm-11 0h-7v-8h7zm-9 2v7h-8v-7zm0 11v7h-8v-7zm0 9v8h-8v-8zm0 10v7h-8v-7zm0 11v7h-8v-7zm2 9h7v8h-7zm11 0h7v8h-7zm19 0h7v8h-7zm11 0h7v8h-7zm9-2v-7h8v7zm0-11v-7h8v7zm0-9v-8h8v8zm0-10v-7h8v7zm0-11v-7h8v7zm0-9v-8h8v8zm0-10v-7h8v7zm-2-7v7h-7v-7zm-11 7h-7v-7h7zm-19-7v7h-7v-7zm-11 7h-7v-7h7zm-26-7h7v7h-7zm0 9h7v8h-7zm0 10h7v7h-7zm0 11h7v7h-7zm0 9h7v8h-7zm0 10h7v7h-7zm0 11h7v7h-7zm0 9h7v8h-7zm0 10h7v7h-7zm19 7v-7h7v7zm11-7h7v7h-7zm19 7v-7h7v7zm11-7h7v7h-7zm26 7h-7v-7h7zm0-9h-7v-8h7zm0-10h-7v-7h7zm0-11h-7v-7h7zm0-9h-7v-8h7zm0-10h-7v-7h7zm0-11h-7v-7h7zm0-9h-7v-8h7zm-7-10v-7h7v7z"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#f3ff6a"/><path class="st0" d="m56.096 53.176 26.479-4.2576c2.3483-0.37629 4.5851 1.2404 4.9614 3.5887l3.8395 23.859c0.37628 2.3483-1.2404 4.5851-3.5887 4.9614l-26.479 4.2576c-2.3483 0.37629-4.5851-1.2404-4.9614-3.5887l-3.8395-23.859c-0.37629-2.3483 1.2404-4.5851 3.5887-4.9614zm13.567 11.198-5.1217-0.05575c0.1533-1.6515 0.73864-2.9964 1.7769-4.0416 1.0313-1.0383 2.627-1.7421 4.7733-2.0975 2.4737-0.41113 4.3273-0.25086 5.5886 0.48778 1.2543 0.73864 1.9999 1.8048 2.2298 3.1984 0.13937 0.81529 0.03484 1.5957-0.29964 2.3344-0.33448 0.73864-0.90588 1.4285-1.7281 2.0765 0.75954 0.05575 1.3588 0.17421 1.7839 0.35538 0.69683 0.2857 1.2682 0.71076 1.7212 1.2891 0.45294 0.57837 0.75954 1.3031 0.90588 2.1811 0.18118 1.101 0.07665 2.2089-0.33448 3.3239-0.41113 1.108-1.108 2.0278-2.1044 2.7525-0.99646 0.7247-2.3762 1.2404-4.1461 1.533-1.7212 0.2857-3.1148 0.31357-4.174 0.06968-1.0661-0.23692-1.979-0.69683-2.7525-1.3658-0.76651-0.67592-1.4285-1.5748-1.972-2.7037l5.1496-1.5818c0.38326 1.0313 0.82923 1.7142 1.3309 2.0556 0.50172 0.34145 1.0871 0.45294 1.763 0.34145 0.7038-0.11846 1.2473-0.47384 1.6306-1.0731 0.38326-0.5923 0.50172-1.324 0.35538-2.188-0.14633-0.878-0.48778-1.5191-1.0174-1.9302-0.52959-0.40416-1.1846-0.54353-1.9581-0.4181-0.41113 0.06968-0.96162 0.26479-1.6445 0.5923l-0.35538-3.8117c0.29267-7e-3 0.52262-0.0209 0.68289-0.04878 0.68289-0.11149 1.2125-0.43203 1.5957-0.94072 0.38326-0.51565 0.52262-1.0661 0.42506-1.6654-0.09756-0.57837-0.34841-1.0104-0.73864-1.2891-0.40416-0.2857-0.89891-0.38326-1.4982-0.27873-0.62018 0.10452-1.0871 0.36932-1.4146 0.80832-0.32054 0.439-0.47384 1.1358-0.45294 2.0905zm-20.117-45.663 3.2193 19.316-5.3307 0.89194-2.1044-12.633c-0.75258 0.80135-1.4982 1.4633-2.2438 1.9999-0.73864 0.53656-1.6933 1.094-2.8431 1.6654l-0.71773-4.2994c1.7003-0.88497 2.9755-1.8118 3.8326-2.7943 0.8571-0.98253 1.4703-2.1184 1.8327-3.4145zm-31.357 31.748 25.727 7.5815c2.2856 0.67592 3.6026 3.0939 2.9267 5.3795l-6.8289 23.177c-0.67592 2.2856-3.0939 3.6026-5.3795 2.9267l-25.72-7.5745c-2.2856-0.67592-3.6026-3.0939-2.9267-5.3795l6.8289-23.177c0.66896-2.2856 3.087-3.6026 5.3725-2.9336zm18.612 20.229-3.526-0.50172c-0.19511 0.22298-0.41113 0.439-0.64805 0.64108-0.89194 0.76651-2.3135 1.4842-4.2646 2.1462-1.1567 0.37629-1.9302 0.65502-2.3344 0.82226-0.40416 0.17421-0.88497 0.40416-1.4494 0.7038l7.4421 2.202-1.1498 3.8744-14.292-4.2228c0.57837-1.3588 1.4703-2.5434 2.6689-3.5329 1.1985-0.99646 3.1845-2.0069 5.9718-3.0242 0.52959-0.19511 0.99646-0.37629 1.4146-0.55049 0.93375-0.39022 1.5888-0.7247 1.972-1.0174 0.5505-0.42507 0.89891-0.878 1.0383-1.3588 0.1533-0.52262 0.09756-1.0243-0.18118-1.5121-0.27873-0.48778-0.71076-0.81529-1.2961-0.9895-0.60624-0.18118-1.1637-0.1324-1.6585 0.1324-0.50172 0.27176-0.96162 0.87104-1.3797 1.8048l-4.6478-1.7978c0.58534-1.2891 1.2404-2.2299 1.9581-2.8361 0.7247-0.60624 1.5957-0.97556 2.6201-1.108 1.0313-0.1324 2.3413 0.03484 3.951 0.51565 1.6724 0.49475 2.9197 1.0731 3.742 1.7281 0.81529 0.65502 1.3797 1.4564 1.6724 2.4041 0.29964 0.95466 0.3066 1.9163 0.01394 2.8988-0.22995 0.76651-0.61321 1.4564-1.1567 2.0835zm-5.5677-55.614 26.479-4.2576c2.3483-0.37629 4.5851 1.2404 4.9614 3.5887l3.8395 23.859c0.37629 2.3483-1.2404 4.5851-3.5887 4.9614l-26.479 4.2576c-2.3483 0.37629-4.5851-1.2404-4.9614-3.5887l-3.8395-23.859c-0.37629-2.3483 1.2404-4.5851 3.5887-4.9614z" clip-rule="evenodd" fill-rule="evenodd" stroke-width=".69683"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/>
<g stroke-width="2.8975" aria-label="1"><path d="m28.274 82.939h18.675v-64.458l-20.316 4.0746v-10.413l20.203-4.0746h11.432v74.871h18.675v9.6206h-48.669z"/></g>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">2</tspan></text></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">3</tspan></text></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">4</tspan></text></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">5</tspan></text></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">6</tspan></text></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">7</tspan></text></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><g stroke-width="2.8975" aria-label="8"><path d="m50.741 52.436q-8.1492 0-12.846 4.3576-4.6405 4.3576-4.6405 11.997 0 7.6399 4.6405 11.997 4.6971 4.3576 12.846 4.3576t12.846-4.3576q4.6971-4.4142 4.6971-11.997 0-7.6399-4.6971-11.997-4.6405-4.3576-12.846-4.3576zm-11.432-4.8669q-7.3569-1.8109-11.488-6.8476-4.0746-5.0367-4.0746-12.28 0-10.13 7.1872-16.015 7.2438-5.8855 19.807-5.8855 12.62 0 19.807 5.8855 7.1872 5.8855 7.1872 16.015 0 7.2438-4.1312 12.28-4.0746 5.0367-11.375 6.8476 8.2624 1.9241 12.846 7.5267 4.6405 5.6026 4.6405 13.695 0 12.28-7.5267 18.845-7.4701 6.5646-21.448 6.5646t-21.505-6.5646q-7.4701-6.5646-7.4701-18.845 0-8.0926 4.6405-13.695 4.6405-5.6026 12.903-7.5267zm-4.1878-18.053q0 6.5646 4.0746 10.243 4.1312 3.6785 11.545 3.6785 7.3569 0 11.488-3.6785 4.1878-3.6785 4.1878-10.243 0-6.5646-4.1878-10.243-4.1312-3.6785-11.488-3.6785-7.4135 0-11.545 3.6785-4.0746 3.6785-4.0746 10.243z"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><g stroke-width="2.8975" aria-label="9"><path d="m26.633 90.805v-10.413q4.301 2.0373 8.7151 3.1125t8.6585 1.0752q11.318 0 17.26-7.5833 5.9987-7.6399 6.8476-23.146-3.2823 4.8669-8.319 7.4701t-11.149 2.6032q-12.677 0-20.09-7.6399-7.3569-7.6965-7.3569-20.996 0-13.016 7.6965-20.882 7.6965-7.8663 20.486-7.8663 14.657 0 22.354 11.262 7.7531 11.205 7.7531 32.597 0 19.977-9.5074 31.918-9.4508 11.884-25.466 11.884-4.301 0-8.7151-0.84888t-9.1679-2.5466zm22.75-35.823q7.6965 0 12.167-5.263 4.5273-5.263 4.5273-14.431 0-9.1113-4.5273-14.374-4.4708-5.3196-12.167-5.3196-7.6965 0-12.224 5.3196-4.4708 5.263-4.4708 14.374 0 9.1679 4.4708 14.431 4.5273 5.263 12.224 5.263z"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/></svg>
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../provider/data.dart';
class Cell {
int value;
final int col;
final int row;
Cell(
@required this.value,
@required this.col,
@required this.row,
);
Container widget(Data myProvider) {
String imageAsset = 'assets/skins/empty.png';
if (this.value > 0) {
imageAsset = 'assets/skins/' + myProvider.skin + '_' + this.value.toString() + '.png';
}
int size = myProvider.size;
double borderWidth = 3;
Color borderDarkColor = Colors.black;
Color borderLightColor = Colors.grey;
Color borderSelectedColor = Colors.red;
Border borders = Border(
top: BorderSide(width: borderWidth, color: ((this.row % size) == 0) ? borderDarkColor : borderLightColor),
left: BorderSide(width: borderWidth, color: ((this.col % size) == 0) ? borderDarkColor : borderLightColor),
right: BorderSide(width: borderWidth, color: (((this.col + 1) % size) == 0) ? borderDarkColor : borderLightColor),
bottom: BorderSide(width: borderWidth, color: (((this.row + 1) % size) == 0) ? borderDarkColor : borderLightColor),
);
if (this.col == myProvider.currentCellCol && this.row == myProvider.currentCellRow) {
borders = Border.all(
color: borderSelectedColor,
width: borderWidth,
);
}
return Container(
decoration: BoxDecoration(
color: Colors.white,
border: borders,
),
child: GestureDetector(
child: Image(
image: AssetImage(imageAsset),
fit: BoxFit.fill
),
onTap: () {
if (this.col != null && this.row != null) {
if (this.col != myProvider.currentCellCol || this.row != myProvider.currentCellRow) {
myProvider.selectCell(this.col, this.row);
} else {
myProvider.selectCell(null, null);
}
}
},
)
);
}
Container widgetUpdateValue(Data myProvider) {
String imageAsset = 'assets/skins/empty.png';
if (this.value > 0) {
imageAsset = 'assets/skins/' + myProvider.skin + '_' + this.value.toString() + '.png';
}
return Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.black,
width: 2,
),
),
child: GestureDetector(
child: Image(
image: AssetImage(imageAsset),
fit: BoxFit.fill
),
onTap: () {
if (this.col != null && this.row != null) {
myProvider.updateCellValue(this.col, this.row, this.value);
}
myProvider.selectCell(null, null);
},
)
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment