[squeak-dev] input from mouse and keyboard

Ralph Boland rpboland at gmail.com
Wed Mar 9 04:20:19 UTC 2016


In a real time game I am creating I need to be able to get input from
both the keyboard and
the mouse (by player pressing buttons displayed on the screen).  The
game requires immediate responses to both.
If the user provides no input the game continues and actions occur
(eventually killing the player).

For the keyboard input I seem to be need to be in some kind of loop:
1)  sleep for some small amount of time; if during the sleep some
keyboard input arrives respond to the input and then  goto 1.
2)  Since there has been no keyboard input take any necessary game
actions and then goto 1.

If a button is pressed then take necessary game actions and then
ensure that the above loop is at the beginning of the sleep.

IS THERE ANY SAMPLES OF CODE SOMEWHERE THAT DOES THIS KIND OF THING?

I could figure this out eventually but it will take a while and I will
probably do a poor implementation.

Note:
There are many slow points in the game where a forced garbage
collection can be performed so garbage collection
delays should not be problem.



Thanks

Ralph Boland


More information about the Squeak-dev mailing list