From d9b7db742a0824363e31da5d7447adc7714423d3 Mon Sep 17 00:00:00 2001 From: eichhornchen Date: Wed, 11 Nov 2020 14:46:25 +0100 Subject: [PATCH] Added settings diplay and ability to change the keys (there is a refreshing problem though) --- dungeonbattle/display/display_manager.py | 8 ++++++-- dungeonbattle/display/menudisplay.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dungeonbattle/display/display_manager.py b/dungeonbattle/display/display_manager.py index 5c249c8..ea5c8ca 100644 --- a/dungeonbattle/display/display_manager.py +++ b/dungeonbattle/display/display_manager.py @@ -1,7 +1,7 @@ import curses from dungeonbattle.display.mapdisplay import MapDisplay from dungeonbattle.display.statsdisplay import StatsDisplay -from dungeonbattle.display.menudisplay import MainMenuDisplay +from dungeonbattle.display.menudisplay import MenuDisplay, MainMenuDisplay from dungeonbattle.display.texturepack import TexturePack from typing import Any from dungeonbattle.game import Game, GameMode @@ -17,9 +17,11 @@ class DisplayManager: self.statsdisplay = StatsDisplay(screen, pack) self.mainmenudisplay = MainMenuDisplay(self.game.main_menu, screen, pack) + self.settingsmenudisplay = MenuDisplay(screen, pack) self.displays = [self.statsdisplay, self.mapdisplay, - self.mainmenudisplay] + self.mainmenudisplay, self.settingsmenudisplay] self.update_game_components() + self.settingsmenudisplay.update_menu(self.game.settings_menu) def update_game_components(self) -> None: for d in self.displays: @@ -34,6 +36,8 @@ class DisplayManager: self.rows // 5, self.cols) if self.game.state == GameMode.MAINMENU: self.mainmenudisplay.refresh(0, 0, self.rows, self.cols) + if self.game.state == GameMode.SETTINGS: + self.settingsmenudisplay.refresh(0, 0, self.rows, self.cols-1) self.resize_window() def resize_window(self) -> bool: diff --git a/dungeonbattle/display/menudisplay.py b/dungeonbattle/display/menudisplay.py index aeed447..9dd416d 100644 --- a/dungeonbattle/display/menudisplay.py +++ b/dungeonbattle/display/menudisplay.py @@ -22,7 +22,7 @@ class MenuDisplay(Display): def update_pad(self) -> None: for i in range(self.trueheight): - self.pad.addstr(i, 0, " ") + self.pad.addstr(i, 0, " " + self.values[i]) # set a marker on the selected line self.pad.addstr(self.menu.position, 0, ">")