Game Development Reference
In-Depth Information
After this, a new row is started in which the second button widget is added using the
Options style. Each event handler calls a separate method to make it easier for us to
maintain the code of the layer and the code to handle events. The onPlayClicked()
method will switch to the game screen, while the onOptionsClicked() method is
intentionally left empty for the moment.
Adding the Options window layer
The Options window layer is going to be a lot more complex in comparison to
all the other layers that we have implemented so far. There are also some further
preparations required before we can continue to implement this layer.
Here is a screenshot to give you a better idea of how the finished Options
window will look:
The Options window will be a small box that shows a title bar with text on it and
has some empty space to hold additional widgets. It can be dragged on the title bar
to move it around in the scene. There will be a checkbox to enable and disable the
Sound and Music effects as well as a slider to adjust the volume, respectively. A
character skin can be chosen from a drop-down list. The current selection is shown
next to it in a small preview image. The preview image is updated whenever a new
selection in the drop-down list has been made to reflect the change. Lastly, there is
another checkbox that toggles to check whether the FPS counter will be displayed on
the game screen.
 
Search WWH ::




Custom Search