Base class for UI overlays with lifecycle, fade, positioning, and cleanup.
def __init__(self: Any, x: int = 0, y: int = 0, width: int = 1, height: int = 1, pivot: Any = (0, 0), element_id: Optional[str] = None, layer: LayerType = LayerType.POPUP, fade_duration: float = 0.15) -> Any
def opacity(self: Any) -> float
def show(self: Any) -> None
def hide(self: Any) -> None
def set_position(self: Any, x: int, y: int) -> None
def cleanup_on_hide(self: Any) -> None
def update_overlay_fade(self: Any, dt: float) -> None
def update(self: Any, dt: float, input_state: InputState) -> None
Configuration class for tooltip appearance and behavior.
Allows easy customization of tooltips without passing multiple parameters.
def __init__(self: Any, text: str = '', font_size: int = 14, padding: int = 8, corner_radius: int = 4, offset_x: int = 10, offset_y: int = 10, show_delay: float = 0.5, max_width: int = 300, theme: ThemeType = None) -> Any
Tooltip element that displays helpful information when hovering over UI elements.
Automatically adjusts position to stay within screen boundaries.
def __init__(self: Any, config: TooltipConfig = None, element_id: Optional[str] = None) -> Any
def _calculate_size(self: Any) -> Any
def _wrap_text(self: Any, text: str, font: Any) -> List[str]
def set_text(self: Any, text: str) -> Any
def set_config(self: Any, config: TooltipConfig) -> Any
def set_target(self: Any, element: UIElement) -> Any
def update_tooltip(self: Any, inputState: InputState, dt: float, screen_width: int, screen_height: int) -> bool
def _update_position(self: Any, screen_width: int, screen_height: int, mouse_pos: Tuple[int, int]) -> Any
def update_theme(self: Any, theme_type: ThemeType) -> Any
def render(self: Any, renderer: Any) -> Any
def _render_wrapped_text(self: Any, renderer: Any, x: int, y: int, theme: Any) -> Any
Manages tooltips globally to ensure proper display and positioning.
Supports multiple tooltips for different UI elements.
_instance: Any = None
_tooltips: Dict[str, Tooltip] = {}
_active_tooltip: Optional[Tooltip] = None
def __new__(cls: Any) -> Any
def register_tooltip(cls: Any, element: UIElement, tooltip: Tooltip) -> Any
def unregister_tooltip(cls: Any, element: UIElement) -> Any
def update_all_themes(cls: Any, theme_type: ThemeType | ThemeKey) -> Any
def update(cls: Any, engine: 'LunaEngine', dt: float) -> Any
def get_tooltip_to_render(cls: Any, engine: 'LunaEngine') -> List[Tooltip]
def render(cls: Any, renderer: Any) -> Any
def clear_all(cls: Any) -> Any
Types of notifications with different visual styles.
SUCCESS: Any = auto()
INFO: Any = auto()
WARNING: Any = auto()
ERROR: Any = auto()
CUSTOM: Any = auto()
No methods defined.
Pre-defined notification positions.
TOP_LEFT: Any = 'top_left'
TOP_CENTER: Any = 'top_center'
TOP_RIGHT: Any = 'top_right'
CENTER_LEFT: Any = 'center_left'
CENTER: Any = 'center'
CENTER_RIGHT: Any = 'center_right'
BOTTOM_LEFT: Any = 'bottom_left'
BOTTOM_CENTER: Any = 'bottom_center'
BOTTOM_RIGHT: Any = 'bottom_right'
CUSTOM: Any = 'custom'
No methods defined.
Style configuration for different notification types.
def __init__(self: Any, bg_color: Tuple[int, int, int], border_color: Tuple[int, int, int], text_color: Tuple[int, int, int], icon_type: Optional[Icon] = None, duration: float = 5.0, show_icon: bool = True) -> Any
No documentation
def __init__(self: Any, text: str, notification_type: NotificationType = NotificationType.INFO, duration: Optional[float] = None, position: Union[NotificationPosition, Tuple[int, int]] = NotificationPosition.TOP_RIGHT, width: int = 300, height: int = 60, show_close_button: bool = True, auto_close: bool = True, animation_speed: float = 0.3, show_progress_bar: bool = False, on_close: Optional[Callable] = None, on_click: Optional[Callable] = None, metadata: Any = None, custom_icon: Optional[Icon] = None) -> Any
Single notification element with advanced positioning and animations.
STYLES: Any = {NotificationType.SUCCESS: NotificationStyle(bg_color=(46, 204, 113), border_color=(39, 174, 96), text_color=(255, 255, 255), icon_type=Icons.SUCCESS, duration=3.0, show_icon=True), NotificationType.INFO: NotificationStyle(bg_color=(52, 152, 219), border_color=(41, 128, 185), text_color=(255, 255, 255), icon_type=Icons.INFO, duration=5.0, show_icon=True), NotificationType.WARNING: NotificationStyle(bg_color=(241, 196, 15), border_color=(243, 156, 18), text_color=(0, 0, 0), icon_type=Icons.WARN, duration=7.0, show_icon=True), NotificationType.ERROR: NotificationStyle(bg_color=(231, 76, 60), border_color=(192, 57, 43), text_color=(255, 255, 255), icon_type=Icons.ERROR, duration=10.0, show_icon=True), NotificationType.CUSTOM: NotificationStyle(bg_color=(149, 165, 166), border_color=(127, 140, 141), text_color=(255, 255, 255), icon_type=Icons.INFO, duration=5.0, show_icon=True)}
def __init__(self: Any, config: NotificationConfig, engine: 'LunaEngine', theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def _get_theme_based_style(self: Any) -> NotificationStyle
def _calculate_target_position(self: Any) -> Tuple[int, int]
def _calculate_start_position(self: Any) -> Tuple[int, int]
def _create_ui(self: Any) -> Any
def _apply_custom_style(self: Any) -> Any
def show(self: Any) -> Any
def close(self: Any) -> Any
def force_close(self: Any) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def _ease_out(self: Any, t: float) -> float
def _ease_in(self: Any, t: float) -> float
def should_remove(self: Any) -> bool
def get_opacity(self: Any) -> float
def render(self: Any, renderer: Any) -> Any
Manages all notifications globally with queue support.
Handles positioning, stacking, and lifecycle of notifications.
_instance: Any = None
def __new__(cls: Any) -> Any
def _initialize(self: Any) -> Any
def set_engine(self: Any, engine: 'LunaEngine') -> Any
def show_notification(self: Any, config: NotificationConfig) -> Notification
def _show_notification_immediate(self: Any, notification: Notification) -> Any
def _update_notification_positions(self: Any, position: NotificationPosition) -> Any
def show_simple_notification(self: Any, text: str, notification_type: NotificationType = NotificationType.INFO, duration: Optional[float] = None, position: Union[NotificationPosition, Tuple[int, int]] = NotificationPosition.TOP_RIGHT) -> Notification
def remove_notification(self: Any, notification: Notification) -> Any
def clear_all(self: Any) -> Any
def clear_by_type(self: Any, notification_type: NotificationType) -> Any
def _process_queue(self: Any) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Any) -> Any
def get_notification_count(self: Any) -> int
def get_queue_length(self: Any) -> int
def has_notifications(self: Any) -> bool
def has_queued_notifications(self: Any) -> bool
def set_max_concurrent(self: Any, max_count: int) -> Any
def set_default_margin(self: Any, margin: int) -> Any
def set_spacing(self: Any, spacing: int) -> Any
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.
_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.'}}
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
def _sm(self: Any) -> float
def font_size(self: Any) -> int
def name_font_size(self: Any) -> int
def padding(self: Any) -> int
def name_padding(self: Any) -> int
def corner_radius(self: Any) -> int
def corner_radius(self: Any, value: int) -> Any
def font(self: Any) -> pygame.font.Font
def name_font(self: Any) -> pygame.font.Font
def _get_init_args(self: Any) -> Dict[str, Any]
def set_text(self: Any, text: str, speaker_name: str = '', instant: bool = False) -> None
def set_animation(self: Any, animation_type: str, speed: int = 30) -> None
def skip_animation(self: Any) -> None
def advance(self: Any) -> bool
def set_on_complete(self: Any, callback: Callable[[], None]) -> None
def set_on_advance(self: Any, callback: Callable[[], None]) -> None
def update(self: Any, dt: float, inputState: InputState) -> None
def render(self: Any, renderer: OpenGLRenderer) -> None
def _render_wrapped_text(self: Any, renderer: OpenGLRenderer, x: int, y: int, width: int, height: int, theme: Any) -> None
def show_notification(text: str, notification_type: NotificationType = NotificationType.INFO, duration: Optional[float] = None, position: Union[NotificationPosition, Tuple[int, int]] = NotificationPosition.TOP_RIGHT) -> Notification
Convenience function to show a simple notification.
Args:
text: Notification text
notification_type: Type of notification
duration: Optional custom duration
position: Position for notification
Returns:
The created Notification object
def show_error(text: str, duration: Optional[float] = None, position: Union[NotificationPosition, Tuple[int, int]] = NotificationPosition.TOP_RIGHT) -> Notification
Show an error notification.
def show_warning(text: str, duration: Optional[float] = None, position: Union[NotificationPosition, Tuple[int, int]] = NotificationPosition.TOP_RIGHT) -> Notification
Show a warning notification.
def show_success(text: str, duration: Optional[float] = None, position: Union[NotificationPosition, Tuple[int, int]] = NotificationPosition.TOP_RIGHT) -> Notification
Show a success notification.
def show_info(text: str, duration: Optional[float] = None, position: Union[NotificationPosition, Tuple[int, int]] = NotificationPosition.TOP_RIGHT) -> Notification
Show an info notification.
def clear_all_notifications() -> Any
Clear all notifications.
def get_notification_count() -> int
Get the current number of active notifications.
def get_queue_length() -> int
Get the current queue length.