summaryrefslogtreecommitdiff
path: root/src/common/emu_window.h
diff options
context:
space:
mode:
authorGravatar bunnei2015-03-07 17:21:19 -0500
committerGravatar bunnei2015-03-07 17:21:19 -0500
commit9960c49c217d2c1ae202bdacd475c9a47cda39b9 (patch)
treea80e07b2ee63c3a081f3b3aec4eb45279b6f9b85 /src/common/emu_window.h
parentMerge pull request #615 from Subv/services (diff)
downloadyuzu-9960c49c217d2c1ae202bdacd475c9a47cda39b9.tar.gz
yuzu-9960c49c217d2c1ae202bdacd475c9a47cda39b9.tar.xz
yuzu-9960c49c217d2c1ae202bdacd475c9a47cda39b9.zip
Set framebuffer layout from EmuWindow.
Diffstat (limited to 'src/common/emu_window.h')
-rw-r--r--src/common/emu_window.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index 1ad4b82a3..b6862030e 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -8,6 +8,7 @@
8#include "common/scm_rev.h" 8#include "common/scm_rev.h"
9#include "common/string_util.h" 9#include "common/string_util.h"
10#include "common/key_map.h" 10#include "common/key_map.h"
11#include "common/math_util.h"
11 12
12/** 13/**
13 * Abstraction class used to provide an interface between emulation code and the frontend 14 * Abstraction class used to provide an interface between emulation code and the frontend
@@ -38,6 +39,23 @@ public:
38 std::pair<unsigned,unsigned> min_client_area_size; 39 std::pair<unsigned,unsigned> min_client_area_size;
39 }; 40 };
40 41
42 /// Describes the layout of the window framebuffer (size and top/bottom screen positions)
43 struct FramebufferLayout {
44
45 /**
46 * Factory method for constructing a default FramebufferLayout
47 * @param width Window framebuffer width in pixels
48 * @param height Window framebuffer height in pixels
49 * @return Newly created FramebufferLayout object with default screen regions initialized
50 */
51 static FramebufferLayout DefaultScreenLayout(int width, int height);
52
53 unsigned width;
54 unsigned height;
55 MathUtil::Rectangle<unsigned> top_screen;
56 MathUtil::Rectangle<unsigned> bottom_screen;
57 };
58
41 /// Swap buffers to display the next frame 59 /// Swap buffers to display the next frame
42 virtual void SwapBuffers() = 0; 60 virtual void SwapBuffers() = 0;
43 61
@@ -75,11 +93,11 @@ public:
75 } 93 }
76 94
77 /** 95 /**
78 * Gets the framebuffer size in pixels. 96 * Gets the framebuffer layout (width, height, and screen regions)
79 * @note This method is thread-safe 97 * @note This method is thread-safe
80 */ 98 */
81 const std::pair<unsigned,unsigned> GetFramebufferSize() const { 99 const FramebufferLayout& GetFramebufferLayout() const {
82 return framebuffer_size; 100 return framebuffer_layout;
83 } 101 }
84 102
85 /** 103 /**
@@ -118,11 +136,11 @@ protected:
118 } 136 }
119 137
120 /** 138 /**
121 * Update internal framebuffer size with the given parameter. 139 * Update framebuffer layout with the given parameter.
122 * @note EmuWindow implementations will usually use this in window resize event handlers. 140 * @note EmuWindow implementations will usually use this in window resize event handlers.
123 */ 141 */
124 void NotifyFramebufferSizeChanged(const std::pair<unsigned,unsigned>& size) { 142 void NotifyFramebufferLayoutChanged(const FramebufferLayout& layout) {
125 framebuffer_size = size; 143 framebuffer_layout = layout;
126 } 144 }
127 145
128 /** 146 /**
@@ -143,7 +161,7 @@ private:
143 // By default, ignore this request and do nothing. 161 // By default, ignore this request and do nothing.
144 } 162 }
145 163
146 std::pair<unsigned,unsigned> framebuffer_size; 164 FramebufferLayout framebuffer_layout; ///< Current framebuffer layout
147 165
148 unsigned client_area_width; ///< Current client width, should be set by window impl. 166 unsigned client_area_width; ///< Current client width, should be set by window impl.
149 unsigned client_area_height; ///< Current client height, should be set by window impl. 167 unsigned client_area_height; ///< Current client height, should be set by window impl.