Book Image

Mastering Android Game Development

By : Raul Portales
Book Image

Mastering Android Game Development

By: Raul Portales

Overview of this book

Table of Contents (18 chapters)
Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
API Levels for Android Versions
Index

Chapter 7. Menus and Dialogs

Now that the game works, it is time to tweak the rest of the UI. When you make an app, the best practice is to use all the standard UI components. Games are different, they should have personality. For this we are going to see how to use custom fonts, buttons, and dialogs.

We will start by making all the fragments of the game use a custom font. Then we will tweak the main menu to make it look nicer by adding a background and customizing the buttons for sound and music; we will also customize the button that starts the game using special drawable types we can define in XML.

For GameFragment, we will make space to display the score and lives and will update the pause button as well. We will make the game take care of scoring and player deaths. For this we will also see how to use GameEvents, not just for playing sounds, but also for extending the functionality, and adding a few events.

We will also make GameController take more responsibility for the game situation...