Lab 8: Drawing Shapes with SDL

Introduction
This lab will introduce you to the SDL (Simple DirectMedia Layer) API (Application Programming Interface) and will give you practice with C++ Inheritance. 

Concepts
The SDL concepts you will use in this lab are:
•	Creating an SDL project in Code::Blocks
•	Initializing SDL for use with your program
•	Drawing shapes using the SDL_gfx libraries
•	The basic graphics loop of:
1.	Clear surface
2.	Move
3.	Draw
4.	Flip
5.	Get Events

The C++ concepts you will use in this lab are:
•	Inheritance
•	Polymorphism
•	Virtual functions
•	Virtual base class

Objective
The object of this lab is to write a program that displays 15 shapes: 5 circles, 5 squares, and 5 rectangles. Each type of shape will be a different color and all the shapes will be moving around the screen at in various ways. Here are the specific requirements:
•	All the shapes will inherit from a virtual base class called Shape. 
•	Each type of shape (square, rectangle, and circle) will be a different color.
•	Each type of shape will have a different rule for what to do when it reaches the edge of the screen:
o	Rectangles wrap around and come back in on the other side of the screen.
o	Squares bounce in a clockwise direction
o	Circles bounce in a counterclockwise direction
•	Each instance of a type of shape will move at a different speed. 
•	Optional: Initially draw each instance of each shape in a different location.
•	Optional: Start each instance of each shape moving in a different direction.

Instructions
1.	Start by opening  the SDL Shapes_stubs project in Code::Blocks. This project already has the SDL initialization code, the header for the Shapes class and stubs for all the functions. This project will compile and run, but doesn’t display anything on the screen.
2.	Complete the Shapes class
a.	Complete all the functions necessary to draw two instances of a shape on the screen.
b.	Add code to make one of the instances of the shape move.
c.	Now that you have tested your Shape class, remove the implementation of move() function and turn it into a virtual function.
3.	Add a Rectangle class
a.	Write a class called Rectangle that inherits from Shape.
b.	Test drawing a rectangle
c.	Test moving the rectangle
d.	Now add code to the move() function that will cause the rectangle to 
4.	Add code in main that uses polymorphism to display the different shapes
a.	Add an array that will hold all the instances of each type of shape
b.	Call draw and move on each object in a loop
c.	Find a way to move each object at a different speed.
5.	Add a Square class
a.	The squares should bounce when they reach the edge of the screen. (If it isn’t clear to you which way is clockwise, don’t worry about it. The main point is to have squares and circles bouncing in opposite directions.)
6.	Add a Circle class
a.	The circles should bounce when they reach the edge of the screen. (Just make sure they bounce in the opposite direction as the squares.

Submission
When you are finished upload a zipped copy of your Code::Blocks project to moodle (delete the obj and bin folders before zipping the project.)