CS224 Homework 3-A Drawing Program Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

Rate this product

This assignment introduces SDL which is a C++ library for game development. We will use it later for our project. You will need to read the SDL tutorials. Lessons 1 and 6 contain instructions on setting up SDL and the extension library, SDL image, which are needed for this assignment.

A Drawing Program

In this assignment, you will be creating a drawing program. A basic version is provided in the accompanying folder Artistik. When run, it launches a white window in which you can draw a red rectangle by left clicking the mouse, dragging, then releasing.

Your will be extending this program as follows. Currently, every new shape overwrites the previous one. When you are done, the program will render each shape as either a line or a rectangle and all drawn shapes will be rendered. The user will be able to reset the window to clear all the drawn shapes and draw new ones. Each shape will be of a different color.

Your tasks are as follows.

  • Read the SDL tutorials up to Lesson 10 in order to understand and run the given code.
  • Declare a Shape class and inherit the classes Rect and Line from it. Line drawing is covered in the SDL tutorials above.
  • Write a linked list in which each node stores a Shape*. Every added shape is stored in this list.
  • Allow the user to switch between line and rectangle Line mode will be specified by pressing l or L and rectangle mode by pressing m or M.
  • Assign a random color to each newly drawn shape. Use the Color object in Shape for the purpose.
  • Allow the user to delete the most recently drawn shape by pressing d or D. Shapes can be deleted until no shapes are left, after which deleting has no effect.
  • Allow the user to switch the rendering order of the shapes. By default, shapes are rendered in the order in which they are added. That is, the more recent shape is rendered later and ends up occluding the overlapping portions of any previous shapes. Pressing s or S switches the rendering order.
  • Ensure that there are no memory leaks.
  • Artisik-bsflvo.zip