mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
revert
This commit is contained in:
parent
e6a2b474e6
commit
12776ee181
@ -1,7 +1,4 @@
|
||||
from abc import ABC, ABCMeta, abstractmethod
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
from abc import ABC, ABCMeta, abstractmethod
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
import pygame
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
import pygame
|
||||
from utils import CONFIG
|
||||
@ -6,9 +6,6 @@ from utils import CONFIG
|
||||
from .base import BaseScreen, SceenElement, TextScreen
|
||||
from .base_button import BaseButton
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
|
||||
class Button(BaseButton, BaseScreen, SceenElement, TextScreen):
|
||||
def __init__(self, text: str, action: Optional[Callable[[], Optional[Any]]]) -> None:
|
||||
|
||||
@ -1,18 +1,13 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Any
|
||||
|
||||
import pygame
|
||||
from utils import CONFIG, GameMode
|
||||
from utils import CONFIG, Figure, GameMode
|
||||
|
||||
from .base import BaseScreen
|
||||
from .preview import Preview
|
||||
from .score import Score
|
||||
from .tetris import Tetris
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
|
||||
from utils import Figure
|
||||
|
||||
|
||||
class Game(BaseScreen):
|
||||
"""
|
||||
@ -56,14 +51,12 @@ class Game(BaseScreen):
|
||||
|
||||
def run(self) -> None:
|
||||
"""Run a single iteration of the game loop."""
|
||||
self.draw()
|
||||
|
||||
self.tetris.run()
|
||||
self.score.run()
|
||||
self.preview.update(self.next_figure)
|
||||
self.preview.run()
|
||||
|
||||
self.draw()
|
||||
self.clock.tick(CONFIG.game.fps)
|
||||
|
||||
def mute(self) -> None:
|
||||
|
||||
@ -1,19 +1,14 @@
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional
|
||||
|
||||
import pygame
|
||||
from loguru import logger
|
||||
from utils import CONFIG, read_settings
|
||||
from utils import CONFIG, GameMode, read_settings
|
||||
|
||||
from .base import BaseScreen, SceenElement, TextScreen
|
||||
from .button import Button
|
||||
from .game import Game
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
|
||||
from utils import GameMode
|
||||
|
||||
|
||||
class Main(BaseScreen, SceenElement, TextScreen):
|
||||
"""
|
||||
|
||||
@ -1,13 +1,8 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pygame
|
||||
from utils import CONFIG
|
||||
from utils import CONFIG, Figure
|
||||
|
||||
from .base import BaseScreen, SceenElement
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from utils import Figure
|
||||
|
||||
|
||||
class Preview(BaseScreen, SceenElement):
|
||||
"""
|
||||
|
||||
@ -1,20 +1,15 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
import numpy as np
|
||||
import pygame
|
||||
from loguru import logger
|
||||
from utils import CONFIG, Direction, Figure, GameMode, Rotation
|
||||
|
||||
from game.sprites import Tetromino
|
||||
from game.sprites import Block, Tetromino
|
||||
from game.timer import Timer, Timers
|
||||
|
||||
from .base import BaseScreen
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from game.sprites import Block
|
||||
|
||||
|
||||
class Tetris(BaseScreen):
|
||||
"""
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pygame
|
||||
from utils import CONFIG, Rotation
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional
|
||||
|
||||
import numpy as np
|
||||
import pygame
|
||||
from utils import CONFIG, Rotation
|
||||
|
||||
|
||||
class Block(pygame.sprite.Sprite):
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pygame
|
||||
from utils import CONFIG, Direction, Figure, Rotation
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
import numpy as np
|
||||
import pygame
|
||||
from utils import CONFIG, Direction, Figure, Rotation
|
||||
|
||||
from .block import Block
|
||||
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Any, Callable, NamedTuple, Optional
|
||||
|
||||
import pygame
|
||||
from attrs import define, field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Callable, NamedTuple, Optional
|
||||
|
||||
|
||||
@define
|
||||
class Timer:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from pathlib import Path
|
||||
|
||||
from attr import define
|
||||
from pygame import Vector2 as Vec2
|
||||
|
||||
from .colors import COLOR_DICT, TokyoNightNight
|
||||
from .colors.tokyonight.base import Color
|
||||
@ -8,12 +9,6 @@ from .path import BASE_PATH
|
||||
from .settings import read_settings
|
||||
from .tuples import Size
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
from pygame import Vector2 as Vec2
|
||||
|
||||
|
||||
PADDING = 20
|
||||
|
||||
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
import random
|
||||
from enum import Enum
|
||||
from typing import TYPE_CHECKING, NamedTuple
|
||||
from typing import NamedTuple
|
||||
|
||||
import pygame
|
||||
from pygame import Vector2 as Vec2
|
||||
|
||||
from .colors import TokyoNightNight
|
||||
from .path import BASE_PATH
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pygame import Vector2 as Vec2
|
||||
|
||||
|
||||
class FigureConfig(NamedTuple):
|
||||
"""
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import toml
|
||||
from loguru import logger
|
||||
|
||||
from .path import BASE_PATH
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
def save_settings(settings: dict[str, Any], file_path: Path) -> None:
|
||||
"""
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
from typing import TYPE_CHECKING, NamedTuple
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Union
|
||||
from typing import NamedTuple, Union
|
||||
|
||||
|
||||
class Size(NamedTuple):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user