Comment attendre un clic ou une touche en même temps ?
interagir maToile, [touches] dans action, x, y attend le premier événement :
- un clic sur la toile : action vaut 0, x et y reçoivent les coordonnées ;
- une touche de la liste : action vaut son numéro (1, 2…), x et y valent -1.
maToile est une toile
dimension(maToile, 300, 200)
remplir(maToile, #1E2430)
affiche maToile
action, x, y est un nombre
interagir maToile, ['z', 's', 'd', 'q'] dans action, x, y
si action = 0 alors
affiche 'Clic en ' + x + ' ; ' + y
sinon
affiche 'Touche numéro ' + action
fin siLes trois variables doivent être des nombres ; la virgule après la toile et les crochets sont obligatoires.