// This was generated by project/codegen/engine_gen.cpp
#pragma once
#if INTELLISENSE_DIRECTIVES
#include "vectors.hpp"
#endif

struct Pos2_f32
{
	union
	{
		struct
		{
			f32 x;
			f32 y;
		};

		f32 Basis[ 2 ];
	};

	operator Vec2_f32()
	{
		return *rcast( Vec2_f32*, this );
	}
};

using Dist2_f32 = f32;

inline Dist2_f32 distance( Pos2_f32 a, Pos2_f32 b )
{
	f32       x      = b.x - a.x;
	f32       y      = b.y - a.y;
	Dist2_f32 result = sqrt( x * x + y * y );
	return result;
}

struct Vel2_f32
{
	union
	{
		struct
		{
			f32 x;
			f32 y;
		};

		f32 Basis[ 2 ];
	};

	operator Vec2_f32()
	{
		return *rcast( Vec2_f32*, this );
	}
};

inline Vel2_f32 velocity( Pos2_f32 a, Pos2_f32 b )
{
	Vec2_f32 result = b - a;
	return pcast( Vel2_f32, result );
}

inline Pos2_f32& operator+=( Pos2_f32& pos, Vel2_f32 const& vel )
{
	pos.x += vel.x;
	pos.y += vel.y;
	return pos;
}

inline Vel2_f32& operator*=( Vel2_f32& v, f32 s )
{
	v.x *= s;
	v.y *= s;
	return v;
}

struct Accel2_f32
{
	union
	{
		struct
		{
			f32 x;
			f32 y;
		};

		f32 Basis[ 2 ];
	};

	operator Vec2_f32()
	{
		return *rcast( Vec2_f32*, this );
	}
};

inline Accel2_f32 acceleration( Vel2_f32 a, Vel2_f32 b )
{
	Vec2_f32 result = b - a;
	return pcast( Accel2_f32, result );
}

struct Pos2_s32
{
	union
	{
		struct
		{
			s32 x;
			s32 y;
		};

		s32 Basis[ 2 ];
	};

	operator Vec2_s32()
	{
		return *rcast( Vec2_s32*, this );
	}
};

using Dist2_s32 = s32;

inline Dist2_s32 distance( Pos2_s32 a, Pos2_s32 b )
{
	s32       x      = b.x - a.x;
	s32       y      = b.y - a.y;
	Dist2_s32 result = sqrt( x * x + y * y );
	return result;
}

struct Vel2_s32
{
	union
	{
		struct
		{
			s32 x;
			s32 y;
		};

		s32 Basis[ 2 ];
	};

	operator Vec2_s32()
	{
		return *rcast( Vec2_s32*, this );
	}
};

inline Vel2_s32 velocity( Pos2_s32 a, Pos2_s32 b )
{
	Vec2_s32 result = b - a;
	return pcast( Vel2_s32, result );
}

inline Pos2_s32& operator+=( Pos2_s32& pos, Vel2_s32 const& vel )
{
	pos.x += vel.x;
	pos.y += vel.y;
	return pos;
}

inline Vel2_s32& operator*=( Vel2_s32& v, s32 s )
{
	v.x *= s;
	v.y *= s;
	return v;
}

struct Accel2_s32
{
	union
	{
		struct
		{
			s32 x;
			s32 y;
		};

		s32 Basis[ 2 ];
	};

	operator Vec2_s32()
	{
		return *rcast( Vec2_s32*, this );
	}
};

inline Accel2_s32 acceleration( Vel2_s32 a, Vel2_s32 b )
{
	Vec2_s32 result = b - a;
	return pcast( Accel2_s32, result );
}

using Pos2    = Pos2_f32;
using Dist2   = Dist2_f32;
using Vel2    = Vel2_f32;
using Accel2  = Accel2_f32;
using Pos2i   = Pos2_s32;
using Dist2i  = Dist2_s32;
using Vel2i   = Vel2_s32;
using Accel2i = Accel2_s32;
