This commit is contained in:
Isuru Samarathunga
2025-10-21 21:03:40 +05:30
parent 86ed9346aa
commit 2d5875d211
11 changed files with 239 additions and 165 deletions

View File

@ -29,7 +29,7 @@
namespace ia::iae
{
EXTERN SDL_Window *g_windowHandle;
SIZE_T g_resourceNameCounter {1};
SIZE_T g_resourceNameCounter{1};
Vec2 g_sceneScalingFactor{1.0f};
Vec2 g_sceneDesignViewport{1.0f};
@ -72,6 +72,11 @@ namespace ia::iae
return result;
}
Vec2 Engine::CalculatePercentPosition(IN Vec2 percent)
{
return Vec2{Renderer::s_activeSceneDesignViewport.x/100.0f, Renderer::s_activeSceneDesignViewport.y/100.0f} * percent;
}
Direction Engine::GetVectorPointingDirection(IN Vec2 v)
{
STATIC CONSTEXPR Direction DIRECTION_MAP[] = {Direction::RIGHT, Direction::DOWN_RIGHT, Direction::DOWN,
@ -105,7 +110,8 @@ namespace ia::iae
return handle;
const auto extent = GetImageExtent(handle);
const auto newHandle = ResourceManager::RescaleImage(
handle, {(FLOAT32) resizeToWidth / (FLOAT32) extent.x, (FLOAT32) resizeToHeight / (FLOAT32) extent.y}, true);
handle, {(FLOAT32) resizeToWidth / (FLOAT32) extent.x, (FLOAT32) resizeToHeight / (FLOAT32) extent.y},
true);
return newHandle;
}