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

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

Resolve "Normalize game architecture"

Closes #76

See merge request !77
parents 5ba8b349 2921cc1c
No related branches found
No related tags found
1 merge request!77Resolve "Normalize game architecture"
Pipeline #5802 passed
Showing
with 95 additions and 79 deletions
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.1.40 app.versionName=0.2.0
app.versionCode=64 app.versionCode=65
assets/menu/game-pick-image.png

8.27 KiB

assets/menu/game-pick-word.png

8.29 KiB

assets/placeholder.png

2.45 KiB

{ {
"app_name": "Word guess", "app_name": "Word guess",
"bottom_nav_home": "Game",
"bottom_nav_settings": "Settings",
"bottom_nav_about": "About",
"settings_title": "Settings", "settings_title": "Settings",
"settings_label_theme": "Theme mode", "settings_label_theme": "Theme mode",
"about_title": "About", "about_title": "About",
"about_content": "Word guess game.", "about_content": "Word guess game.",
"about_version": "Version: {version}" "about_version": "Version: {version}",
"": ""
} }
{ {
"app_name": "Trouve le mot", "app_name": "Trouve le mot",
"bottom_nav_home": "Jeu",
"bottom_nav_settings": "Réglages",
"bottom_nav_about": "Infos",
"settings_title": "Réglages", "settings_title": "Réglages",
"settings_label_theme": "Thème de couleurs", "settings_label_theme": "Thème de couleurs",
"about_title": "Informations", "about_title": "Informations",
"about_content": "Trouve le mot.", "about_content": "Trouve le mot.",
"about_version": "Version : {version}" "about_version": "Version : {version}",
"": ""
} }
assets/ui/button_back.png

3.68 KiB

assets/ui/button_delete_saved_game.png

5.68 KiB

assets/ui/button_resume_game.png

3.57 KiB

assets/ui/button_start.png

3.91 KiB

assets/ui/game_fail.png

3.56 KiB

assets/ui/game_win.png

7.75 KiB

assets/ui/placeholder.png

170 B

assets/ui/type_pick-image.png

5.9 KiB

assets/ui/type_pick-word.png

5.91 KiB

Improve/normalize game architecture.
Amélioration/normalisation de l'architecture du jeu.
#! /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; }
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)"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
CONVERT_OPTIONS="-alpha off +dither -colors 256 -depth 4"
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 image
function build_image() {
SOURCE="$1"
TARGET_PNG="$2"
IMAGE_WIDTH="$3"
IMAGE_HEIGHT="$4"
inkscape \
--export-width=${IMAGE_WIDTH} \
--export-height=${IMAGE_HEIGHT} \
--export-filename=${TARGET_PNG} \
${SOURCE}
}
# optimize image
function optimize_image() {
IMAGE_FILE="$1"
convert "${IMAGE_FILE}" ${CONVERT_OPTIONS} "${IMAGE_FILE}"
optipng ${OPTIPNG_OPTIONS} ${IMAGE_FILE}
}
# build menu image
function build_menu_image() {
IMAGE_NAME="$1"
INPUT_SVG="${CURRENT_DIR}/menu/${IMAGE_NAME}.svg"
OUTPUT_PNG="${BASE_DIR}/assets/menu/${IMAGE_NAME}.png"
optimize_svg "${INPUT_SVG}"
build_image "${INPUT_SVG}" "${OUTPUT_PNG}" 640 640
optimize_image "${OUTPUT_PNG}"
}
build_menu_image "game-pick-image"
build_menu_image "game-pick-word"
import 'package:wordguessing/utils/tools.dart';
class DefaultGameSettings {
// available game parameters codes
static const String parameterCodeGameType = 'type';
static const String parameterCodeLangValue = 'lang';
static const List<String> availableParameters = [
parameterCodeGameType,
parameterCodeLangValue,
];
// game type: available values
static const String gameTypeValuePickWord = 'pick-word';
static const String gameTypeValuePickImage = 'pick-image';
static const List<String> allowedGameTypeValues = [
gameTypeValuePickWord,
gameTypeValuePickImage,
];
// game type: default value
static const String defaultGameTypeValue = gameTypeValuePickWord;
// lang: available values
static const String langValueFr = 'fr';
static const String langValueEn = 'en';
static const List<String> allowedLangValues = [
langValueFr,
langValueEn,
];
// lang: default value
static const String defaultLangValue = langValueFr;
// available values from parameter code
static List<String> getAvailableValues(String parameterCode) {
switch (parameterCode) {
case parameterCodeGameType:
return DefaultGameSettings.allowedGameTypeValues;
case parameterCodeLangValue:
return DefaultGameSettings.allowedLangValues;
}
printlog('Did not find any available value for game parameter "$parameterCode".');
return [];
}
// parameters displayed with assets (instead of painter)
static List<String> displayedWithAssets = [
parameterCodeGameType,
];
static const int itemsCount = 4;
static const int recentWordsCount = 20;
}
import 'package:wordguessing/utils/tools.dart';
class DefaultGlobalSettings {
// available global parameters codes
static const String parameterCodeSkin = 'skin';
static const List<String> availableParameters = [
parameterCodeSkin,
];
// skin: available values
static const String skinValueDefault = 'default';
static const List<String> allowedSkinValues = [
skinValueDefault,
];
// skin: default value
static const String defaultSkinValue = skinValueDefault;
// available values from parameter code
static List<String> getAvailableValues(String parameterCode) {
switch (parameterCode) {
case parameterCodeSkin:
return DefaultGlobalSettings.allowedSkinValues;
}
printlog('Did not find any available value for global parameter "$parameterCode".');
return [];
}
// parameters displayed with assets (instead of painter)
static List<String> displayedWithAssets = [
//
];
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment