ecs #58

Merged
raphael merged 70 commits from ecs into main 2023-11-03 15:29:36 +00:00
Showing only changes of commit 96bb74d246 - Show all commits

View file

@ -5,6 +5,7 @@ Definit un plugin qui crée un texte avec les touches frappées
from engine import Scene, World from engine import Scene, World
from plugins.inputs import Pressed from plugins.inputs import Pressed
from plugins.text import Text from plugins.text import Text
from scenes import CLICK_SOUND
class Writing: class Writing:
@ -31,6 +32,7 @@ def __update(world: World):
for key in pressed: for key in pressed:
if key == "backspace": if key == "backspace":
text.text = text.text[:-1] text.text = text.text[:-1]
world.new_entity().set(CLICK_SOUND)
if key.startswith("["): # pavé numerique if key.startswith("["): # pavé numerique
key = key[1] key = key[1]
if key in writing.accepted_chars and ( if key in writing.accepted_chars and (
@ -40,6 +42,7 @@ def __update(world: World):
text.text = key text.text = key
else: else:
text.text += key text.text += key
world.new_entity().set(CLICK_SOUND)
if text.text == "": if text.text == "":
text.text = writing.base_text text.text = writing.base_text