2018-01-13 21:22:39 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2016-05-03 07:07:17 +01:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/math_util.h"
|
2017-05-28 02:06:59 +01:00
|
|
|
|
2016-05-03 07:07:17 +01:00
|
|
|
namespace Layout {
|
2017-05-28 02:06:59 +01:00
|
|
|
|
2018-01-10 03:36:07 +00:00
|
|
|
enum ScreenUndocked : unsigned { Width = 1280, Height = 720 };
|
2018-08-31 07:16:16 +01:00
|
|
|
enum ScreenDocked : unsigned { WidthDocked = 1920, HeightDocked = 1080 };
|
2018-01-10 03:36:07 +00:00
|
|
|
|
|
|
|
/// Describes the layout of the window framebuffer
|
2016-05-03 07:07:17 +01:00
|
|
|
struct FramebufferLayout {
|
2018-01-10 03:36:07 +00:00
|
|
|
unsigned width{ScreenUndocked::Width};
|
|
|
|
unsigned height{ScreenUndocked::Height};
|
|
|
|
|
|
|
|
MathUtil::Rectangle<unsigned> screen;
|
2017-05-28 02:06:59 +01:00
|
|
|
|
|
|
|
/**
|
2018-01-10 03:36:07 +00:00
|
|
|
* Returns the ration of pixel size of the screen, compared to the native size of the undocked
|
|
|
|
* Switch screen.
|
2017-05-28 02:06:59 +01:00
|
|
|
*/
|
2018-01-10 03:36:07 +00:00
|
|
|
float GetScalingRatio() const {
|
|
|
|
return static_cast<float>(screen.GetWidth()) / ScreenUndocked::Width;
|
|
|
|
}
|
2016-05-03 07:07:17 +01: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 08:22:47 +00:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2018-01-10 03:36:07 +00:00
|
|
|
FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height);
|
2017-05-28 02:06:59 +01:00
|
|
|
|
2018-08-31 07:16:16 +01:00
|
|
|
/**
|
|
|
|
* Convenience method to get frame layout by resolution scale
|
|
|
|
* @param res_scale resolution scale factor
|
|
|
|
*/
|
|
|
|
FramebufferLayout FrameLayoutFromResolutionScale(u16 res_scale);
|
|
|
|
|
2017-05-28 02:06:59 +01:00
|
|
|
} // namespace Layout
|