/******************************************************************************
*	File		-	types.h
*	Author		-	Joey Pollack
*	Date		-	2021/08/30 (y/m/d)
*	Mod Date	-	2021/09/02 (y/m/d)
*	Description	-	Defines some generic types for use through out the engine.
******************************************************************************/

#ifndef TYPES_H_
#define TYPES_H_

#include <cstdint>
#include <glm/glm.hpp>

namespace lunarium
{
    ///////////////////////////////////////////////////////
    //          SIZE
    //////////////////////////////////////////////////////
    template <typename T>
    struct Size
    {
        T Width;
        T Height;
    };

    typedef Size<int> Sizei;
    typedef Size<unsigned> Sizeu;
    typedef Size<float> Sizef;
    /////////////////////////////////////////////////

    /////////////////////////////////////////////////
    //          COLOR
    /////////////////////////////////////////////////
    struct Color
	{
		union
		{
			float arr[4];

			struct
			{
				float Red;
				float Green;
				float Blue;
				float Alpha;
			};
		};

		Color();
		Color(float _r, float _g, float _b, float _a = 1.0f);
	};
    /////////////////////////////////////////////////


    /////////////////////////////////////////////////
    //          RECTANGLE
    /////////////////////////////////////////////////
    struct Rectangle
	{
		float Left;
		float Top;
		float Width;
		float Height;

		float right() const { return Left + Width; }
		float bottom() const { return Top + Height; }

		Rectangle();
		Rectangle(float _left, float _top, float _width, float _height);

		float Area() const;
        bool ContainsPoint(glm::vec2 point) const;

        // centers will be filled out with a vector the goes from the other
        // Rectangle's center to the invoking object's center.
        // This could be used for determining the angle of the intersection.
        bool Intersects(const Rectangle& other, glm::vec2& centers) const;
	};
    /////////////////////////////////////////////////
}

#endif // TYPES_H_