#ifndef _H_DIRECTION_H
#define _H_DIRECTION_H

#include <cmath>

enum class Direction {

	None = 0,
	Down = 1, 
	Right = 2, 
	Left = 3, 
	Up = 4
};

static Direction getDirectionFromRotation(float rotation) {
	double normalizedRot = std::fmod(rotation + 360, 360);
	if ((normalizedRot >= 337.5) || (normalizedRot < 22.5))
		return Direction::Right;
	else if ((normalizedRot >= 22.5) && (normalizedRot < 157.5))
		return Direction::Down;
	else if ((normalizedRot >= 157.5) && (normalizedRot < 247.5))
		return Direction::Left;
	else if ((normalizedRot >= 247.5) && (normalizedRot < 337.5))
		return Direction::Up;
	
	return Direction::Down;
}

#endif // _H_DIRECTION_H