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

Add basic game

parent 25784924
No related branches found
No related tags found
1 merge request!19Resolve "Add basic game"
Pipeline #5557 passed
Showing
with 50 additions and 77 deletions
...@@ -37,7 +37,7 @@ if (keystorePropertiesFile.exists()) { ...@@ -37,7 +37,7 @@ if (keystorePropertiesFile.exists()) {
} }
android { android {
compileSdkVersion 33 compileSdkVersion 34
namespace "org.benoitharrault.sortgame" namespace "org.benoitharrault.sortgame"
defaultConfig { defaultConfig {
......
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.17 app.versionName=0.0.18
app.versionCode=17 app.versionCode=18
{
data: []
}
File added
File added
File added
File added
assets/icons/button_back.png

3.68 KiB

assets/icons/button_start.png

3.91 KiB

assets/icons/placeholder.png

170 B

{
"app_name": "SortGame"
}
{
"app_name": "SortGame"
}
Add minimal playable game.
Ajout du jeu minimal.
...@@ -16,10 +16,9 @@ ICON_SIZE=192 ...@@ -16,10 +16,9 @@ ICON_SIZE=192
# Game images # Game images
AVAILABLE_GAME_IMAGES=" AVAILABLE_GAME_IMAGES="
" button_back
button_start
# Settings images placeholder
AVAILABLES_GAME_SETTINGS="
" "
####################################################### #######################################################
...@@ -64,19 +63,6 @@ function build_icon() { ...@@ -64,19 +63,6 @@ function build_icon() {
optipng ${OPTIPNG_OPTIONS} ${TARGET} optipng ${OPTIPNG_OPTIONS} ${TARGET}
} }
function build_settings_icons() {
INPUT_STRING="$1"
SETTING_NAME="$(echo "${INPUT_STRING}" | cut -d":" -f1)"
SETTING_VALUES="$(echo "${INPUT_STRING}" | cut -d":" -f2 | tr "," " ")"
for SETTING_VALUE in ${SETTING_VALUES}
do
SETTING_CODE="${SETTING_NAME}_${SETTING_VALUE}"
build_icon ${CURRENT_DIR}/${SETTING_CODE}.svg ${ASSETS_DIR}/icons/${SETTING_CODE}.png
done
}
####################################################### #######################################################
# Create output folders # Create output folders
...@@ -90,9 +76,3 @@ for GAME_IMAGE in ${AVAILABLE_GAME_IMAGES} ...@@ -90,9 +76,3 @@ for GAME_IMAGE in ${AVAILABLE_GAME_IMAGES}
do do
build_icon ${CURRENT_DIR}/${GAME_IMAGE}.svg ${ASSETS_DIR}/icons/${GAME_IMAGE}.png build_icon ${CURRENT_DIR}/${GAME_IMAGE}.svg ${ASSETS_DIR}/icons/${GAME_IMAGE}.png
done done
# build settings images
for GAME_SETTING in ${AVAILABLES_GAME_SETTINGS}
do
build_settings_icons "${GAME_SETTING}"
done
#! /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}")"
SOURCE="${CURRENT_DIR}/icon.svg"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
# optimize svg
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="$1"
TARGET="$2"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET_PNG} \
${SOURCE}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
build_icon 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/ic_launcher
build_icon 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/ic_launcher
build_icon 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/ic_launcher
build_icon 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher
build_icon 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher
<?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"><rect x=".44662" y=".89101" width="92.772" height="91.894" ry="11.689" fill="#e41578" stroke="#fff" stroke-width=".238"/><path d="m59.387 71.362c1.1248 1.1302 4.0012 1.1302 4.0012 0v-45.921c0-1.1316-2.8832-1.1316-4.0121 0l-37.693 20.918c-1.1289 1.1248-1.1479 2.9551-0.02171 4.084z" fill="#fefeff" stroke="#930e4e" stroke-linecap="round" stroke-linejoin="round" stroke-width="8.257"/><path d="m57.857 68.048c0.96243 0.96706 3.4236 0.96706 3.4236 0v-39.292c0-0.96825-2.467-0.96825-3.4329 0l-32.252 17.898c-0.96594 0.96243-0.9822 2.5285-0.01858 3.4945z" fill="#fefeff" stroke="#feffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4.314"/></svg>
<?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"><rect x=".44662" y=".89101" width="92.772" height="91.894" ry="11.689" fill="#49a1ee" stroke="#fff" stroke-width=".238"/><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="#fefeff" stroke="#105ca1" stroke-linecap="round" stroke-linejoin="round" stroke-width="8.257"/><path d="m36.382 28.754c-0.96243-0.96706-3.4236-0.96706-3.4236 0v39.292c0 0.96825 2.467 0.96825 3.4329 0l32.252-17.898c0.96594-0.96243 0.9822-2.5285 0.01858-3.4945z" fill="#fefeff" stroke="#feffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4.314"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 102 102" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"/>
import 'package:sortgame/utils/tools.dart';
class DefaultGameSettings {
static const List<String> availableParameters = [
'itemsCount',
];
static const int itemsCountValueLow = 5;
static const int itemsCountValueMedium = 10;
static const int itemsCountValueHigh = 15;
static const int itemsCountValueVeryHigh = 20;
static const int defaultItemsCountValue = itemsCountValueMedium;
static const List<int> allowedItemsCountValues = [
itemsCountValueLow,
itemsCountValueMedium,
itemsCountValueHigh,
itemsCountValueVeryHigh,
];
static List<int> getAvailableValues(String parameterCode) {
switch (parameterCode) {
case 'itemsCount':
return DefaultGameSettings.allowedItemsCountValues;
}
printlog('Did not find any available value for game parameter "$parameterCode".');
return [];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment