Source and destination rectangles
Now that we have something drawn to the screen, it is a good idea to cover the purpose of source and destination rectangles, as they will be extremely important for topics such as tile map loading and drawing. They are also important for sprite sheet animation which we will be covering later in this chapter.
We can think of a source rectangle as defining the area we want to copy from a texture onto the window:
- In the previous example, we used the entire image so we could simply define the source rectangle's dimensions with the same dimensions as those of the loaded texture.
- The red box in the preceding screenshot is ...