next up previous contents
Next: Playing the game Up: The buttons function Previous: Binding the buttons

Starting the game

We now define three events (and a couple of auxiliary functions) which encode the main logic of the game. The first one starts the game, the third and second play the game. Then, if we synchronise on the start event, we set the game in motion and in effect wait until it is over.

All of these definitions are local to buttons and use the declarations from above, such as leCl, riCl and bArr.

This says: after the start event (the argument of which is d here, the difficulty level), we create the mines on the playing field, make the smiley smile, and fill all buttons with the zero image. Have a look at how we create the mines later, it is of no importance for the GUI. Then we play.

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