INNER CODE UNIT · C++

aspectRatio

denyskryvytskyi/ElvenEngine · Engine/src/Core/Application.cpp:68

    const float aspectRatio = static_cast<float>(gEngineSettings.windowWidth) / static_cast<float>(gEngineSettings.windowHeight);
    cameraComponent.camera.SetProjection(-aspectRatio * gEngineSettings.orthographicCameraSize, aspectRatio * gEngineSettings.orthographicCameraSize, -gEngineSettings.orthographicCameraSize, gEngineSettings.orthographicCameraSize, -10.0f, 10.0f);

    // fps counter
    if (gEngineSettings.enableFpsCounter) {
        m_fpsCounterEntityId = scene.CreateEntity();
        scene.AddComponent<TagComponent>(m_fpsCounterEntityId, "FPS text");
        scene.AddComponent<UITransformComponent>(m_fpsCounterEntityId, lia::vec2(0.5f, 97.0f), lia::vec2(0.4f, 0.4f));
        scene.AddComponent<TextComponent>(m_fpsCounterEntityId, "0");
    }
}

Application::~Application()
{
    OnDestroy();

#if MODULE_EDITOR_ENABLED
    if (gEngineSettings.enableEditor) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…