Adding clouds, a tree, and a buzzing bee

First we will add a tree. This is going to be really easy. The reason it's easy is because the tree doesn't move. We will use exactly the same procedure that we used in the previous chapter when we drew the background.

Preparing the tree

Add the following highlighted code. Notice the un-highlighted code, which is the code that we have already written. This should help you identify that the new code should be typed immediately after we set the position of the background, but before the start of the main game loop. We will recap what is actually going on in the new code after you have added it:

int main() { // Create a video mode object VideoMode vm(1920, 1080); // Create and open a window for the game RenderWindow ...

Get Beginning C++ Game Programming 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.