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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.