O'Reilly logo

Lua Game Development Cookbook by Mário Kašuba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Surfaces manipulation

The basic surface manipulation usually consists of filling the part or whole surface with color, which can be in fact clearing the surface, and copying the surface content into another surface. As you already know, the surface can also represent the screen content. With these two groups of operations you can do almost anything.

Getting ready

In this recipe, you'll be working with routines that require a definition of a rectangular area over which the operation will occur. The libSDL library uses its own SDL_Rect object to define such a rectangular area. You can create this object either with SDL.SDL_Rect_new or SDL.SDL_Rect_local. The second one is preferred because it contains an automatic garbage collection routine, so you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required