Basic SDL drawing
In the previous chapter we created an SDL window but we have yet to render anything to the screen. SDL can use two structures to draw to the screen. One is the SDL_Surface
structure, which contains a collection of pixels and is rendered using software rendering processes (not the GPU). The other is SDL_Texture
; this can be used for hardware-accelerated rendering. We want our games to be as efficient as possible so we will focus on using SDL_Texture
.
Getting some images
We need some images to load throughout this chapter. We do not want to spend any time creating art assets for our games at this point; we want to focus entirely on the programming side. In this book we will use assets from the SpriteLib
collection available at http://www.widgetworx.com/widgetworx/portfolio/spritelib.html.
I have altered some of these files to allow us to easily use them in the upcoming chapters. These images are available with the source code download for this book. The first one we will use...