From 21622a5f24be005600e65c852d28d13c58d23547 Mon Sep 17 00:00:00 2001 From: Johnny Jazeix Date: Sat, 30 Dec 2023 18:57:21 +0100 Subject: [PATCH 1/6] menu, prevent crashes on highscores and levels menu --- src/menu.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu.cc b/src/menu.cc index 91d4cfa..f687dc9 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -624,6 +624,7 @@ eMenu Menu::SDLMain_Speed(void) // Prend les evenements do { + Ec.CleanSpriteAndScreen(fmenu); SDL_RenderClear(sdlRenderer); // Prend l'image du fond et fait l'affichage Sprites[fond_menu].Affiche(400,300,0,Sprites[fmenu].Image[0]); @@ -645,7 +646,6 @@ eMenu Menu::SDLMain_Speed(void) case SDL_WINDOWEVENT: if(event.window.event==SDL_WINDOWEVENT_ENTER) { SDL_RenderPresent(sdlRenderer); - Ec.CleanSpriteAndScreen(fmenu); } break; case SDL_KEYDOWN: @@ -1184,6 +1184,7 @@ eMenu Menu::SDLMain_Score(bool EditScore) // Prend les evenements do { // Efface le fond + Ec.CleanSpriteAndScreen(fmenu); SDL_RenderClear(sdlRenderer); // Prend l'image du fond et fait l'affichage Sprites[fond_menu].Affiche(400,300,0,Sprites[fmenu].Image[0]); @@ -1214,7 +1215,6 @@ eMenu Menu::SDLMain_Score(bool EditScore) case SDL_WINDOWEVENT: if(event.window.event==SDL_WINDOWEVENT_ENTER) { SDL_RenderPresent(sdlRenderer); - Ec.CleanSpriteAndScreen(fmenu); } break; case SDL_KEYDOWN: // Prend un touche au clavier From 6042bab92a081e257758d03ba9706874545e0100 Mon Sep 17 00:00:00 2001 From: Johnny Jazeix Date: Sat, 30 Dec 2023 19:06:14 +0100 Subject: [PATCH 2/6] android, handle Back button as Escape --- src/game.cc | 2 +- src/menu.cc | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/game.cc b/src/game.cc index a5dacd6..8488e0a 100644 --- a/src/game.cc +++ b/src/game.cc @@ -124,7 +124,7 @@ eMenu Game::SDLMain(void) break; case SDL_KEYDOWN: if(event.key.state==SDL_PRESSED) { - if(event.key.keysym.sym==SDLK_ESCAPE) { + if(event.key.keysym.sym==SDLK_ESCAPE || event.key.keysym.sym==SDLK_AC_BACK) { mRet=MainMenu.SDLMain_InGame(); if(mRet==mGame) { DrawLevel(NumN); diff --git a/src/menu.cc b/src/menu.cc index f687dc9..3d0c25a 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -141,6 +141,7 @@ eMenu Menu::SDLMain(void) Sons.Play(sClic); switch(event.key.keysym.sym) { case SDLK_ESCAPE: + case SDLK_AC_BACK: // Android back button return mQuit; case SDLK_UP: PyE--; @@ -267,6 +268,7 @@ eMenu Menu::SDLMain_Language(void) Sons.Play(sClic); switch(event.key.keysym.sym) { case SDLK_ESCAPE: + case SDLK_AC_BACK: // Android back button if(Pref.Langue==-1) Pref.Langue=PyE; return mMenu; case SDLK_UP: @@ -415,6 +417,7 @@ eMenu Menu::SDLMain_Options(void) Sons.Play(sClic); switch(event.key.keysym.sym) { case SDLK_ESCAPE: + case SDLK_AC_BACK: // Android back button return mMenu; case SDLK_LEFT: switch(PyE) { @@ -422,7 +425,6 @@ eMenu Menu::SDLMain_Options(void) if(Pref.FullScreen==false) { Pref.FullScreen=true; ChangeVideo(); - //InitMain_Options(); PyE=2; } break; @@ -449,7 +451,6 @@ eMenu Menu::SDLMain_Options(void) if(Pref.FullScreen==true) { Pref.FullScreen=false; ChangeVideo(); - //InitMain_Options(); PyE=2; } break; @@ -491,12 +492,10 @@ eMenu Menu::SDLMain_Options(void) case 2: // Type d'affichage Pref.FullScreen=(Pref.FullScreen+1)&1; ChangeVideo(); - //InitMain_Options(); PyE=2; break; case 3: // Choix de la langue SDLMain_Language(); - //InitMain_Options(); PyE=3; break; case 5: // Diminue volume sons @@ -653,7 +652,8 @@ eMenu Menu::SDLMain_Speed(void) Sons.Play(sClic); switch(event.key.keysym.sym) { case SDLK_ESCAPE: - return mMenu; + case SDLK_AC_BACK: // Android back button + return Niv==0 ? mMenu : mMenuNiveau; case SDLK_UP: PyE--; if(PyE<0) PyE=2; @@ -756,6 +756,7 @@ eMenu Menu::SDLMain_Level(void) Sons.Play(sClic); switch(event.key.keysym.sym) { case SDLK_ESCAPE: + case SDLK_AC_BACK: // Android back button return mMenu; case SDLK_UP: PyE--; @@ -944,6 +945,7 @@ eMenu Menu::SDLMain_HR(void) Sons.Play(sClic); switch(event.key.keysym.sym) { case SDLK_ESCAPE: + case SDLK_AC_BACK: // Android back button return mGame; case SDLK_UP: PyE--; @@ -1071,7 +1073,6 @@ eMenu Menu::SDLMain_InGame(void) // Prend les evenements do { SDL_RenderClear(sdlRenderer); - //Affiche_InGame(); SDL_Event event; while(SDL_PollEvent(&event)) { mouse.GetEvent(event,PyE); // Prend les evenements de la sourie @@ -1087,6 +1088,7 @@ eMenu Menu::SDLMain_InGame(void) Sons.Play(sClic); switch(event.key.keysym.sym) { case SDLK_ESCAPE: + case SDLK_AC_BACK: // Android back button return mGame; case SDLK_UP: PyE--; @@ -1107,7 +1109,6 @@ eMenu Menu::SDLMain_InGame(void) return mGame; case 1: SDLMain_Options(); - //Affiche_InGame(); PyE=1; break; case 2: From 5ffae84df7599156910b735474616016d55b7bdd Mon Sep 17 00:00:00 2001 From: Johnny Jazeix Date: Sat, 30 Dec 2023 21:12:27 +0100 Subject: [PATCH 3/6] handle IME keyboard (only works for ascii characters for now) --- src/menu.cc | 30 +++++++++++++++--------------- src/sprite.cc | 4 +++- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/menu.cc b/src/menu.cc index 3d0c25a..3a8f1b7 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -1180,8 +1180,9 @@ eMenu Menu::SDLMain_Score(bool EditScore) Menu_Py[0].Py=0; Menu_Py[0].Valide=true; Menu_Py[1].DepX=-1; - - + + if(EditScore) SDL_StartTextInput(); + // Prend les evenements do { // Efface le fond @@ -1229,6 +1230,7 @@ eMenu Menu::SDLMain_Score(bool EditScore) case SDLK_ESCAPE: // Valide l'entrée case SDLK_RETURN: case SDLK_KP_ENTER: + if(EditScore) SDL_StopTextInput(); return mMenu; case SDLK_BACKSPACE: // Fait un retour de chariot if(PosCur) { @@ -1236,23 +1238,20 @@ eMenu Menu::SDLMain_Score(bool EditScore) Pref.Sco[NEdit].Name[PosCur]=0; } break; - default: // Prend les touches - key=event.key.keysym.sym&0x7F; // Prend le caracataire correspondant à la touche - if(PosCur<79 && CharExiste(key)==true) { // Prend le caractaire - Pref.Sco[NEdit].Name[PosCur]=key; - Pref.Sco[NEdit].Name[PosCur+1]=0; - if(LongueurString(Pref.Sco[NEdit].Name) Date: Sun, 31 Dec 2023 14:38:46 +0100 Subject: [PATCH 4/6] add desktop and appdata files --- NEWS | 4 ++ README.md | 2 +- org.liri.liri.appdata.xml | 82 +++++++++++++++++++++++++++++++++++++++ org.liri.liri.desktop | 12 ++++++ 4 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 org.liri.liri.appdata.xml create mode 100644 org.liri.liri.desktop diff --git a/NEWS b/NEWS index b6852e7..4e4dde5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +xx-01-2024 : Version 3.1.0 + Fix crash on highscore when waiting too much (memory corruption) + Add IME keyboard on Android + Handle Back button on Android (same as Escape) 19-12-2023 : Version 3.0.1 CMake compilation Github workflow to provide binaries for Linux, Windows and macOS diff --git a/README.md b/README.md index 26d3507..bb0251a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Li-Ri is a fork of Ri-li (http://www.ri-li.org). Li-Ri is a arcade game licensed under the GPL (General Public License). You drive a toy wood engine in many levels and you must collect -all the coaches for win.You can dowload it and play indefinitely. +all the coaches for win. You can download it and play indefinitely. It's Free. You can play on 'Windows', 'Linux', 'Mac OsX', 'Android'. Full-featured, diff --git a/org.liri.liri.appdata.xml b/org.liri.liri.appdata.xml new file mode 100644 index 0000000..27e6894 --- /dev/null +++ b/org.liri.liri.appdata.xml @@ -0,0 +1,82 @@ + + + + org.liri.liri.desktop + CC0-1.0 + GPL-2.0-or-later + Li-Ri + Li-Ri is a arcade game where you drive a toy wood engine. + +

Li-Ri is a arcade game licensed under the GPL (General Public License).

+

You drive a toy wood engine in many levels and you must collect + all the coaches for win. You can download it and play indefinitely. + It's Free. You can play on 'Windows', 'Linux', 'Mac OsX', 'Android'.

+
    +
  • 19 languages: Arabic, Breton, Chinese, English, Esperanto, French, German, Italian, Japanese, Korean, Portuguese, Russian, Slovak, Spanish, Swedish, Polish, Turkish, Hungarian, Dutch.
  • +
  • 50 levels in this version.
  • +
  • 3 beautiful musics and many sound effects.
  • +
+

Li-Ri is a fork of Ri-li (http://www.ri-li.org).

+
+ + + Li-ri main menu + https://github.com/petitlapin/Li-Ri/blob/287f0acce15a184ca9e653b4a398b1d2fdb84fd1/fastlane/metadata/android/en-US/images/tenInchScreenshots/01.png + + + First level + https://github.com/petitlapin/Li-Ri/blob/287f0acce15a184ca9e653b4a398b1d2fdb84fd1/fastlane/metadata/android/en-US/images/tenInchScreenshots/02.png + + + First level after a few seconds of play + https://github.com/petitlapin/Li-Ri/blob/287f0acce15a184ca9e653b4a398b1d2fdb84fd1/fastlane/metadata/android/en-US/images/tenInchScreenshots/03.png + + + https://github.com/petitlapin/Li-Ri + https://github.com/petitlapin/Li-Ri/issues + https://github.com/petitlapin/Li-Ri + https://github.com/petitlapin/Li-Ri + jazeix@gmail.com + + Li-ri + + + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + + + https://f-droid.org/en/packages/org.liri.liri/ + + + + + +
diff --git a/org.liri.liri.desktop b/org.liri.liri.desktop new file mode 100644 index 0000000..99a0828 --- /dev/null +++ b/org.liri.liri.desktop @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2023 Johnny Jazeix +[Desktop Entry] +Name=Li-ri +GenericName=Li-ri Arcade Game +Comment=Multi-Activity Educational game for children 2 to 10 +Exec=Li-ri +Icon=li-ri +Terminal=false +Type=Application +Categories=Education;Game;KidsGame; +StartupNotify=true From 1b7d811fdbce2e04019c375ae19d51b5a0a085f2 Mon Sep 17 00:00:00 2001 From: Johnny Jazeix Date: Sun, 31 Dec 2023 13:09:50 +0100 Subject: [PATCH 5/6] add script to automatically bump version --- tools/bump_version.sh | 95 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 tools/bump_version.sh diff --git a/tools/bump_version.sh b/tools/bump_version.sh new file mode 100644 index 0000000..d04ea86 --- /dev/null +++ b/tools/bump_version.sh @@ -0,0 +1,95 @@ +#!/bin/sh +# Bump the version in multiple files such as CMakeLists.txt, AndroidManifest.xml +# If option "-r " is set, it will also update org.liri.liri.appdata.xml file. +# If option "-c" is set, it will also regenerate the fastlane changelogs from the NEWS file. +# There is no check at all if the release already exists or if the values are correct. +# +# SPDX-FileCopyrightText: 2023 Johnny Jazeix +# +# SPDX-License-Identifier: GPL-3.0-or-later + +function usage() { + echo "Usage: ./tools/bump_version.sh -v [-r ] [-h]" + echo " -v, --version contains the new version .." + echo " -r, --release contains the date of the release YYYY-MM-DD (optional)" + echo " -c, --changelog generate fastlane changelog from NEWS (optional)" + echo " -h, --help displays this help" +} + +if [ ! -f org.liri.liri.appdata.xml ] +then + echo "ERROR: Run me from the top level source dir" + exit 1 +fi + +while [[ $# -gt 0 ]]; do + case $1 in + -v|--version) + VERSION="$2" + shift # past argument + shift # past value + ;; + -r|--release) + DATE="$2" + shift # past argument + shift # past value + ;; + -c|--changelog) + CHANGELOG="1" + shift # past argument + ;; + -h|--help) + usage; + exit 0 + ;; + -*|--*) + echo "Unknown option $1" + exit 1 + ;; + *) + POSITIONAL_ARGS+=("$1") # save positional arg + shift # past argument + ;; + esac +done + +if [[ ! "${VERSION}" ]] +then + echo "Mission version" + usage + exit 1 +fi + +major=`echo $VERSION | cut -d. -f1` +minor=`echo $VERSION | cut -d. -f2` +patch=`echo $VERSION | cut -d. -f3` + +version=${major}.${minor}.${patch} +echo "Version = $version" +echo "Date = ${DATE}" + +# Update CMakeLists LIRI_VERSION_MAJOR and LIRI_VERSION_MINOR variables +sed -i "s/set(LIRI_VERSION_MAJOR [0-9]\+)$/set\(LIRI_VERSION_MAJOR $major\)/" CMakeLists.txt +sed -i "s/set(LIRI_VERSION_MINOR [0-9]\+)$/set\(LIRI_VERSION_MINOR $minor\)/" CMakeLists.txt +sed -i "s/set(LIRI_VERSION_PATCH [0-9]\+)$/set\(LIRI_VERSION_PATCH $patch\)/" CMakeLists.txt + +# Update AndroidManifest.xml +versioncode=$((${major}*10000 + ${minor}*100 + ${patch})) +sed -i "s/android:versionCode=\"[0-9]\+\"$/android:versionCode=\"$versioncode\"/" android/app/src/main/AndroidManifest.xml +sed -i "s/android:versionName=\"[0-9.]\+\"$/android:versionName=\"$version\"/" android/app/src/main/AndroidManifest.xml + +git add CMakeLists.txt android/app/src/main/AndroidManifest.xml && git commit -m "bump version to ${major}.${minor}.${patch}" + +if [[ "${DATE}" ]] +then + # Add a new release in org.liri.liri.appdata.xml with the new date and release + sed -i -e "//a\ \ \ \ " org.liri.liri.appdata.xml + git add org.liri.liri.appdata.xml && git commit -m "appdata, add ${major}.${minor}.${patch} release" +fi + +# TODO +if [[ "${CHANGELOG}" ]] +then + #python tools/fdroid_update_fastlane_metadata.py + echo "todo" +fi From 389ab94de2fb954af2141f4142186528593598ee Mon Sep 17 00:00:00 2001 From: Johnny Jazeix Date: Sun, 31 Dec 2023 13:09:26 +0100 Subject: [PATCH 6/6] bump version to 3.1.0 --- CMakeLists.txt | 4 ++-- android/app/src/main/AndroidManifest.xml | 4 ++-- fastlane/metadata/android/en-US/changelogs/30001.txt | 3 +++ fastlane/metadata/android/en-US/changelogs/30100.txt | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/30001.txt create mode 100644 fastlane/metadata/android/en-US/changelogs/30100.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 402ff00..140237e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,8 @@ include(InstallRequiredSystemLibraries) ### The current version number set(LIRI_VERSION_MAJOR 3) -set(LIRI_VERSION_MINOR 0) -set(LIRI_VERSION_PATCH 1) +set(LIRI_VERSION_MINOR 1) +set(LIRI_VERSION_PATCH 0) set(LIRI_VERSION ${LIRI_VERSION_MAJOR}.${LIRI_VERSION_MINOR}) set(LIRI_EXECUTABLE_NAME Li-ri) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index adf804d..864e643 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@