2018-01-13 16:22:39 -05:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2016-05-03 02:07:17 -04:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/math_util.h"
|
2017-05-27 21:06:59 -04:00
|
|
|
|
2016-05-03 02:07:17 -04:00
|
|
|
namespace Layout {
|
2017-05-27 21:06:59 -04:00
|
|
|
|
2020-05-15 16:22:27 -04:00
|
|
|
namespace MinimumSize {
|
|
|
|
constexpr u32 Width = 640;
|
|
|
|
constexpr u32 Height = 360;
|
|
|
|
} // namespace MinimumSize
|
|
|
|
|
2020-03-11 13:02:30 -04:00
|
|
|
namespace ScreenUndocked {
|
|
|
|
constexpr u32 Width = 1280;
|
|
|
|
constexpr u32 Height = 720;
|
|
|
|
} // namespace ScreenUndocked
|
|
|
|
|
|
|
|
namespace ScreenDocked {
|
|
|
|
constexpr u32 Width = 1920;
|
|
|
|
constexpr u32 Height = 1080;
|
|
|
|
} // namespace ScreenDocked
|
2018-01-09 22:36:07 -05:00
|
|
|
|
2020-02-14 14:39:04 -05:00
|
|
|
enum class AspectRatio {
|
2020-02-14 00:06:26 -05:00
|
|
|
Default,
|
2020-02-14 14:39:04 -05:00
|
|
|
R4_3,
|
|
|
|
R21_9,
|
2020-02-14 00:06:26 -05:00
|
|
|
StretchToWindow,
|
2020-02-13 23:13:23 -05:00
|
|
|
};
|
|
|
|
|
2018-01-09 22:36:07 -05:00
|
|
|
/// Describes the layout of the window framebuffer
|
2016-05-03 02:07:17 -04:00
|
|
|
struct FramebufferLayout {
|
2019-05-29 02:14:24 -04:00
|
|
|
u32 width{ScreenUndocked::Width};
|
|
|
|
u32 height{ScreenUndocked::Height};
|
2020-02-17 14:31:14 -05:00
|
|
|
bool is_srgb{};
|
2018-01-09 22:36:07 -05:00
|
|
|
|
2019-05-29 02:14:24 -04:00
|
|
|
Common::Rectangle<u32> screen;
|
2017-05-27 21:06:59 -04:00
|
|
|
|
|
|
|
/**
|
2018-01-09 22:36:07 -05:00
|
|
|
* Returns the ration of pixel size of the screen, compared to the native size of the undocked
|
|
|
|
* Switch screen.
|
2017-05-27 21:06:59 -04:00
|
|
|
*/
|
2018-01-09 22:36:07 -05:00
|
|
|
float GetScalingRatio() const {
|
|
|
|
return static_cast<float>(screen.GetWidth()) / ScreenUndocked::Width;
|
|
|
|
}
|
2016-05-03 02:07:17 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Factory method for constructing a default FramebufferLayout
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
2017-02-01 03:22:47 -05:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-05-29 02:14:24 -04:00
|
|
|
FramebufferLayout DefaultFrameLayout(u32 width, u32 height);
|
2017-05-27 21:06:59 -04:00
|
|
|
|
2018-08-31 02:16:16 -04:00
|
|
|
/**
|
|
|
|
* Convenience method to get frame layout by resolution scale
|
|
|
|
* @param res_scale resolution scale factor
|
|
|
|
*/
|
2019-05-29 02:14:24 -04:00
|
|
|
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale);
|
2018-08-31 02:16:16 -04:00
|
|
|
|
2020-02-14 00:06:26 -05:00
|
|
|
/**
|
|
|
|
* Convenience method to determine emulation aspect ratio
|
2020-02-14 14:39:04 -05:00
|
|
|
* @param aspect Represents the index of aspect ratio stored in Settings::values.aspect_ratio
|
2020-02-14 00:06:26 -05:00
|
|
|
* @param window_aspect_ratio Current window aspect ratio
|
|
|
|
* @return Emulation render window aspect ratio
|
|
|
|
*/
|
2020-02-14 14:39:04 -05:00
|
|
|
float EmulationAspectRatio(AspectRatio aspect, float window_aspect_ratio);
|
2020-02-14 00:06:26 -05:00
|
|
|
|
2017-05-27 21:06:59 -04:00
|
|
|
} // namespace Layout
|