diff options
author | vg <vgm+dev@devys.org> | 2024-03-04 22:11:23 +0100 |
---|---|---|
committer | vg <vgm+dev@devys.org> | 2024-03-04 22:11:23 +0100 |
commit | a5ea73aa61b23b7ee2befcd8811c64b9e39354bf (patch) | |
tree | 562f30f1f4f15469a73d707e270e05cb836f1f56 | |
parent | 52f68b2c7aa02846cbcfc73b441ebf51770c9b74 (diff) | |
parent | bb10c721fd35d6e8db661ed2508292a71add9abb (diff) | |
download | gamechest-a5ea73aa61b23b7ee2befcd8811c64b9e39354bf.tar.gz gamechest-a5ea73aa61b23b7ee2befcd8811c64b9e39354bf.tar.bz2 gamechest-a5ea73aa61b23b7ee2befcd8811c64b9e39354bf.zip |
Merge remote-tracking branch 'refs/remotes/origin/wip' into wip
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | gamechestcli/gamechest/gamedb.py | 2 | ||||
-rwxr-xr-x | gamechesttui | 93 | ||||
-rwxr-xr-x | pygame/__init__.py | 4 |
4 files changed, 100 insertions, 3 deletions
@@ -1,3 +1,7 @@ +all: zipapp + make -C pygame deploy + if [ -e ~/games/.saves ]; then cp ./gamechesttui ~/games/.saves/tools/bin/. ; elif [ -e ~/game-saves ]; then cp ./gamechesttui ~/game-saves/tools/bin/. ; fi + static-fix: isort --order-by-type --atomic gamechestcli diff --git a/gamechestcli/gamechest/gamedb.py b/gamechestcli/gamechest/gamedb.py index 44e0470..bec90d3 100644 --- a/gamechestcli/gamechest/gamedb.py +++ b/gamechestcli/gamechest/gamedb.py @@ -41,7 +41,7 @@ class GameDB: *[f'{tools_bin_path}/mod-{item}' for item in game_mods], profile_dir, game_dir, - *[item if index > 0 else f'{tools_bin_path}/{item}' + *[item if index > 0 else f'{tools_bin_path}/runners/{item}' for index, item in enumerate(game_info['command'])], ] diff --git a/gamechesttui b/gamechesttui new file mode 100755 index 0000000..9689f46 --- /dev/null +++ b/gamechesttui @@ -0,0 +1,93 @@ +#!/bin/bash + +set -e + +declare -a games + +GAME_INSTALLED=$(gamechest list | grep -i true | cut -d ":" -f 1 | cut -d " " -f 1) + +populate_games() +{ + for game in "${GAME_INSTALLED}"; do + games+=($game) + done +} + +choose_game() +{ + local choice_array=() + local shortcut_count=0 + for game in "${games[@]}"; do + shortcut_count=$(( $shortcut_count + 1 )) + choice_array+=( "$game" "[$shortcut_count] $game" ) + done + + local dialog_args=( + --stdout + --clear + --backtitle "Games selection" + --title "List of installed games" + #--default-item "${games[-1]}" + --menu "Choose one of the following game:" 0 0 0 + "${choice_array[@]}" + ) + + dialog "${dialog_args[@]}" +} + +populate_profiles() +{ + for profile in "dragoncat blackmoor calendros guest malice loudivine airi adetess"; do + profiles+=($profile) + done +} + +choose_profile() +{ + local choice_array=() + local shortcut_count=0 + for profile in "${profiles[@]}"; do + shortcut_count=$(( $shortcut_count + 1 )) + choice_array+=( "$profile" "[$shortcut_count] $profile" ) + done + + local dialog_args=( + --stdout + --clear + --backtitle "Profiles selection" + --title "List of avalaible profiles" + #--default-item "${profiles[-1]}" + --menu "Choose one of the following profile:" 0 0 0 + "${choice_array[@]}" + ) + + dialog "${dialog_args[@]}" +} + + +main() +{ + # Game + + populate_games + if [ ${#games[*]} -eq 0 ]; then echo "No game installed, bye."; exit 0; fi + if [ ${#games[*]} -eq 1 ]; then + game=${games[0]} + else + game=$(choose_game) + fi + + # Profile + populate_profiles + if [ ${#profiles[*]} -eq 0 ]; then echo "No profile available, bye."; exit 0; fi + if [ ${#profiles[*]} -eq 1 ]; then + profile=${profiles[0]} + else + profile=$(choose_profile) + fi + + echo "Running $game with $profile profile" + exec gamechest run --profile_id=$profile $game +} + +main diff --git a/pygame/__init__.py b/pygame/__init__.py index 4bbf096..ce603dc 100755 --- a/pygame/__init__.py +++ b/pygame/__init__.py @@ -221,7 +221,7 @@ class ProfileRenderer(ProfileDataObserver): self.font_fg_color = (0, 200, 200) self.avatar_surface = None self.avatar_size = (100, 100) - self.image_box = get_image_surface(config.get_data_d() / 'asset/box.png', resize=(170, 170), alpha=True) + self.image_box = get_image_surface(config.get_data_d() / 'asset/box_gamechest_no-title_259x308.png', resize=(170, 170), alpha=True) self.load_avatar() def load_avatar(self): @@ -335,7 +335,7 @@ class GameRenderer(GameDataObserver): self.image_right_arrow = get_image_surface(config.get_data_d() / 'asset/bulb.png', resize=(16, 16), alpha=True) - self.image_box = get_image_surface(config.get_data_d() / 'asset/box.png', resize=(400, 400), alpha=True) + self.image_box = get_image_surface(config.get_data_d() / 'asset/box_gamechest_title-games_518x616.png', resize=(400, 400), alpha=True) self.image_box.set_alpha(220) def event_current_game_changed(self, new_game_info): |