Added settings diplay and ability to change the keys (there is a refreshing problem though)
This commit is contained in:
parent
56ba9d186e
commit
d9b7db742a
|
@ -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:
|
||||
|
|
|
@ -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, ">")
|
||||
|
||||
|
|
Loading…
Reference in New Issue