/*
 * Collision.cpp
 *
 *  Created on: Mar 8, 2020
 *      Author: ayoungblood
 */

#include "Collision.h"
#include "../ecs/ColliderComponent.h"

bool Collision::AABB(const SDL_Rect& recA, const SDL_Rect& recB)
{
	if(
		recA.x + recA.w > recB.x &&
		recB.x + recB.w > recA.x &&
		recA.y + recA.h > recB.y &&
		recB.y + recB.h > recA.y
	)
    {
		return true;
	}
	return false;
}

bool Collision::AABB(const ColliderComponent& colA, const ColliderComponent& colB)
{
	if(AABB(colA.collider, colB.collider))
	{
//		std::cout << colA.tag << " hit: " << colB.tag << std::endl;
// 	if(recA.x + recA.w >= recB.x) { printf("LeftCollision"); }
// 	if(recB.x + recB.w >= recA.x) { printf("RightCollision"); }
// 	if(recA.y + recA.h >= recB.y) { printf("TopCollision"); }
// 	if(recB.y + recB.h >= recA.y) { printf("BottomCollision"); }
		return true;
	}
	else
	{
		return false;
	}
}
