Skip to content

Commit

Permalink
working compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
LupaDevStudio committed Oct 11, 2023
1 parent c48d7fd commit 44b8576
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
.buildozer
bin

# Installer logs
pip-log.txt
Expand Down
36 changes: 36 additions & 0 deletions Compilation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Compilation instructions

## Debug

### Compilation of a debug version

`python -m buildozer -v android debug`

### Launch the debug version on a device connected to the computer

`python -m buildozer -v android deploy run logcat | grep python`

## Release

### Creation of the app signing key

```bash
keytool -genkey -v -keystore ~/keystores/Postrias.keystore -alias Postrias -keyalg RSA -keysize 2048 -validity 10000
keytool -importkeystore -srckeystore ~/keystores/Postrias.keystore -destkeystore ~/keystores/Postrias.keystore -deststoretype pkcs12
```

### Compilation of a release version

```bash
export P4A_RELEASE_KEYALIAS="Postrias"
export P4A_RELEASE_KEYSTORE=~/keystores/Postrias.keystore
export P4A_RELEASE_KEYSTORE_PASSWD=
export P4A_RELEASE_KEYALIAS_PASSWD=
python -m buildozer android release
```

## Bug fix

### Java Heap Space error

`export GRADLE_OPTS="-Xms1724m -Xmx5048m -Dorg.gradle.jvmargs='-Xms1724m -Xmx5048m'"`
6 changes: 3 additions & 3 deletions buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ requirements = python3,kivy
#presplash.filename = ./resources/logo_collector_1024.png

# (str) Icon of the application
icon.filename = ./resources/logo_collector_1024.png
icon.filename = ./resources/logo.png

# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)
orientation = portrait
orientation = landscape

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
Expand Down Expand Up @@ -187,7 +187,7 @@ android.sdk = 34
#android.add_assets =

# (list) Gradle dependencies to add
android.gradle_dependencies ='com.google.android.gms:play-services-ads:20.3.0'
android.gradle_dependencies = com.google.android.gms:play-services-ads:20.3.0

# (bool) Enable AndroidX support. Enable when 'android.gradle_dependencies'
# contains an 'androidx' package, or any package from Kotlin source.
Expand Down
Binary file added resources/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
)

from tools.constants import (
USER_DATA
USER_DATA,
MUSIC_LIST,
SOUND_LIST
)

from tools.postrias import Game
Expand All @@ -37,8 +39,9 @@
###############

# Load the dictionnaries
MUSIC_DICT = load_sounds(PATH_MUSICS, USER_DATA.music_volume)
SOUND_DICT = load_sounds(PATH_SOUNDS, USER_DATA.sound_effects_volume)
MUSIC_DICT = load_sounds(MUSIC_LIST, PATH_MUSICS, USER_DATA.music_volume)
SOUND_DICT = load_sounds(SOUND_LIST, PATH_SOUNDS,
USER_DATA.sound_effects_volume)

# Create the mixer
music_mixer = DynamicMusicMixer(MUSIC_DICT, USER_DATA.music_volume)
Expand Down
5 changes: 5 additions & 0 deletions tools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,8 @@ def change_language(self, language):
BACKGROUND_COLOR = (0, 0, 0, 1)
TITLE_FONT_COLOR = (0, 0, 0, 1)
TEXT_FONT_COLOR = (50 / 255, 50 / 255, 50 / 255, 1)

### Musics ###
MUSIC_LIST = ["cinematic_dramatic.mp3",
"game_music.mp3", "time_of_the_apocalypse.mp3"]
SOUND_LIST = ["decision.wav", "decree.wav", "guillotine.wav"]
8 changes: 3 additions & 5 deletions tools/game_tools/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
### Imports ###
###############

import os

from math import exp

from kivy.core.audio import SoundLoader

from tools.constants import FPS
from tools.constants import FPS, MUSIC_LIST


###############
Expand Down Expand Up @@ -155,7 +153,7 @@ def exp_fade_out(t):
return 1 - exp((t - 60) * 0.15)


def load_sounds(foldername: str, volume: float) -> dict:
def load_sounds(music_list: str, foldername: str, volume: float) -> dict:
"""
Load all sounds of a folder at once.
Expand All @@ -173,7 +171,7 @@ def load_sounds(foldername: str, volume: float) -> dict:
Dictionnary with the loaded sounds.
"""
sound_dict = {}
for file in os.listdir(foldername):
for file in music_list:
name_file = file.split(".")[0]
sound_dict[name_file] = SoundLoader.load(foldername + file)
sound_dict[name_file].volume = volume
Expand Down

0 comments on commit 44b8576

Please sign in to comment.