Add credits menu, see #42

This commit is contained in:
Yohann D'ANELLO
2020-12-18 22:24:41 +01:00
parent ea5f5c1428
commit 411744bf10
5 changed files with 93 additions and 3 deletions

View File

@ -7,7 +7,7 @@ from typing import List
from squirrelbattle.menus import Menu, MainMenu
from .display import Box, Display
from ..enums import KeyValues
from ..enums import KeyValues, GameMode
from ..game import Game
from ..resources import ResourceManager
from ..translations import gettext as _
@ -113,6 +113,8 @@ class MainMenuDisplay(Display):
self.addstr(self.pad, 4 + i, max(self.width // 2
- len(self.title[0]) // 2 - 1, 0), self.title[i],
self.fg_color)
msg = _("Credits")
self.addstr(self.pad, self.height - 1, self.width - 1 - len(msg), msg)
self.refresh_pad(self.pad, 0, 0, self.y, self.x,
self.height + self.y - 1,
self.width + self.x - 1)
@ -133,6 +135,9 @@ class MainMenuDisplay(Display):
if y <= len(self.title):
self.fg_color = randint(0, 1000), randint(0, 1000), randint(0, 1000)
if y == self.height - 1 and x >= self.width - 1 - len(_("Credits")):
game.state = GameMode.CREDITS
class PlayerInventoryDisplay(MenuDisplay):
"""