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 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue