next up previous contents
Next: Starting the game Up: The buttons function Previous: Creating an array of

Binding the buttons

This looks rather complicated but does nothing more than what we did above when we bound the smiley button to the event startClick. First, we arrange our buttons in an array so we can later on refer to the button at position (x,y) easier. Then we bind three events to each of the buttons: one for releasing the first (left) button, one for releasing the third (right) button, one for pressing any button. The left and right clicks are of type Event (Int, Int), because we will later on have refer to the coordinates of a button being released.

Christoph Lueth
Wed May 29 13:20:38 MEST 2002