Game Development Reference
In-Depth Information
Next up is our implementation of the update() method, where we load the assets and settings.
For the image assets, we simply create new Pixmap s via the Graphics.newPixmap() method. Note
that we specify which color format the Pixmap s should have. The background has an RGB565
format, and all other images have an ARGB4444 format (if the BitmapFactory respects our hint).
We do this to conserve memory and increase our rendering speed a little later on. Our original
images are stored in RGB888 and ARGB8888 formats, as PNGs. We also load in the three sound
effects and store them in the respective members of the Assets class. Next, we load the settings
from the external storage via the Settings.load() method. Finally, we initiate a screen transition
to a Screen called MainMenuScreen , which will take over execution from that point on.
public void present( float deltaTime) {
}
public void pause() {
}
public void resume() {
}
public void dispose() {
}
}
The other methods are just stubs and do not perform any actions. Since the update() method
will immediately trigger a screen transition after all assets are loaded, there's nothing more to do
on this screen.
The Main Menu Screen
The main menu screen is pretty dumb. It just renders the logo, the main menu options, and the
sound setting in the form of a toggle button. All it does is react to touches on either the main
menu options or the sound setting toggle button. To implement this behavior, we need to know
two things: where on the screen we render the images, and what the touch areas are that will
either trigger a screen transition or toggle the sound setting. Figure 6-2 shows where we'll render
the different images on the screen. From that we can directly derive the touch areas.
 
Search WWH ::




Custom Search