diff options
Diffstat (limited to 'src/core/frontend/framebuffer_layout.h')
| -rw-r--r-- | src/core/frontend/framebuffer_layout.h | 66 |
1 files changed, 14 insertions, 52 deletions
diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index 4983cf103..b06999e1b 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | 1 | // Copyright 2018 Yuzu Emulator Team |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| @@ -8,68 +8,30 @@ | |||
| 8 | 8 | ||
| 9 | namespace Layout { | 9 | namespace Layout { |
| 10 | 10 | ||
| 11 | /// Describes the layout of the window framebuffer (size and top/bottom screen positions) | 11 | enum ScreenUndocked : unsigned { Width = 1280, Height = 720 }; |
| 12 | |||
| 13 | /// Describes the layout of the window framebuffer | ||
| 12 | struct FramebufferLayout { | 14 | struct FramebufferLayout { |
| 13 | unsigned width; | 15 | unsigned width{ScreenUndocked::Width}; |
| 14 | unsigned height; | 16 | unsigned height{ScreenUndocked::Height}; |
| 15 | bool top_screen_enabled; | 17 | |
| 16 | bool bottom_screen_enabled; | 18 | MathUtil::Rectangle<unsigned> screen; |
| 17 | MathUtil::Rectangle<unsigned> top_screen; | ||
| 18 | MathUtil::Rectangle<unsigned> bottom_screen; | ||
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * Returns the ration of pixel size of the top screen, compared to the native size of the 3DS | 21 | * Returns the ration of pixel size of the screen, compared to the native size of the undocked |
| 22 | * screen. | 22 | * Switch screen. |
| 23 | */ | 23 | */ |
| 24 | float GetScalingRatio() const; | 24 | float GetScalingRatio() const { |
| 25 | return static_cast<float>(screen.GetWidth()) / ScreenUndocked::Width; | ||
| 26 | } | ||
| 25 | }; | 27 | }; |
| 26 | 28 | ||
| 27 | /** | 29 | /** |
| 28 | * Factory method for constructing a default FramebufferLayout | 30 | * Factory method for constructing a default FramebufferLayout |
| 29 | * @param width Window framebuffer width in pixels | 31 | * @param width Window framebuffer width in pixels |
| 30 | * @param height Window framebuffer height in pixels | 32 | * @param height Window framebuffer height in pixels |
| 31 | * @param is_swapped if true, the bottom screen will be displayed above the top screen | ||
| 32 | * @return Newly created FramebufferLayout object with default screen regions initialized | ||
| 33 | */ | ||
| 34 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool is_swapped); | ||
| 35 | |||
| 36 | /** | ||
| 37 | * Factory method for constructing a FramebufferLayout with only the top or bottom screen | ||
| 38 | * @param width Window framebuffer width in pixels | ||
| 39 | * @param height Window framebuffer height in pixels | ||
| 40 | * @param is_swapped if true, the bottom screen will be displayed (and the top won't be displayed) | ||
| 41 | * @return Newly created FramebufferLayout object with default screen regions initialized | ||
| 42 | */ | ||
| 43 | FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swapped); | ||
| 44 | |||
| 45 | /** | ||
| 46 | * Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom | ||
| 47 | * screen on the right | ||
| 48 | * This is useful in particular because it matches well with a 1920x1080 resolution monitor | ||
| 49 | * @param width Window framebuffer width in pixels | ||
| 50 | * @param height Window framebuffer height in pixels | ||
| 51 | * @param is_swapped if true, the bottom screen will be the large display | ||
| 52 | * @return Newly created FramebufferLayout object with default screen regions initialized | ||
| 53 | */ | ||
| 54 | FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped); | ||
| 55 | |||
| 56 | /** | ||
| 57 | * Factory method for constructing a Frame with the Top screen and bottom | ||
| 58 | * screen side by side | ||
| 59 | * This is useful for devices with small screens, like the GPDWin | ||
| 60 | * @param width Window framebuffer width in pixels | ||
| 61 | * @param height Window framebuffer height in pixels | ||
| 62 | * @param is_swapped if true, the bottom screen will be the left display | ||
| 63 | * @return Newly created FramebufferLayout object with default screen regions initialized | ||
| 64 | */ | ||
| 65 | FramebufferLayout SideFrameLayout(unsigned width, unsigned height, bool is_swapped); | ||
| 66 | |||
| 67 | /** | ||
| 68 | * Factory method for constructing a custom FramebufferLayout | ||
| 69 | * @param width Window framebuffer width in pixels | ||
| 70 | * @param height Window framebuffer height in pixels | ||
| 71 | * @return Newly created FramebufferLayout object with default screen regions initialized | 33 | * @return Newly created FramebufferLayout object with default screen regions initialized |
| 72 | */ | 34 | */ |
| 73 | FramebufferLayout CustomFrameLayout(unsigned width, unsigned height); | 35 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height); |
| 74 | 36 | ||
| 75 | } // namespace Layout | 37 | } // namespace Layout |