dialogs.py

No documentation

class DialogBox

Description

RPG-style dialog box with multiple display styles and text animations.
Supports typewriter effect, fade-in, and character-by-character display.

Internal metrics (padding, name_padding, corner radius, indicator size,
shadow distance, and the hard-coded font sizes) scale with the current
ratio because the user cannot change them.

Attributes
_properties: Dict[str, Dict[str, Any]] = {**UIElement._properties, 'dialog_style': {'name': 'Dialog style', 'key': 'dialog_style', 'type': str, 'editable': True, 'description': 'Visual style: "default", "rpg", "pokemon", "modern".', 'options': ['default', 'rpg', 'pokemon', 'modern']}, 'text': {'name': 'text', 'key': 'text', 'type': str, 'editable': True, 'description': 'The dialog text content.'}, 'speaker_name': {'name': 'speaker name', 'key': 'speaker_name', 'type': str, 'editable': True, 'description': 'Name of the speaker displayed above the box.'}, 'animation_type': {'name': 'animation type', 'key': 'animation_type', 'type': str, 'editable': True, 'description': 'Type of text animation: "typewriter".'}, 'animation_speed': {'name': 'animation speed', 'key': 'animation_speed', 'type': int, 'editable': True, 'description': 'Characters per second for typewriter effect.'}}
Methods
def __init__(self: Any, x: int, y: int, width: int, height: int, dialog_style: Literal['default', 'rpg', 'pokemon', 'modern'] = 'default', theme: Optional[ThemeType] = None, element_id: Optional[str] = None) -> None
No documentation
def _sm(self: Any) -> float
No documentation
def font_size(self: Any) -> int
No documentation
def name_font_size(self: Any) -> int
No documentation
def padding(self: Any) -> int
No documentation
def name_padding(self: Any) -> int
No documentation
def corner_radius(self: Any) -> int
No documentation
def corner_radius(self: Any, value: int) -> Any
No documentation
def font(self: Any) -> pygame.font.Font
No documentation
def name_font(self: Any) -> pygame.font.Font
No documentation
def _get_init_args(self: Any) -> Dict[str, Any]
No documentation
def set_text(self: Any, text: str, speaker_name: str = '', instant: bool = False) -> None
No documentation
def set_animation(self: Any, animation_type: str, speed: int = 30) -> None
No documentation
def skip_animation(self: Any) -> None
No documentation
def advance(self: Any) -> bool
No documentation
def set_on_complete(self: Any, callback: Callable[[], None]) -> None
No documentation
def set_on_advance(self: Any, callback: Callable[[], None]) -> None
No documentation
def update(self: Any, dt: float, inputState: InputState) -> None
No documentation
def render(self: Any, renderer: OpenGLRenderer) -> None
No documentation
def _render_wrapped_text(self: Any, renderer: OpenGLRenderer, x: int, y: int, width: int, height: int, theme: Any) -> None
No documentation
Back to Ui Module