-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Небольшая оптмизация класса текстур и выкидыш аудио (#3)
### Описание PR'ра Оптимизирован немного класс текстур (его надо переписывать) Сделан выкидыш класса текстур ### Техническая информация - [x] PR полностью завершён. - [x] Мне **НЕ** нужна помощь для завершения PR. - [ ] Проверено на локальной машине. - [ ] Документация обновлена. <!-- при условии, что это применимо --> - [x] Тесты обновлены / добавлены. <!-- при условии, что это применимо --> ### Изменения changes: NOT
- Loading branch information
1 parent
b3ad230
commit 1ff33a4
Showing
8 changed files
with
110 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from pydub import AudioSegment | ||
from pydub.playback import play | ||
|
||
|
||
class AudioManager: | ||
__slots__ = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from systems.texture_system.color import Color | ||
from systems.texture_system.texture_system import TextureSystem | ||
|
||
__all__ = ['Color', 'TextureSystem'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from typing import Tuple | ||
|
||
|
||
class Color: | ||
__slots__ = ['_r', '_g', '_b', '_a'] | ||
|
||
def __init__(self, r: int, g: int, b: int, a: int) -> None: | ||
self.r = r | ||
self.g = g | ||
self.b = b | ||
self.a = a | ||
|
||
@property | ||
def r(self) -> int: | ||
return self._r | ||
|
||
@r.setter | ||
def r(self, value: int) -> None: | ||
if not (0 <= value <= 255): | ||
raise ValueError("Invalid value for r. It must be between 0 and 255") | ||
|
||
self._r = value | ||
|
||
@property | ||
def g(self) -> int: | ||
return self._g | ||
|
||
@g.setter | ||
def g(self, value: int) -> None: | ||
if not (0 <= value <= 255): | ||
raise ValueError("Invalid value for g. It must be between 0 and 255") | ||
|
||
self._g = value | ||
|
||
@property | ||
def b(self) -> int: | ||
return self._b | ||
|
||
@b.setter | ||
def b(self, value: int) -> None: | ||
if not (0 <= value <= 255): | ||
raise ValueError("Invalid value for b. It must be between 0 and 255") | ||
|
||
self._b = value | ||
|
||
@property | ||
def a(self) -> int: | ||
return self._a | ||
|
||
@a.setter | ||
def a(self, value: int) -> None: | ||
if not (0 <= value <= 255): | ||
raise ValueError("Invalid value for a. It must be between 0 and 255") | ||
|
||
self._a = value | ||
|
||
def __str__(self) -> str: | ||
return f"{self.r}_{self.g}_{self.b}_{self.a}" | ||
|
||
def __repr__(self) -> str: | ||
return f"Color(r={self.r}, g={self.g}, b={self.b}, a={self.a})" | ||
|
||
@staticmethod | ||
def from_tuple(value: Tuple[int, int, int, int]) -> "Color": | ||
return Color(value[0], value[1], value[2], value[3]) | ||
|
||
def to_tuple(self) -> Tuple[int, int, int, int]: | ||
return (self.r, self.g, self.r, self.a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
msgpack | ||
Pillow | ||
pydub | ||
PyQt6 | ||
PyYAML | ||
requests |