diff --git a/assets/sounds/backspace.wav b/assets/sounds/backspace.wav new file mode 100644 index 0000000..c7234e1 Binary files /dev/null and b/assets/sounds/backspace.wav differ diff --git a/src/plugins/typing.py b/src/plugins/typing.py index 761fa09..7caa63d 100644 --- a/src/plugins/typing.py +++ b/src/plugins/typing.py @@ -2,7 +2,7 @@ Definit un plugin qui crée un texte avec les touches frappées """ -from engine import Keyboard, Scene, Text, World +from engine import Keyboard, Scene, Sound, Text, World class Typing(str): @@ -20,10 +20,12 @@ def __update(world: World): text = entity[Text] for key in keyboard.pressed: if key == "backspace": + world.create_entity(Sound("backspace.wav")) text = text[:-1] if key.startswith("["): # pavé numerique key = key[1] if key in entity[Typing]: + world.create_entity(Sound("click.wav")) text += key entity[Text] = Text(text)