Support additional screen layouts.

Allows users to choose a single screen layout or a large screen layout.
Adds a configuration option to change the prominent screen.
This commit is contained in:
James Rowe 2016-05-03 00:07:17 -06:00
parent 1f70365faa
commit 2b1654ad9b
16 changed files with 522 additions and 132 deletions

View file

@ -7,6 +7,7 @@
#include <tuple>
#include <utility>
#include "common/common_types.h"
#include "common/framebuffer_layout.h"
#include "common/math_util.h"
#include "core/hle/service/hid/hid.h"
@ -38,23 +39,6 @@ public:
std::pair<unsigned, unsigned> min_client_area_size;
};
/// Describes the layout of the window framebuffer (size and top/bottom screen positions)
struct FramebufferLayout {
/**
* Factory method for constructing a default 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
*/
static FramebufferLayout DefaultScreenLayout(unsigned width, unsigned height);
unsigned width;
unsigned height;
MathUtil::Rectangle<unsigned> top_screen;
MathUtil::Rectangle<unsigned> bottom_screen;
};
/// Swap buffers to display the next frame
virtual void SwapBuffers() = 0;
@ -211,10 +195,16 @@ public:
* Gets the framebuffer layout (width, height, and screen regions)
* @note This method is thread-safe
*/
const FramebufferLayout& GetFramebufferLayout() const {
const Layout::FramebufferLayout& GetFramebufferLayout() const {
return framebuffer_layout;
}
/**
* Convenience method to update the VideoCore EmuWindow
* Read from the current settings to determine which layout to use.
*/
void UpdateCurrentFramebufferLayout(unsigned width, unsigned height);
protected:
EmuWindow() {
// TODO: Find a better place to set this.
@ -250,7 +240,7 @@ protected:
* Update framebuffer layout with the given parameter.
* @note EmuWindow implementations will usually use this in window resize event handlers.
*/
void NotifyFramebufferLayoutChanged(const FramebufferLayout& layout) {
void NotifyFramebufferLayoutChanged(const Layout::FramebufferLayout& layout) {
framebuffer_layout = layout;
}
@ -274,7 +264,7 @@ private:
// By default, ignore this request and do nothing.
}
FramebufferLayout framebuffer_layout; ///< Current framebuffer layout
Layout::FramebufferLayout framebuffer_layout; ///< Current framebuffer layout
unsigned client_area_width; ///< Current client width, should be set by window impl.
unsigned client_area_height; ///< Current client height, should be set by window impl.