From b1e18bc5b92826078fc7c480a2662b9208f2edac Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Mon, 8 Apr 2024 23:50:29 +0300 Subject: nt compatibility --- README.txt | 6 ++++++ pyproject.toml | 2 +- src/sliceitoff/hiscores/hiscores.py | 17 +++++++++++------ src/sliceitoff/player/life.py | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.txt b/README.txt index 917ae41..40e4264 100644 --- a/README.txt +++ b/README.txt @@ -18,6 +18,12 @@ Installing: Distribution package can be installed normally: - `pipx install sliceitoff.*.tar.gz` +License: + + This project uses GPL-2 license. Used components uses their + licenses. There is gnufonts package from Freedos included in the + source tree and it's license can be fount on it's directory. + Developement: Project makes heavy use of poetry build and dependencies control diff --git a/pyproject.toml b/pyproject.toml index fb01158..bd20970 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "sliceitoff" -version = "0.3-alpha" +version = "0.3-beta" description = "Arcade game where one slices play area off avoiding enemies." authors = ["Viljami Ilola <+@hix.fi>"] readme = "README.txt" diff --git a/src/sliceitoff/hiscores/hiscores.py b/src/sliceitoff/hiscores/hiscores.py index a6c2bf0..5ce8ced 100644 --- a/src/sliceitoff/hiscores/hiscores.py +++ b/src/sliceitoff/hiscores/hiscores.py @@ -1,5 +1,6 @@ -""" hiscores.hiscores - high socres: loading, saving, converting to string""" +""" hiscores.hiscores - high socres: loading, saving, converting to string """ import os +from pathlib import Path from .static import INITIAL_HIGHSCORES, MAX_HIGHSCORES @@ -8,10 +9,13 @@ class HiScores: def __init__(self): """ On creation load high scores from config file """ self.table=[] - self.config_filename = os.path.join( - os.getenv('HOME'), - ".config", - "sliceitoffrc") + if os.name == 'nt': + self.config_filename = os.path.join(Path.home(), "sliceitoff.cfg") + else: + self.config_filename = os.path.join( + Path.home(), + ".config", + "sliceitoffrc") if not os.path.isfile(self.config_filename): self.table=INITIAL_HIGHSCORES[:] return @@ -48,13 +52,14 @@ class HiScores: config_file.writelines(oldlines) for score, name in self.table: config_file.write(f"hiscore={score}!{name}\n") + config_file.write("\n") def __str__(self): text = ( " " "\xeeH\xecI\xedG\xe9H " "\xeaS\xedC\xeeO\xebR\xe9E\xecS\xeb!\xed!\n\n") - half = len(self.table)//2 + half = len(self.table) // 2 for i in range(half): text += ( f"\xed{self.table[i][1]:<3s} " diff --git a/src/sliceitoff/player/life.py b/src/sliceitoff/player/life.py index e187201..ef39869 100644 --- a/src/sliceitoff/player/life.py +++ b/src/sliceitoff/player/life.py @@ -28,7 +28,7 @@ class Life(pygame.sprite.Group): def lose_life(self): """ Commands group to regenerate its sprites and sets timeout """ - self.timeout = 2_000 + self.timeout = 1_500 font_width = int(Scaling.factor * 200_000) block_width = int(Scaling.factor * 8_000) offset = ( -- cgit v1.2.3