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