Generic¶
Fancy Font¶
Font¶
UI Frame¶
- class UIFrame(game: Game, pos: pygame.Vector2, font: None | Font | FancyFont = None, is_selectable: bool = False, max_width: Optional[int] = None, max_height: Optional[int] = None, image: None | Image | Animation = None, text_relative_position: TextRelativePosition = None, tooltip_key: str | None = None)[source]¶
Bases:
nqp.base_classes.ui_element.UIElement
A complex ui element. Works as an extension of UIElement to offer more functionality within a helpful wrapper.
- __init__(game: Game, pos: pygame.Vector2, font: None | Font | FancyFont = None, is_selectable: bool = False, max_width: Optional[int] = None, max_height: Optional[int] = None, image: None | Image | Animation = None, text_relative_position: TextRelativePosition = None, tooltip_key: str | None = None)[source]¶
- add_tier_background(tier: int)[source]¶
Add a background to the frame, based on the tier given. Tiers can be 1-4.
- draw(surface: pygame.Surface)[source]¶
UI Input Box¶
- class UIInputBox(game, size: pygame.math.Vector2, pos: pygame.math.Vector2 = <Vector2(0, 0)>, colour=(255, 255, 255), input_type='all', text='', font=None)[source]¶
Bases:
object
- __init__(game, size: pygame.math.Vector2, pos: pygame.math.Vector2 = <Vector2(0, 0)>, colour=(255, 255, 255), input_type='all', text='', font=None)[source]¶
- property should_focus¶
- property value¶
UI Panel¶
- class UIPanel(game: Game, elements: List[UIElementLike], is_active: bool = False)[source]¶
Bases:
object
A container class for UIElements. Offers support for selection management. Note that UIPanel doesnt have a position or size so one is inferred from it’s contained elements.
- draw(surface: pygame.Surface)[source]¶
- set_selected_index(new_index: int)[source]¶
Change selection to a given index. Note: Don’t use within panel due to recursion issues.
UI Tooltip¶
- class UITooltip(game: Game, pos: pygame.Vector2, tooltip_key: str | None = None, tooltip_content: Tuple[str, str, str] | None = None)[source]¶
Bases:
nqp.ui_elements.generic.ui_window.UIWindow
A UIWindow subclass for showing specific information about a hovered item.
Needs either tooltip_key or tooltip_content. tooltip_key takes precedent over tooltip_content, if both are provided only the key is used.
- __init__(game: Game, pos: pygame.Vector2, tooltip_key: str | None = None, tooltip_content: Tuple[str, str, str] | None = None)[source]¶
Needs either tooltip_key or tooltip_content. tooltip_key takes precedent over tooltip_content, if both are provided only the key is used.
- draw(surface: pygame.Surface)[source]¶
UI Window¶
- class UIWindow(game: Game, window_type: WindowType, pos: pygame.Vector2, size: pygame.Vector2, elements: List[UIElementLike], is_active: bool = False)[source]¶
Bases:
nqp.ui_elements.generic.ui_panel.UIPanel
A more feature rich UIPanel, containing its own visual style.
- __init__(game: Game, window_type: WindowType, pos: pygame.Vector2, size: pygame.Vector2, elements: List[UIElementLike], is_active: bool = False)[source]¶
- draw(surface: pygame.Surface)[source]¶