factoriax.playground.ui.forms#
Shared visual constants and drawing primitives for menu/launch forms.
Holds the colour palette, base layout sizes, and small drawing helpers
used by multiple menu screens (the play launch screen and the controls
screen). Sizes are expressed in base pixels and multiplied by
factoriax.playground.ui.theme.UI_SCALE at runtime by each caller.
- factoriax.playground.ui.forms.draw_button(surface: Surface, rect: Rect, text: str, font: Font, hovered: bool) None#
Draw a button with gold border, optional hover highlight.
- Parameters:
surface – Destination surface.
rect – Button bounding rectangle.
text – Button label.
font – Font for the label.
hovered – Whether the mouse is over the button.
- factoriax.playground.ui.forms.draw_checkbox(surface: Surface, x: int, y: int, size: int, checked: bool, hovered: bool) Rect#
Draw a checkbox square and return its bounding rect.
- Parameters:
surface – Destination surface.
x – Left edge in pixels.
y – Top edge in pixels.
size – Side length of the checkbox in pixels.
checked – Whether the box is checked.
hovered – Whether the mouse is over the checkbox area.
- Return type:
The bounding rectangle of the checkbox.
- factoriax.playground.ui.forms.draw_scrollbar(surface: Surface, scroll_offset: int, max_scroll: int, content_h: int, top_bar_h: int) None#
Draw a scrollbar at the right edge, for content taller than the view.
- Parameters:
surface – Target surface.
scroll_offset – Current scroll position.
max_scroll – Maximum scroll offset.
content_h – Total content height.
top_bar_h – Height of the top bar (scrollbar starts below it).