#pragma once

#include <d3dx9math.h>
#include "..\Utilities\util.h"

struct DXVector2
{
	float x;
	float y;

	DXVector2() {}
	DXVector2(const float _x, const float _y);
	DXVector2(const float* const v);
	DXVector2(const DXVector2 &v);

	//casting
	operator float* ();
	operator const float* () const;
	operator D3DXVECTOR2* ();
	operator const D3DXVECTOR2* () const;
	operator D3DXVECTOR2 () const;

    // assignment operators
    DXVector2& operator += (const DXVector2&);
    DXVector2& operator -= (const DXVector2&);
    DXVector2& operator *= (const float);
    DXVector2& operator /= (const float);

    // unary operators
    DXVector2 operator + () const;
    DXVector2 operator - () const;

    // binary operators
    DXVector2 operator + (const DXVector2&) const;
    DXVector2 operator - (const DXVector2&) const;
    DXVector2 operator * (const float) const;
    DXVector2 operator / (const float) const;

    friend DXVector2 operator * (const float, const DXVector2&);

    bool operator == (const DXVector2&) const;
    bool operator != (const DXVector2&) const;

	//calculations
	float Dot(const DXVector2& vec) const;
	float Length(void) const;

	static DXVector2 Min(const DXVector2&, const DXVector2&);
	static DXVector2 Max(const DXVector2&, const DXVector2&);
};

#include "DXVector2.inl"
