Skip to content
Snippets Groups Projects
Verified Commit 0c99eb7b authored by dos's avatar dos
Browse files

Song info on loading screen

parent 132766ef
Branches
No related tags found
No related merge requests found
...@@ -65,7 +65,7 @@ class DifficultyView(BaseView): ...@@ -65,7 +65,7 @@ class DifficultyView(BaseView):
else: else:
ctx.gray(0.5 + min(abs(distance / 2), 0.5)) ctx.gray(0.5 + min(abs(distance / 2), 0.5))
if abs(distance) <= 3: if abs(distance) < 3:
xpos = 0.0 xpos = 0.0
ctx.font_size = 24 - abs(distance) * 3 ctx.font_size = 24 - abs(distance) * 3
if target and (width := ctx.text_width(str(diff))) > 220: if target and (width := ctx.text_width(str(diff))) > 220:
......
...@@ -15,12 +15,28 @@ class LoadingView(BaseView): ...@@ -15,12 +15,28 @@ class LoadingView(BaseView):
def draw(self, ctx: Context) -> None: def draw(self, ctx: Context) -> None:
# Paint the background black # Paint the background black
ctx.rgb(0, 0, 0).rectangle(-120, -120, 240, 240).fill() 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_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE 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.move_to (0, 0)
ctx.gray(1.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...") ctx.text("Loading...")
def think(self, ins: InputState, delta_ms: int) -> None: def think(self, ins: InputState, delta_ms: int) -> None:
......
...@@ -183,7 +183,7 @@ class SelectView(BaseView): ...@@ -183,7 +183,7 @@ class SelectView(BaseView):
else: else:
ctx.gray(0.5 + min(abs(distance / 2), 0.5)) ctx.gray(0.5 + min(abs(distance / 2), 0.5))
if abs(distance) <= 3: if abs(distance) < 3:
song.load() song.load()
xpos = 0.0 xpos = 0.0
ctx.font_size = 24 - abs(distance) * 3 ctx.font_size = 24 - abs(distance) * 3
......
...@@ -298,6 +298,7 @@ class SongView(BaseView): ...@@ -298,6 +298,7 @@ class SongView(BaseView):
media.think(delta_ms) media.think(delta_ms)
if self.input.buttons.os.middle.pressed and not self.is_active(): if self.input.buttons.os.middle.pressed and not self.is_active():
while not self.vm.is_active(self.app):
self.vm.pop(ViewTransitionSwipeRight()) self.vm.pop(ViewTransitionSwipeRight())
if not self.is_active(): if not self.is_active():
......
...@@ -82,9 +82,9 @@ class SongInfo(object): ...@@ -82,9 +82,9 @@ class SongInfo(object):
diffs = f.read(10) diffs = f.read(10)
for b in diffs: for b in diffs:
self._difficulties.append(difficulties[int(b)]) self._difficulties.append(difficulties[int(b)])
if not self._difficulties: #if not self._difficulties:
# os.unlink(diffFileName) # unlink's broken # os.unlink(diffFileName) # unlink's broken
raise Exception # raise Exception
self._difficulties.sort(key = lambda a: a.id, reverse=True) self._difficulties.sort(key = lambda a: a.id, reverse=True)
return self._difficulties return self._difficulties
except Exception as e: except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment