nqp.ui_elements.generic package¶
Submodules¶
nqp.ui_elements.generic.fancy_font module¶
- class FancyFont(text: str, pos: pygame.Vector2, line_width: int = 0, font_effects: Optional[List[FontEffects]] = None)[source]¶
Bases:
object
A font with effects. Use ‘<![font_name]>’ in the text to indicate which font to use for the following characters. Fonts names are ‘small’, ‘big’ or ‘red’. e.g. text=’this is <!red> red’. New lines are indicated with ‘n’.
- __init__(text: str, pos: pygame.Vector2, line_width: int = 0, font_effects: Optional[List[FontEffects]] = None)[source]¶
- draw(surface: pygame.Surface)[source]¶
nqp.ui_elements.generic.font module¶
- class Font(path: str, colour: Tuple[int, int, int], text: str, line_width: int = 0, pos: pygame.Vector2 = (0, 0))[source]¶
Bases:
object
- __init__(path: str, colour: Tuple[int, int, int], text: str, line_width: int = 0, pos: pygame.Vector2 = (0, 0))[source]¶
- draw(surface: pygame.Surface)[source]¶
nqp.ui_elements.generic.ui_frame module¶
- 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]¶
nqp.ui_elements.generic.ui_input_box module¶
- 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¶
nqp.ui_elements.generic.ui_panel module¶
- 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.
nqp.ui_elements.generic.ui_tooltip module¶
- 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]¶
nqp.ui_elements.generic.ui_window module¶
- 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]¶