From c0305598cbf00636fea0aa9c4f521272af847e40 Mon Sep 17 00:00:00 2001
From: Sebastian Gaida <gaida@ca-digit.com>
Date: Tue, 24 Aug 2021 17:46:39 +0200
Subject: [PATCH] [#89] added swapchain handle to window

---
 include/vkcv/Swapchain.hpp | 2 ++
 include/vkcv/Window.hpp    | 9 +++++++++
 src/vkcv/Window.cpp        | 4 ++++
 3 files changed, 15 insertions(+)

diff --git a/include/vkcv/Swapchain.hpp b/include/vkcv/Swapchain.hpp
index 5e9bc7d0..cffb268a 100644
--- a/include/vkcv/Swapchain.hpp
+++ b/include/vkcv/Swapchain.hpp
@@ -13,6 +13,8 @@ namespace vkcv
     class Swapchain final {
     private:
     	friend class Core;
+    	friend class Window;
+    	friend class SwapchainManager;
 
         struct Surface
         {
diff --git a/include/vkcv/Window.hpp b/include/vkcv/Window.hpp
index 82f21331..65627ecd 100644
--- a/include/vkcv/Window.hpp
+++ b/include/vkcv/Window.hpp
@@ -5,6 +5,7 @@
 #include <string>
 
 #include "Event.hpp"
+#include "Handles.hpp"
 
 struct GLFWwindow;
 
@@ -12,10 +13,12 @@ namespace vkcv {
 
     class Window {
 		friend class WindowManager;
+		friend class SwapchainManager;
 	private:
     	std::string m_title;
     	bool m_resizable;
 		GLFWwindow *m_window;
+		SwapchainHandle m_swapchainHandle;
 
     public:
     	/**
@@ -130,6 +133,12 @@ namespace vkcv {
          * @param height
          */
         void getFramebufferSize(int& width, int& height) const;
+
+        /**
+         * gets the SwapchainHandle corresponding to the swapchain of the window
+         * @return
+         */
+        SwapchainHandle getSwapchainHandle() const;
     };
 
 }
diff --git a/src/vkcv/Window.cpp b/src/vkcv/Window.cpp
index d51bb65a..655ebe1c 100644
--- a/src/vkcv/Window.cpp
+++ b/src/vkcv/Window.cpp
@@ -305,4 +305,8 @@ namespace vkcv {
 		Window& window = *static_cast<Window *>(glfwGetWindowUserPointer(*activeWindowIterator));
 		return window;
 	}
+
+	SwapchainHandle Window::getSwapchainHandle() const {
+		return m_swapchainHandle;
+	}
 }
-- 
GitLab