Pages

Saturday, 28 March 2020

Chapter 12 // Exercise 13 - Principles & Practice Using C++

In this exercise I am using Visual Studio 2017 and the graphics files found here:
https://github.com/l-paz91/principles-practice/tree/master/Graphics%20Files

Chapter 12 // Exercise 13

Find a way to add color to the lines from the previous exercise. Make some lines one color and other lines another color or other colors.

Github: https://github.com/l-paz91/principles-practice/blob/master/Chapter%2012/Exercise%2013

A closed polyline is basically just a sequence of lines so in theory we should be able to set each line colour...in theory. The problem is that Shape only has 1 colour member that it uses for the entire object. Therefore we need to change the closed polyline to just lines so we can individually set each lines colour. It ended up a little hacky looking but it works.

Chapter 12 // Exercise 13 - Principles & Practice Using C++

No comments:

Post a Comment