add skin_config.json

This commit is contained in:
Anthony Samms
2025-11-17 02:31:51 -05:00
parent 4f0f952a6d
commit 5d8124bd45
9 changed files with 42 additions and 35 deletions

View File

@@ -5,7 +5,7 @@ from libs.utils import global_tex
logger = logging.getLogger(__name__)
class Chara2D:
def __init__(self, index: int, bpm: float, path: str = 'chara'):
def __init__(self, index: int, bpm: float = 100, path: str = 'chara'):
"""
Initialize a Chara2D object.
@@ -67,7 +67,7 @@ class Chara2D:
self.current_anim = name
self.anims[name].start()
logger.debug(f"Animation set: {name}")
def update(self, current_time_ms: float, bpm: float, is_clear: bool, is_rainbow: bool):
def update(self, current_time_ms: float, bpm: float = 100, is_clear: bool = False, is_rainbow: bool = False):
"""
Update the character's animation state and appearance.

View File

@@ -45,12 +45,12 @@ class Nameplate:
"""Unload the Nameplate object."""
self.name.unload()
self.title.unload()
def draw(self, x: int, y: int, fade: float = 1.0):
def draw(self, x: float, y: float, fade: float = 1.0):
"""Draw the Nameplate object.
Args:
x (int): The x-coordinate of the Nameplate object.
y (int): The y-coordinate of the Nameplate object.
x (float): The x-coordinate of the Nameplate object.
y (float): The y-coordinate of the Nameplate object.
fade (float): The fade value of the Nameplate object.
"""
tex = global_tex
@@ -103,7 +103,7 @@ class Indicator:
self.blue_arrow_move.update(current_time_ms)
self.blue_arrow_fade.update(current_time_ms)
def draw(self, x: int, y: int, fade=1.0):
def draw(self, x: float, y: float, fade=1.0):
"""Draw the indicator at the given position with the given fade."""
tex = global_tex
tex.draw_texture('indicator', 'background', x=x, y=y, fade=fade)
@@ -156,7 +156,7 @@ class EntryOverlay:
def update(self, current_time_ms: float):
"""Update the Banapass and Camera status icons."""
pass
def draw(self, x: int = 0, y: int = 0):
def draw(self, x: float = 0, y: float = 0):
"""Draw the Banapass and Camera status icons."""
tex = global_tex
tex.draw_texture('overlay', 'banapass_or', x=x, y=y, frame=self.online)

View File

@@ -16,6 +16,11 @@ SCREEN_HEIGHT = 720
logger = logging.getLogger(__name__)
class Coordinates:
def __init__(self, x: float, y: float):
self.x = x
self.y = y
class Texture:
"""Texture class for managing textures and animations."""
def __init__(self, name: str, texture: Union[ray.Texture, list[ray.Texture]], init_vals: dict[str, int]):
@@ -41,7 +46,13 @@ class TextureWrapper:
def __init__(self):
self.textures: dict[str, dict[str, Texture]] = dict()
self.animations: dict[int, BaseAnimation] = dict()
self.skin_config: dict[str, Coordinates] = dict()
self.graphics_path = Path("Graphics")
if (self.graphics_path / "skin_config.json").exists():
data = json.loads((self.graphics_path / "skin_config.json").read_text())
self.skin_config: dict[str, Coordinates] = {
k: Coordinates(v['x'], v['y']) for k, v in data.items()
}
def unload_textures(self):
"""Unload all textures and animations."""