next up previous contents
Next: Creating an array of Up: The HsMines Game Previous: The field

The buttons function

This function has a rather complex signature.



For reference recall how it was called:



We have a class constraint on the first argument, par, which has to be container. par happens to be just that, a Frame. Lucky us. The next argument has to be a button as we can happily admit our smiley button sm is. The third argument has to be an event, more precisely Event Int. This event signals that the game should be restarted with the difficulty level given; in the call, this is the event which signals receiving something in the restartCh channel (recall from above how we send something along this channel to restart the game).

buttons creates all the buttons, and returns a list of pairs, where each of these pairs contains the coordinates (as a pair of integers) and the button. We can see that it is simpler to examine the signature ourself than try to puzzle out what we just read.

The code of buttons is simple at start.





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