factoriax.playground.editor.inventory_panel#
The inventory panel, at the right edge of the editor.
The panel shows the contents of the selected player or machine, as a grid of slots. Each slot holds the icon of the item, the count, and the name. A machine slot also holds a badge that gives the part the slot has in the recipe.
The panel returns a click region for each slot, so the editor can find the slot that the user selects.
- factoriax.playground.editor.inventory_panel.render_inventory_panel(state: EditorState, target: tuple[str, int, int], focused_slot: int, panel_w: int, panel_h: int) tuple[ndarray, list[ClickRegion]]#
Render the right-side inventory panel for the active target.
The panel holds a header that names the player or the machine, and then a grid of slots.
- Parameters:
state – Editor state to read.
target – Player or machine to show.
focused_slot – Index of the slot to draw as focused. A value of -1 focuses no slot.
panel_w – Panel width in pixels.
panel_h – Panel height in pixels.
- Returns:
The RGBA panel, and one click region for each slot that it drew.
- Return type: