Пример #1
0
bool operator==(const Vector2d& a, const Vector2d& b) {
    //Implement Here.
    if (a.get_x() == b.get_x() && a.get_y() == b.get_y())
        return true;
    else
        return false;

}
Пример #2
0
bool Game_Object::intersects_point(Vector2d& point)
{
	if (point.get_x() > position.get_x() - width / 2.0
		&& point.get_x() < position.get_x() + width / 2.0
		&& point.get_y() > position.get_y() - height / 2.0
		&& point.get_y() < position.get_y() + height / 2.0
	   )
	{
		return true;
	}

	return false;
}
Пример #3
0
// operator overloading of '=='
bool operator==(const Vector2d& a, const Vector2d& b) {
    return (a.get_x()==b.get_x() && a.get_y()==b.get_y());
}
Пример #4
0
bool operator>(const Vector2d& a, const Vector2d& b){
    return a.get_y() > b.get_y();
}
Пример #5
0
Vector2d operator-(const Vector2d& a, const Vector2d& b) {
    //return subtract(a, b);
    return Vector2d((a.get_x() - b.get_x()), (a.get_y() - b.get_y()));
}
Пример #6
0
Vector2d subtract(const Vector2d& a, const Vector2d& b) {
    //Implement Here.
    return Vector2d((a.get_x() - b.get_x()), (a.get_y() - b.get_y()));

}
Пример #7
0
Vector2d add(const Vector2d& a, const Vector2d& b) { //const indicates that parameters that are const cannot be changed
    //Implement Here.
    return Vector2d((a.get_x() + b.get_x()), (a.get_y() + b.get_y()));
}