-
Book Overview & Buying
-
Table Of Contents
Mastering Android Game Development
By :
Until now, we have been using standard views and translating them to render the different elements of the game. While this is an easy way to draw elements on the screen, it is far from being efficient. We are relying on the system layout to do the drawing.
While this technique is fine for a turn-based game or any non-real-time game in general, it cannot render enough frames per second for a real-time game.
Working with standard Views is fine for non-real-time games.
We are going to create a custom View that we are going to call GameView. This view will be responsible for drawing the sprites.
We already noted the duplication of code and mentioned the concept of sprite in the previous chapter. We will now move forward and create a Sprite class that will take care of drawing an image at specific coordinates inside the GameView.
There are two ways of drawing at low level on Android. They are:
View and overriding onDrawSurfaceView and using SurfaceHolderIn both...
Change the font size
Change margin width
Change background colour