Surface and Canvas

We saw how to create images and buttons using components from our palette in an Android app. However, this concept is a bit different in games. In games, we work with something known as a Canvas, which is used to draw images onto our Surface. To give you a basic understanding, a Surface is anything that holds pixels onto it. Basically, a Surface holds your Canvas, which then maps it onto your views. All of your image manipulations are is based on this. So, for the purpose of drawing anything in our game, we will use a SurfaceView component.

Get Learning Android Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.