Centrage des dossiers

This commit is contained in:
Tipragot 2023-10-29 20:09:30 +01:00
parent 43813c824e
commit 51d529d547

View file

@ -21,6 +21,8 @@ from plugins import smooth
__LINES = 3
__COLUMNS = 5
__WAITING_SPACING = 150
__SEARCHING_SPACING = 200
class State(Enum):
@ -156,12 +158,15 @@ def __update_positions(world: World):
"""
for entity in world.query(DirectoryPosition):
position = entity[DirectoryPosition]
offset = Vec2(-300, -50) if world[State] == State.WAITING else Vec2(-300, -75)
size = Vec2(150, 100) if world[State] == State.WAITING else Vec2(150, 150)
size = Vec2(
__WAITING_SPACING if world[State] == State.WAITING else __SEARCHING_SPACING
)
offset = -(size * Vec2(__COLUMNS - 1, __LINES - 1) / 2)
first_position = Vec2(Display.WIDTH / 2, Display.HEIGHT / 2) + offset
entity[smooth.Target] = smooth.Target(
first_position + Vec2(position.x, position.y) * size
)
entity[Order] = Order(position.y + 1)
SCENE = (