Game Development Reference
In-Depth Information
at least once before the Screen is asked to present itself. That's why we call these two methods
in the AndroidGame.setScreen() method on the new Screen . The AndroidGame class takes care
of everything.
public Screen getCurrentScreen() {
return screen;
}
}
The last method is the getCurrentScreen() method , which simply returns the currently
active Screen .
Finally, remember that AndroidGame derives from Game , which has another method called
getStartScreen() . This is the method we have to implement to get things going for our game!
Now, we've created an easy-to-use Android game development framework. All we need to do is
implement our game's Screen s. We can also reuse the framework for any future games, as long
as they do not need immense graphics power. If that is necessary, we have to use OpenGL ES.
However, to do this, we only need to replace the graphics part of our framework. All the other
classes for audio, input, and file I/O can be reused.
Summary
In this chapter, we implemented a full-fledged 2D Android game development framework from
scratch that can be reused for all future games (as long as they are graphically modest). Great
care was taken to achieve a good, extensible design. We could take the code and replace the
rendering portions with OpenGL ES, thus making Mr. Nom 3D.
With all this boilerplate code in place, let's concentrate on what we are here for: writing games!
 
Search WWH ::




Custom Search