2016-05-03 07:07:17 +01:00
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/math_util.h"
|
2020-01-21 21:44:04 +00:00
|
|
|
#include "core/settings.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
|
|
|
|
2016-05-03 07:07:17 +01:00
|
|
|
/// Describes the layout of the window framebuffer (size and top/bottom screen positions)
|
|
|
|
struct FramebufferLayout {
|
2019-07-11 17:46:44 +01:00
|
|
|
u32 width;
|
|
|
|
u32 height;
|
2016-05-03 07:07:17 +01:00
|
|
|
bool top_screen_enabled;
|
|
|
|
bool bottom_screen_enabled;
|
2019-07-11 17:46:44 +01:00
|
|
|
Common::Rectangle<u32> top_screen;
|
|
|
|
Common::Rectangle<u32> bottom_screen;
|
2019-10-26 00:21:10 +01:00
|
|
|
bool is_rotated = true;
|
2017-05-28 02:06:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the ration of pixel size of the top screen, compared to the native size of the 3DS
|
|
|
|
* screen.
|
|
|
|
*/
|
2019-07-11 17:46:44 +01:00
|
|
|
u32 GetScalingRatio() const;
|
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
|
2016-11-10 07:36:07 +00:00
|
|
|
* @param is_swapped if true, the bottom screen will be displayed above the top screen
|
2016-05-03 07:07:17 +01:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-26 00:21:10 +01:00
|
|
|
FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2016-05-03 07:07:17 +01:00
|
|
|
|
|
|
|
/**
|
2016-11-10 07:36:07 +00:00
|
|
|
* Factory method for constructing a FramebufferLayout with only the top or bottom screen
|
2016-05-03 07:07:17 +01:00
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
2016-11-10 07:36:07 +00:00
|
|
|
* @param is_swapped if true, the bottom screen will be displayed (and the top won't be displayed)
|
2016-05-03 07:07:17 +01:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-26 00:21:10 +01:00
|
|
|
FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2016-05-03 07:07:17 +01:00
|
|
|
|
|
|
|
/**
|
2016-11-05 08:58:11 +00:00
|
|
|
* Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom
|
|
|
|
* screen on the right
|
2016-05-03 07:07:17 +01:00
|
|
|
* This is useful in particular because it matches well with a 1920x1080 resolution monitor
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
2016-11-10 07:36:07 +00:00
|
|
|
* @param is_swapped if true, the bottom screen will be the large display
|
2016-05-03 07:07:17 +01:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-26 00:21:10 +01:00
|
|
|
FramebufferLayout LargeFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2017-02-01 08:22:47 +00:00
|
|
|
|
2017-08-25 22:53:07 +01:00
|
|
|
/**
|
2018-03-09 17:54:43 +00:00
|
|
|
* Factory method for constructing a Frame with the Top screen and bottom
|
|
|
|
* screen side by side
|
|
|
|
* This is useful for devices with small screens, like the GPDWin
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
|
|
|
* @param is_swapped if true, the bottom screen will be the left display
|
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-26 00:21:10 +01:00
|
|
|
FramebufferLayout SideFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2017-08-25 22:53:07 +01:00
|
|
|
|
2017-02-01 08:22:47 +00:00
|
|
|
/**
|
|
|
|
* Factory method for constructing a custom FramebufferLayout
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-07-11 17:46:44 +01:00
|
|
|
FramebufferLayout CustomFrameLayout(u32 width, u32 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
|
|
|
|
* Read from the current settings to determine which layout to use.
|
|
|
|
* @param res_scale resolution scale factor
|
|
|
|
*/
|
2019-07-11 17:46:44 +01:00
|
|
|
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale);
|
2018-08-31 07:16:16 +01:00
|
|
|
|
2020-01-21 21:44:04 +00:00
|
|
|
std::pair<unsigned, unsigned> GetMinimumSizeFromLayout(Settings::LayoutOption layout,
|
|
|
|
bool upright_screen);
|
|
|
|
|
2017-05-28 02:06:59 +01:00
|
|
|
} // namespace Layout
|