Split IWindow a bit

This commit is contained in:
2020-10-24 23:02:01 +02:00
parent 30dd4f255c
commit ae76fa59e9
8 changed files with 55 additions and 32 deletions

View File

@@ -13,7 +13,7 @@ namespace openVulkanoCpp
class BaseWindow : virtual public IWindow
{
protected:
const int windowId;
const uint32_t windowId;
WindowConfiguration windowConfig;
public:
@@ -121,7 +121,7 @@ namespace openVulkanoCpp
return nullptr;
}
int GetWindowId() const override
[[nodiscard]] uint32_t GetWindowId() const override
{
return windowId;
}

View File

@@ -0,0 +1,21 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "IWindow.hpp"
namespace openVulkanoCpp
{
class IOpenGlWindow : virtual public IWindow
{
public:
~IOpenGlWindow() override = default;
virtual void MakeCurrentThread() = 0;
virtual void Present() const = 0;
};
}

View File

@@ -0,0 +1,23 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "IWindow.hpp"
#include <vector>
#include <vulkan/vulkan.hpp>
namespace openVulkanoCpp
{
class IVulkanWindow : virtual public IWindow
{
public:
~IVulkanWindow() override = default;
virtual vk::SurfaceKHR CreateSurface(const vk::Instance& instance, const vk::AllocationCallbacks* pAllocator = nullptr) = 0;
virtual std::vector<std::string> GetRequiredInstanceExtensions() = 0;
};
}

View File

@@ -6,12 +6,11 @@
#pragma once
#include <string>
#include <stdexcept>
#include <glm/glm.hpp>
#include <vulkan/vulkan.hpp>
#include "../PlatformEnums.hpp"
#include "../ICloseable.hpp"
#include <string>
#include <stdexcept>
namespace openVulkanoCpp
{
@@ -82,34 +81,16 @@ namespace openVulkanoCpp
virtual IVulkanWindow* GetVulkanWindow() = 0;
virtual IOpenGlWindow* GetOpenGlWindow() = 0;
virtual int GetWindowId() const = 0;
[[nodiscard]] virtual uint32_t GetWindowId() const = 0;
protected:
static int CreateWindowId()
static uint32_t CreateWindowId()
{
static int id = 0;
static uint32_t id = 0;
return id++;
}
};
class IVulkanWindow : virtual public IWindow
{
public:
virtual ~IVulkanWindow() = default;
virtual vk::SurfaceKHR CreateSurface(const vk::Instance& instance, const vk::AllocationCallbacks* pAllocator = nullptr) = 0;
virtual std::vector<std::string> GetRequiredInstanceExtensions() = 0;
};
class IOpenGlWindow : virtual public IWindow
{
public:
virtual ~IOpenGlWindow() = default;
virtual void MakeCurrentThread() = 0;
virtual void Present() const = 0;
};
class IWindowHandler
{
public: