#pragma once

#include <frostbite2D/types/type_math.h>

namespace frostbite2D {

/**
 * @brief 虚拟分辨率缩放模式
 */
enum class ResolutionScaleMode {
  Disabled,  ///< 不保持纵横比，直接按窗口宽高分别缩放
  Fit,       ///< 保持纵横比并完整显示，按较小缩放因子适配
  FitHeight, ///< 以高度优先适配，宽度不足时回退为 Fit
};

struct RenderResolutionState {
  int windowWidth = 1280;
  int windowHeight = 720;

  int drawableWidth = 1280;
  int drawableHeight = 720;

  int windowViewportX = 0;
  int windowViewportY = 0;
  int windowViewportWidth = 1280;
  int windowViewportHeight = 720;

  int viewportX = 0;
  int viewportY = 0;
  int viewportWidth = 1280;
  int viewportHeight = 720;

  float contentScaleX = 1.0f;
  float contentScaleY = 1.0f;
  float scaleX = 1.0f;
  float scaleY = 1.0f;

  Rect getWindowViewportRect() const {
    return Rect(static_cast<float>(windowViewportX),
                static_cast<float>(windowViewportY),
                static_cast<float>(windowViewportWidth),
                static_cast<float>(windowViewportHeight));
  }
};

} // namespace frostbite2D
