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

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

Resolve "Normalize game architecture"

Closes #12

See merge request !9
parents d4dd2ec8 0665d5b9
Branches 13-improve-app-metadata
Tags Release_0.0.10_10
1 merge request!9Resolve "Normalize game architecture"
Pipeline #5820 passed
Showing
with 146 additions and 92 deletions
......@@ -37,7 +37,7 @@ if (keystorePropertiesFile.exists()) {
}
android {
compileSdkVersion 33
compileSdkVersion 34
namespace "org.benoitharrault.midisynth"
defaultConfig {
......
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.9
app.versionCode=9
app.versionName=0.0.10
app.versionCode=10
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": "MIDI synth",
"settings_title": "Settings",
"settings_label_theme": "Theme mode",
"about_title": "Informations",
"about_content": "MIDI synth",
"about_version": "Version: {version}",
"page_home": "Home",
"page_editor": "Editor",
"page_player": "Player",
"": ""
}
{
"app_name": "MIDI synth",
"settings_title": "Réglages",
"settings_label_theme": "Thème de couleurs",
"about_title": "Informations",
"about_content": "MIDI synth.",
"about_version": "Version : {version}",
"page_home": "Accueil",
"page_editor": "Édition",
"page_player": "Lecture",
"": ""
}
Improve/normalize app architecture.
Amélioration/normalisation de l'architecture de l'application.
AuthorName: 'Benoît Harrault'
Categories:
- Games
- Multimedia
Name: MIDI Synth
AutoName: MidiSynth
......
#! /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}")"
ASSETS_DIR="${BASE_DIR}/assets"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
ICON_SIZE=192
#######################################################
# Game images
AVAILABLE_GAME_IMAGES="
button_back
button_start
placeholder
"
# Settings images
AVAILABLES_GAME_SETTINGS="
"
#######################################################
# 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 \
--quiet \
-i ${SOURCE}.tmp \
-o ${SOURCE}
rm ${SOURCE}.tmp
}
# build icons
function build_icon() {
SOURCE="$1"
TARGET="$2"
echo "Building ${TARGET}"
if [ ! -f "${SOURCE}" ]; then
echo "Missing file: ${SOURCE}"
exit 1
fi
optimize_svg "${SOURCE}"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET} \
${SOURCE}
optipng ${OPTIPNG_OPTIONS} ${TARGET}
}
#######################################################
# Create output folders
mkdir -p ${ASSETS_DIR}/icons
# Delete existing generated images
find ${ASSETS_DIR}/icons -type f -name "*.png" -delete
# build game images
for GAME_IMAGE in ${AVAILABLE_GAME_IMAGES}
do
build_icon ${CURRENT_DIR}/${GAME_IMAGE}.svg ${ASSETS_DIR}/icons/${GAME_IMAGE}.png
done
<?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:flutter/material.dart';
import 'package:unicons/unicons.dart';
import 'package:midisynth/ui/pages/editor.dart';
import 'package:midisynth/ui/pages/home.dart';
import 'package:midisynth/ui/pages/player.dart';
class ActivityPageItem {
final Icon icon;
final Widget page;
final String code;
const ActivityPageItem({
required this.icon,
required this.page,
required this.code,
});
}
class ActivityPage {
static const indexHome = 0;
static const pageHome = ActivityPageItem(
icon: Icon(UniconsLine.home),
page: PageHome(),
code: 'page_home',
);
static const indexEditor = 1;
static const pageEditor = ActivityPageItem(
icon: Icon(UniconsLine.setting),
page: PageEditor(),
code: 'page_editor',
);
static const indexPlayer = 2;
static const pagePlayer = ActivityPageItem(
icon: Icon(UniconsLine.info_circle),
page: PagePlayer(),
code: 'page_player',
);
static Map<int, ActivityPageItem> items = {
indexHome: pageHome,
indexEditor: pageEditor,
indexPlayer: pagePlayer,
};
static bool isIndexAllowed(int pageIndex) {
return items.keys.contains(pageIndex);
}
static ActivityPageItem getPageItem(int pageIndex) {
return items[pageIndex] ?? pageHome;
}
static Widget getPageWidget(int pageIndex) {
return items[pageIndex]?.page ?? pageHome.page;
}
static int itemsCount = ActivityPage.items.length;
}
import 'package:midisynth/utils/tools.dart';
class DefaultActivitySettings {
// available activity parameters codes
static const String parameterCodeSequenceLength = 'sequenceLength';
static const List<String> availableParameters = [
parameterCodeSequenceLength,
];
// items count: available values
static const String sequenceLengthValueShort = 'short';
static const String sequenceLengthValueMedium = 'medium';
static const String sequenceLengthValueLong = 'long';
static const List<String> allowedSequenceLengthValues = [
sequenceLengthValueShort,
sequenceLengthValueMedium,
sequenceLengthValueLong,
];
// items count: default value
static const String defaultSequenceLengthValue = sequenceLengthValueMedium;
// available values from parameter code
static List<String> getAvailableValues(String parameterCode) {
switch (parameterCode) {
case parameterCodeSequenceLength:
return DefaultActivitySettings.allowedSequenceLengthValues;
}
printlog('Did not find any available value for activity parameter "$parameterCode".');
return [];
}
static int getSequenceLengthFromParameterValueCode(String parameterLevel) {
const Map<String, int> values = {
sequenceLengthValueShort: 8,
sequenceLengthValueMedium: 16,
sequenceLengthValueLong: 32,
};
return values[parameterLevel] ??
getSequenceLengthFromParameterValueCode(
DefaultActivitySettings.defaultSequenceLengthValue);
}
// 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.
Finish editing this message first!
Please register or to comment