Comment + unique_ptr issue + correct horse battery staple

This commit is contained in:
Tyler Beckman 2024-11-18 00:18:28 -07:00
parent 99f1a4863a
commit 764f468028
Signed by: Ty
GPG key ID: 2813440C772555A4
19 changed files with 222 additions and 220 deletions

View file

@ -1,8 +1,10 @@
/** /**
* @author Tyler Beckman (tyler_beckman@mines.edu) * @author Tyler Beckman (tyler_beckman@mines.edu)
* @brief A program template for CSCI200 * @brief A program to read polygon points and colors from a data file and
* display them utilizing the SFML library, validating all shapes at each point
* during processing.
* @version 1 * @version 1
* @date 2024-09-21 * @date 2024-11-11
*/ */
#include "Coordinate.h" #include "Coordinate.h"
@ -64,10 +66,10 @@ int main(void) {
currentPolygon = std::make_unique<Rhombus>(); currentPolygon = std::make_unique<Rhombus>();
break; break;
default: default:
std::cout << "polygon is invalid - \"" << type << " " << x1 std::cout << "polygon is invalid - \"" << type << " " << x1 << " " << y1
<< " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << " "
<< " " << y3 << " " << x4 << " " << y4 << " " << r << x4 << " " << y4 << " " << r << " " << g << " " << b << "\""
<< " " << g << " " << b << "\"" << std::endl; << std::endl;
continue; continue;
} }
@ -80,20 +82,20 @@ int main(void) {
currentPolygon->setColor(sf::Color(r, g, b)); currentPolygon->setColor(sf::Color(r, g, b));
if (!currentPolygon->validate()) { if (!currentPolygon->validate()) {
std::cout << "polygon is invalid - \"" << type << " " << x1 << " " std::cout << "polygon is invalid - \"" << type << " " << x1 << " " << y1
<< y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3; << " " << x2 << " " << y2 << " " << x3 << " " << y3;
if (x4 != -1) { if (x4 != -1) {
std::cout << " " << x4 << " " << y4; std::cout << " " << x4 << " " << y4;
} }
std::cout << " " << r << " " << g << " " << b << "\"" << std::endl; std::cout << " " << r << " " << g << " " << b << "\"" << std::endl;
} else { } else {
polygonList.push_back(currentPolygon); polygonList.push_back(std::move(currentPolygon));
} }
}; };
// Start SFML Rendering logic // Start SFML Rendering logic
sf::RenderWindow window( sf::RenderWindow window(
sf::VideoMode(640, 640), ":3", sf::VideoMode(640, 640), "correct horse battery staple",
sf::Style::Titlebar | sf::Style::Close // Disable window resize sf::Style::Titlebar | sf::Style::Close // Disable window resize
); );
window.setVerticalSyncEnabled(true); window.setVerticalSyncEnabled(true);