Gameplay de la recherche dans les dossiers #44

Merged
CoCo_Sol merged 32 commits from directory-search into main 2023-10-30 00:49:00 +00:00
Showing only changes of commit cde504640e - Show all commits

View file

@ -12,6 +12,8 @@ from engine import (
Order,
Position,
Scene,
Text,
TextSize,
Texture,
Vec2,
World,
@ -59,6 +61,15 @@ class DirectoryPosition:
return False
class DirectoryName:
"""
Composant qui marque une entité comme étant le nom d'un dossier.
"""
def __init__(self, entity: Entity):
self.entity = entity
def __initialize_world(world: World):
"""
Initialise le monde de la scène.
@ -66,7 +77,7 @@ def __initialize_world(world: World):
world[State] = State.WAITING
for y in range(__LINES):
for x in range(__COLUMNS):
world.create_entity(
entity = world.create_entity(
Position(0, 0),
Order(1),
Centered(),
@ -75,6 +86,15 @@ def __initialize_world(world: World):
DirectoryPosition(x, y),
)
world.create_entity(
Position(0, 0),
Order(1),
Centered(),
Text("Nom du dossier"),
TextSize(25),
DirectoryName(entity),
)
def __move_directories(world: World):
"""
@ -169,6 +189,16 @@ def __update_positions(world: World):
entity[Order] = Order(position.y + 1)
def __update_directory_names(world: World):
"""
Met à jour la position des noms des dossiers.
"""
for entity in world.query(DirectoryName):
directory_entity = entity[DirectoryName].entity
entity[Position] = Position(directory_entity[Position] + Vec2(0, 75))
entity[Order] = directory_entity[Order]
SCENE = (
Scene(
[__initialize_world],
@ -176,4 +206,9 @@ SCENE = (
[],
)
+ smooth.PLUGIN
+ Scene(
[],
[__update_directory_names],
[],
)
)