This commit is contained in:
Isuru Samarathunga
2025-10-12 16:39:29 +05:30
parent 09131d7fab
commit 4380705f81
18 changed files with 511 additions and 94 deletions

View File

@ -37,6 +37,20 @@ namespace ia::iae
#endif
}
Direction Engine::GetVectorPointingDirection(IN Vec2 v)
{
STATIC CONSTEXPR Direction DIRECTION_MAP[] = {Direction::RIGHT, Direction::DOWN_RIGHT, Direction::DOWN, Direction::DOWN_LEFT,
Direction::LEFT, Direction::UP_LEFT, Direction::UP, Direction::UP_RIGHT};
if ((abs(v.x) <= FLOAT32_EPSILON) && (abs(v.y) <= FLOAT32_EPSILON))
return Direction::NONE;
auto angle = glm::degrees(atan2(v.y, v.x));
if (angle < 0)
angle += 360;
return DIRECTION_MAP[INT32((angle + 22.5) / 45) % 8];
}
VOID Engine::ResizeDisplay(IN INT32 newWidth, IN INT32 newHeight)
{
Renderer::WaitForGPUIdle();