CSC3221_Programming_For_Games_Shapes / Project2 / Shape.cpp
Shape.cpp
Raw
#include "Shape.h"
#include <iostream>

/*Default constructor*/
Shape::Shape(void) {
	position.shapeTop = 0;
	position.shapeBottom = 0;
	position.shapeLeft = 0;
	position.shapeRight = 0;
	xBounds = true;
	yBounds = true;
}

/*Set constructor with values*/
Shape::Shape(const float x, const float y, const float width, const float height) {
	position.shapeTop = y + height;
	position.shapeBottom = y;
	position.shapeLeft = x;
	position.shapeRight = x + width;
	xBounds = true;
	yBounds = true;
}

/*Destructor*/
Shape::~Shape(void) {
}

/*Update the x and y values*/
void Shape::moveShape(const float x, const float y) {
	position.shapeTop += y;
	position.shapeBottom += y;
	position.shapeLeft += x;
	position.shapeRight += x;
}

/*equal (==) operator*/
bool Shape::operator==(const Shape &square) const {
	return (this == &square) ? true : false;
}

/*not equal (!=) operator*/
bool Shape::operator!=(const Shape &square) const {
	return (this == &square) ? false : true;
}