tetris.menu module¶
- class tetris.menu.Menu(settings: Settings)¶
Bases:
objectMenu class for the game
- CONTROLS_CHOICE: str = 'controls'¶
- GAME_CHOICE: str = 'game'¶
- LEADERBOARD_CHOICE: str = 'leaderboard'¶
- QUIT_CHOICE: str = 'quit'¶
- RULES_CHOICE: str = 'rules'¶
- check_events() → bool | None¶
Checks for pygame events QUIT and MOUSEBUTTONDOWN and reacts to them
- Returns:
True if game, leaderboard, controls or rules button is pressed, None otherwise
- Return type:
(bool | None)
- check_hover() → None¶
Checks if mouse is hovering over the buttons and changes the cursor accordingly
- choice: str = ''¶
- create_buttons() → None¶
Creates menu buttons and its rects
- draw_buttons() → None¶
Draws the buttons on the screen
- main() → str¶
Main menu loop, waits for the user to press a button and returns the choice
- Returns:
Choice of the user
- Return type:
(str)