view.menus package
Submodules
view.menus.load_view module
- class view.menus.load_view.LoadMenu
Bases:
object
Represents the menu view in the terminal window. It’s used to display the starting screen of the game, the menu (pause), and all available options: Create, start, load, save a game; change its settings, etc.
- __get_menu_options() → list[str]
Get the different options available in the menu depending on the game state.
- Parameters:
game_state (GameState) – The current state of the game.
- Returns:
A list of menu options available for the given game state.
- Return type:
list[MenuOptions]
- __init__() → None
Initialize the menu view.
- show() → str
Show the menu in the terminal window and allow the user to select a save file.
- Returns:
The name of the selected save file or None to return to the main menu.
- Return type:
str
view.menus.menu_view module
- class view.menus.menu_view.MenuView
Bases:
object
Represents the menu view in the terminal window. It’s used to display the starting screen of the game, the menu (pause), and all available options: Create, start, load, save a game; change its settings, etc.
- __get_menu_options(game_state: GameState) → list[MenuOptions]
Get the different options available in the menu depending on the game state.
- Parameters:
game_state (GameState) – The current state of the game.
- Returns:
A list of menu options available for the given game state.
- Return type:
list[MenuOptions]
- __init__() → None
Initialize the menu view.
- show(game_state: GameState) → int
Show the menu in the terminal window.
- Parameters:
game_state (GameState) – The current state of the game.
- Returns:
The value of the selected menu option.
- Return type:
int
view.menus.settings_view module
- class view.menus.settings_view.SettingsMenu(settings: Settings)
Bases:
object
A class to represent the settings menu in the game.
- __init__(settings: Settings) → None
Initialize the SettingsMenu object.
- Parameters:
settings (Settings) – The settings object containing the current game settings.
- __show() → None
Display the settings menu and handle user input.
- __toggle_option(option: str) → None
Toggle the selected option in the settings.
- Parameters:
option (str) – The option to be toggled.