diff --git a/difficulty.py b/difficulty.py index 3acedb4c6df825ec8b1b3d2a249059f73d9de38d..e73443d1a29702aaa5b233fa006d8ef2a5686a28 100644 --- a/difficulty.py +++ b/difficulty.py @@ -65,7 +65,7 @@ class DifficultyView(BaseView): else: ctx.gray(0.5 + min(abs(distance / 2), 0.5)) - if abs(distance) <= 3: + if abs(distance) < 3: xpos = 0.0 ctx.font_size = 24 - abs(distance) * 3 if target and (width := ctx.text_width(str(diff))) > 220: diff --git a/loading.py b/loading.py index 05f0bfb0dac413e62fec6898c7f79c534befebbd..dc05c527bcf6482edb303f9be91069fba7d41f3f 100644 --- a/loading.py +++ b/loading.py @@ -15,12 +15,28 @@ class LoadingView(BaseView): def draw(self, ctx: Context) -> None: # Paint the background black ctx.rgb(0, 0, 0).rectangle(-120, -120, 240, 240).fill() - ctx.font = "Camp Font 3" - ctx.font_size = 32 ctx.text_align = ctx.CENTER ctx.text_baseline = ctx.MIDDLE + ctx.font = "Camp Font 3" + + ctx.font_size = 32 + while ctx.text_width(self.song.name) > 220: + ctx.font_size -= 1 ctx.move_to (0, 0) ctx.gray(1.0) + ctx.text(self.song.name) + + name_size = ctx.font_size + ctx.font_size = min(22, name_size) + while ctx.text_width(self.song.artist) > 220: + ctx.font_size -= 1 + ctx.move_to (0, -name_size) + ctx.gray(0.75) + ctx.text(self.song.artist) + + ctx.font_size = 18 + ctx.move_to (0, 60) + ctx.gray(0.5) ctx.text("Loading...") def think(self, ins: InputState, delta_ms: int) -> None: diff --git a/select.py b/select.py index 8578583755341450e2f21c3559388c21ba461cb9..b3a8e94e28e00acd4a56c8c2a1535f56020bc71c 100644 --- a/select.py +++ b/select.py @@ -183,7 +183,7 @@ class SelectView(BaseView): else: ctx.gray(0.5 + min(abs(distance / 2), 0.5)) - if abs(distance) <= 3: + if abs(distance) < 3: song.load() xpos = 0.0 ctx.font_size = 24 - abs(distance) * 3 diff --git a/song.py b/song.py index 13597a3379bf5f3889a568c644f536a44101d679..f7b440365eb3d3f741cadab629b7533684a6d0ba 100644 --- a/song.py +++ b/song.py @@ -298,7 +298,8 @@ class SongView(BaseView): media.think(delta_ms) if self.input.buttons.os.middle.pressed and not self.is_active(): - self.vm.pop(ViewTransitionSwipeRight()) + while not self.vm.is_active(self.app): + self.vm.pop(ViewTransitionSwipeRight()) if not self.is_active(): return diff --git a/songinfo.py b/songinfo.py index af60a8a43e594d2e1bfed857a34cda72f589fb8d..d5d362e5fa500095dc6ed45d8640c983ec3a8377 100644 --- a/songinfo.py +++ b/songinfo.py @@ -82,9 +82,9 @@ class SongInfo(object): diffs = f.read(10) for b in diffs: self._difficulties.append(difficulties[int(b)]) - if not self._difficulties: - #os.unlink(diffFileName) # unlink's broken - raise Exception + #if not self._difficulties: + # os.unlink(diffFileName) # unlink's broken + # raise Exception self._difficulties.sort(key = lambda a: a.id, reverse=True) return self._difficulties except Exception as e: