Skip to content
Snippets Groups Projects

Resolve "Cashe loaded gui images"

Merged Fabian Heinrich requested to merge 46-cashe-loaded-gui-images into main
1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
@@ -248,17 +248,20 @@ class PyGameGUI:
holding_item_pos = player.pos + (20 * player.facing_direction)
self.draw_item(holding_item_pos, player.holding)
def draw_thing(self, pos: npt.NDArray[float], parts: list[dict[str]], scale=1.0):
def draw_thing(
self, pos: npt.NDArray[float], parts: list[dict[str]], scale: float = 1.0
):
"""Draws an item, based on its visual parts specified in the visualization config.
Args:
pos: Where to draw the item parts.
parts: The visual parts to draw.
scale: Rescale the item by this factor.
"""
for part in parts:
part_type = part["type"]
if part_type == "image":
self.draw_image(parts[0]["path"], parts[0]["size"], pos)
self.draw_image(parts[0]["path"], parts[0]["size"] * scale, pos)
elif part_type == "rect":
height = part["height"]
width = part["width"]
@@ -296,6 +299,7 @@ class PyGameGUI:
Args:
pos: The position of the item to draw.
item: The item do be drawn in the game.
scale: Rescale the item by this factor.
"""
if not isinstance(item, Meal):
Loading