Public Member Functions | |
| None | __init__ (self) |
A playable 2D Tetris window using mxvk_wrap graphics. | |
| None | draw (self) |
| None | on_event (self, event) |
| None | reset (self) |
Public Attributes | |
| str | asset_dir = Path(__file__).resolve().parent / "data" |
| Load Tetris images, create the board, and start the first piece. | |
| background = mx.Sprite(self, self.asset_dir / "psychedelic_background.png", vertex_shader=str(self.asset_dir / "sprite.vert.spv"), fragment_shader=str(self.asset_dir / "background.frag.spv")) | |
| background_start_time = time.monotonic() | |
| list | blocks = [mx.Sprite(self, self.asset_dir / path) for path in BLOCK_FILES] |
| tuple | cells = () |
| Select and spawn a random tetromino at the top of the board. | |
| clear_block = mx.Sprite(self, self.asset_dir / "block_gray.png") | |
| float | clear_started = 0.0 |
| Start a fresh game with an empty board and score. | |
| tuple | clearing_rows = () |
| Start a fresh game with an empty board and score. | |
| float | fall_elapsed = 0.0 |
| Start a fresh game with an empty board and score. | |
| font = None | |
| float | frame_accumulator = 0.0 |
| Start a fresh game with an empty board and score. | |
| bool | game_over = False |
| Start a fresh game with an empty board and score. | |
| list | grid = [] |
| Start a fresh game with an empty board and score. | |
| last_frame_time = time.monotonic() | |
| Start a fresh game with an empty board and score. | |
| int | level = 1 |
| Start a fresh game with an empty board and score. | |
| int | lines = 0 |
| Start a fresh game with an empty board and score. | |
| bool | mouse_pressed = False |
| Handle game controls from MXVK keyboard events. | |
| float | mouse_x = 0.0 |
| Handle game controls from MXVK keyboard events. | |
| float | mouse_y = 0.0 |
| Handle game controls from MXVK keyboard events. | |
| int | next_color = 0 |
| Start a fresh game with an empty board and score. | |
| int | piece_color = 0 |
| Select and spawn a random tetromino at the top of the board. | |
| int | piece_x = 0 |
| Select and spawn a random tetromino at the top of the board. | |
| int | piece_y = 0 |
| Select and spawn a random tetromino at the top of the board. | |
| int | score = 0 |
| Start a fresh game with an empty board and score. | |
| float | simulation_time = 0.0 |
| Start a fresh game with an empty board and score. | |
Protected Member Functions | |
| bool | _clear_flash_visible (self) |
| bool | _collides (self, int x, int y, tuple[tuple[int, int],...] cells) |
| None | _draw_cell (self, int color, int board_x, int board_y, int left, int top, int cell_size) |
| float | _fall_interval (self) |
| None | _finish_line_clear (self) |
| Path | _font_path (self) |
| None | _hard_drop (self) |
| None | _lock_piece (self) |
| bool | _move (self, int offset_x, int offset_y) |
| None | _new_piece (self) |
| None | _rotate (self) |
| None | _simulate_step (self) |
| None | _update (self) |
| None mxvk_wrap.examples.tetris.main.TetrisGame.__init__ | ( | self | ) |
A playable 2D Tetris window using mxvk_wrap graphics.
Definition at line 53 of file main.py.
|
protected |
|
protected |
Definition at line 125 of file main.py.
|
protected |
Definition at line 268 of file main.py.
|
protected |
|
protected |
Definition at line 177 of file main.py.
|
protected |
Definition at line 91 of file main.py.
|
protected |
Definition at line 193 of file main.py.
|
protected |
Definition at line 165 of file main.py.
|
protected |
Definition at line 140 of file main.py.
|
protected |
Definition at line 115 of file main.py.
|
protected |
Definition at line 151 of file main.py.
|
protected |
Definition at line 207 of file main.py.
|
protected |
Definition at line 222 of file main.py.
| None mxvk_wrap.examples.tetris.main.TetrisGame.draw | ( | self | ) |
Definition at line 278 of file main.py.
| None mxvk_wrap.examples.tetris.main.TetrisGame.on_event | ( | self, | |
| event ) |
Definition at line 233 of file main.py.
| None mxvk_wrap.examples.tetris.main.TetrisGame.reset | ( | self | ) |
Definition at line 99 of file main.py.
| str mxvk_wrap.examples.tetris.main.TetrisGame.asset_dir = Path(__file__).resolve().parent / "data" |
| mxvk_wrap.examples.tetris.main.TetrisGame.background = mx.Sprite(self, self.asset_dir / "psychedelic_background.png", vertex_shader=str(self.asset_dir / "sprite.vert.spv"), fragment_shader=str(self.asset_dir / "background.frag.spv")) |
| mxvk_wrap.examples.tetris.main.TetrisGame.background_start_time = time.monotonic() |
| list mxvk_wrap.examples.tetris.main.TetrisGame.blocks = [mx.Sprite(self, self.asset_dir / path) for path in BLOCK_FILES] |
| mxvk_wrap.examples.tetris.main.TetrisGame.cells = () |
| mxvk_wrap.examples.tetris.main.TetrisGame.clear_block = mx.Sprite(self, self.asset_dir / "block_gray.png") |
| mxvk_wrap.examples.tetris.main.TetrisGame.clear_started = 0.0 |
| tuple mxvk_wrap.examples.tetris.main.TetrisGame.clearing_rows = () |
| float mxvk_wrap.examples.tetris.main.TetrisGame.fall_elapsed = 0.0 |
| float mxvk_wrap.examples.tetris.main.TetrisGame.frame_accumulator = 0.0 |
| bool mxvk_wrap.examples.tetris.main.TetrisGame.game_over = False |
| mxvk_wrap.examples.tetris.main.TetrisGame.grid = [] |
| mxvk_wrap.examples.tetris.main.TetrisGame.last_frame_time = time.monotonic() |
| int mxvk_wrap.examples.tetris.main.TetrisGame.level = 1 |
| int mxvk_wrap.examples.tetris.main.TetrisGame.lines = 0 |
| mxvk_wrap.examples.tetris.main.TetrisGame.mouse_pressed = False |
| mxvk_wrap.examples.tetris.main.TetrisGame.mouse_x = 0.0 |
| mxvk_wrap.examples.tetris.main.TetrisGame.mouse_y = 0.0 |
| int mxvk_wrap.examples.tetris.main.TetrisGame.next_color = 0 |
| mxvk_wrap.examples.tetris.main.TetrisGame.piece_color = 0 |
| mxvk_wrap.examples.tetris.main.TetrisGame.piece_x = 0 |
| mxvk_wrap.examples.tetris.main.TetrisGame.piece_y = 0 |
| int mxvk_wrap.examples.tetris.main.TetrisGame.score = 0 |
| float mxvk_wrap.examples.tetris.main.TetrisGame.simulation_time = 0.0 |