From bd8f491e4c08e9b9a7b852de0b50c144da8ac8c8 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 12 Oct 2014 18:14:57 +0200 Subject: Fixup EmuWindow interface and implementations thereof. --- src/common/emu_window.h | 61 ++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'src/common/emu_window.h') diff --git a/src/common/emu_window.h b/src/common/emu_window.h index ba9d4fa7..72c40c6a 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -43,54 +43,59 @@ public: static void KeyReleased(KeyMap::HostDeviceKey key); WindowConfig GetConfig() const { - return m_config; + return config; } void SetConfig(const WindowConfig& val) { - m_config = val; + config = val; } - /// Gets the size of the window in pixels - virtual void GetFramebufferSize(int* fbWidth, int* fbHeight) = 0; - - int GetClientAreaWidth() const { - return m_client_area_width; - } - - void SetClientAreaWidth(const int val) { - m_client_area_width = val; + /** + * Gets the size of the framebuffer in pixels + */ + const std::pair GetFramebufferSize() const { + return framebuffer_size; } - int GetClientAreaHeight() const { - return m_client_area_height; + /** + * Gets window client area width in logical coordinates + */ + std::pair GetClientAreaSize() const { + return std::make_pair(client_area_width, client_area_height); } - void SetClientAreaHeight(const int val) { - m_client_area_height = val; + std::string GetWindowTitle() const { + return window_title; } - std::string GetWindowTitle() const { - return m_window_title; - } - - void SetWindowTitle(std::string val) { - m_window_title = val; + void SetWindowTitle(const std::string& val) { + window_title = val; } protected: - EmuWindow(): - m_window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc)), + EmuWindow() : // TODO: What the hell... -.- - don't hardcode dimensions here without applying them in a sensible manner... + window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc)) m_client_area_width(640), - m_client_area_height(480) + m_client_area_height(480), {} virtual ~EmuWindow() {} - std::string m_window_title; ///< Current window title, should be used by window impl. + std::pair NotifyFramebufferSizeChanged(const std::pair& size) { + framebuffer_size = size; + } - int m_client_area_width; ///< Current client width, should be set by window impl. - int m_client_area_height; ///< Current client height, should be set by window impl. + void NotifyClientAreaSizeChanged(std::pair size) { + client_area_width = size.first; + client_area_height = size.second; + } private: - WindowConfig m_config; ///< Internal configuration + std::string window_title; ///< Current window title, should be used by window impl. + + std::pair framebuffer_size; + + 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. + WindowConfig config; ///< Internal configuration }; -- cgit v1.2.3