2016-05-03 00:07:17 -06: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"
|
2022-12-08 13:27:25 +02:00
|
|
|
#include "common/settings.h"
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2016-05-03 00:07:17 -06:00
|
|
|
namespace Layout {
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2020-06-10 13:44:21 +03:00
|
|
|
/// Describes the horizontal coordinates for the right eye screen when using Cardboard VR
|
|
|
|
struct CardboardSettings {
|
|
|
|
float top_screen_right_eye;
|
|
|
|
float bottom_screen_right_eye;
|
|
|
|
float user_x_shift;
|
|
|
|
};
|
|
|
|
|
2016-05-03 00:07:17 -06:00
|
|
|
/// Describes the layout of the window framebuffer (size and top/bottom screen positions)
|
|
|
|
struct FramebufferLayout {
|
2019-07-11 18:46:44 +02:00
|
|
|
u32 width;
|
|
|
|
u32 height;
|
2016-05-03 00:07:17 -06:00
|
|
|
bool top_screen_enabled;
|
|
|
|
bool bottom_screen_enabled;
|
2019-07-11 18:46:44 +02:00
|
|
|
Common::Rectangle<u32> top_screen;
|
|
|
|
Common::Rectangle<u32> bottom_screen;
|
2019-10-25 20:21:10 -03:00
|
|
|
bool is_rotated = true;
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2020-06-10 13:44:21 +03:00
|
|
|
CardboardSettings cardboard;
|
|
|
|
|
2017-05-27 18:06:59 -07:00
|
|
|
/**
|
|
|
|
* Returns the ration of pixel size of the top screen, compared to the native size of the 3DS
|
|
|
|
* screen.
|
|
|
|
*/
|
2019-07-11 18:46:44 +02:00
|
|
|
u32 GetScalingRatio() const;
|
2016-05-03 00:07:17 -06: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 00:36:07 -07:00
|
|
|
* @param is_swapped if true, the bottom screen will be displayed above the top screen
|
2016-05-03 00:07:17 -06:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-25 20:21:10 -03:00
|
|
|
FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2016-05-03 00:07:17 -06:00
|
|
|
|
2019-07-20 22:59:38 -04:00
|
|
|
/**
|
|
|
|
* Factory method for constructing a mobile portrait FramebufferLayout
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
|
|
|
* @param is_swapped if true, the bottom screen will be displayed above the top screen
|
|
|
|
* @return Newly created FramebufferLayout object with mobile portrait screen regions initialized
|
|
|
|
*/
|
|
|
|
FramebufferLayout MobilePortraitFrameLayout(u32 width, u32 height, bool is_swapped);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom
|
|
|
|
* screen on the right
|
|
|
|
* 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
|
|
|
|
* @param is_swapped if true, the bottom screen will be the large display
|
|
|
|
* @param scale_factor Scale factor to use for bottom screen with respect to top screen
|
|
|
|
* @param center_vertical When true, centers the top and bottom screens vertically
|
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
|
|
|
FramebufferLayout MobileLandscapeFrameLayout(u32 width, u32 height, bool is_swapped,
|
|
|
|
float scale_factor, bool center_vertical);
|
|
|
|
|
2016-05-03 00:07:17 -06:00
|
|
|
/**
|
2016-11-10 00:36:07 -07:00
|
|
|
* Factory method for constructing a FramebufferLayout with only the top or bottom screen
|
2016-05-03 00:07:17 -06:00
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
2016-11-10 00:36:07 -07:00
|
|
|
* @param is_swapped if true, the bottom screen will be displayed (and the top won't be displayed)
|
2016-05-03 00:07:17 -06:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-25 20:21:10 -03:00
|
|
|
FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2016-05-03 00:07:17 -06:00
|
|
|
|
|
|
|
/**
|
2016-11-05 02:58:11 -06: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 00:07:17 -06: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 00:36:07 -07:00
|
|
|
* @param is_swapped if true, the bottom screen will be the large display
|
2023-02-17 09:19:52 -05:00
|
|
|
* @param scale_factor The ratio between the large screen with respect to the smaller screen
|
2016-05-03 00:07:17 -06:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2023-02-17 09:19:52 -05:00
|
|
|
FramebufferLayout LargeFrameLayout(u32 width, u32 height, bool is_swapped, bool upright,
|
|
|
|
float scale_factor);
|
2017-02-01 00:22:47 -08:00
|
|
|
|
2017-08-25 23:53:07 +02:00
|
|
|
/**
|
2018-03-09 10:54:43 -07: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-25 20:21:10 -03:00
|
|
|
FramebufferLayout SideFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2017-08-25 23:53:07 +02:00
|
|
|
|
2022-11-17 10:37:30 -05:00
|
|
|
/**
|
|
|
|
* Factory method for constructing a Frame with the Top screen and bottom
|
|
|
|
* screen on separate windows
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
|
|
|
* @param is_secondary if true, the bottom screen will be enabled instead of the top screen
|
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
|
|
|
FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary, bool upright);
|
|
|
|
|
2017-02-01 00:22:47 -08: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
|
|
|
|
*/
|
2023-02-14 16:06:11 -05:00
|
|
|
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped);
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2018-08-31 14:16:16 +08: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
|
|
|
|
*/
|
2022-11-17 10:37:30 -05:00
|
|
|
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary = false);
|
2018-08-31 14:16:16 +08:00
|
|
|
|
2020-06-10 13:44:21 +03:00
|
|
|
/**
|
|
|
|
* Convenience method for transforming a frame layout when using Cardboard VR
|
|
|
|
* @param layout frame layout to transform
|
|
|
|
* @return layout transformed with the user cardboard settings
|
|
|
|
*/
|
|
|
|
FramebufferLayout GetCardboardSettings(FramebufferLayout layout);
|
|
|
|
|
2020-01-21 18:44:04 -03:00
|
|
|
std::pair<unsigned, unsigned> GetMinimumSizeFromLayout(Settings::LayoutOption layout,
|
|
|
|
bool upright_screen);
|
|
|
|
|
2017-05-27 18:06:59 -07:00
|
|
|
} // namespace Layout
|