[etoys-dev] Handling keyboard events

Ricardo Moran richi.moran at gmail.com
Wed Jul 28 13:38:38 EDT 2010


Hi guys,

I may have diverged from the actual GSoC requirements but yesterday I was
looking at Morphic events and I made this simple object called KeyboardMorph
which I believe it could be useful to handle keyboard events better than
what we currently have.

I made an Asteroids remake to test it:
http://tecnodacta.com.ar/gira/gsoc/Asteroids.051.pr. I did this project some
time ago and I felt really dissapointed at that time because Etoys keyboard
support wasn't enough to play with it so I made it work with a joystick. Now
you can choose between joystick or keyboard :)

Please note that to handle multiple keys simultaneously the KeyboardMorph
has a set of boolean slots to test if a specific key is currently pressed or
not. I only added support for number, letters, and a few special keys
(space, enter, arrows). I think this is more than enough for most purposes.
I also added a currentKeyValue slot which returns the key value of the
currently pressed key.

I know different keyboards have different layouts, maybe we can make
specific KeyboardMorphs for each supported layout. What do you think?

Cheers
Richo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/etoys-dev/attachments/20100728/08115ec4/attachment.html>


More information about the etoys-dev mailing list