[squeak-dev] Oddities with #keyDown and Sensor
Lawson English
lenglish5 at cox.net
Fri Sep 23 19:15:14 UTC 2011
I've been playing with creating a simple 2D asteroids type game in
Squeak, and when it came time to try to monitor how long the accelerator
key for the rocket (up arrow in this case) had been pressed, I ran into
all sorts of oddities.
On an intel Mac OS X 10.6.8 box, running various Cog VMs, I found that
the event passed to #keyDown: contained zero as the value, regardless of
which key was pressed.
On Linux, this problem seems not to exist.
Again on the Mac, this test class http://paste.lisp.org/display/124816
doesn't seem to work.
I was trying to grab the raw Sensor event buffer, but I can't seem to
get more than a handful of events.
#step is where the meat of the code is. It tries to grab events from
Sensor and if they are keyboard events, put them into a buffer for
examination.
You evoke the test morph thusly:
myMorph := MyMorph new.
myMorph openInWorld.
Transcript show: myMorph aCounter.
Transcript show: myMorph eventBuffer.
Obviously, I'm doing something fundamentally wrong (or the MacOS X bug
for #keyDown manifests directly with Sensor).
Help?
THanks
Lawson.
More information about the Squeak-dev
mailing list
|