Split IWindow a bit
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
21
openVulkanoCpp/Base/UI/IOpenGlWindow.hpp
Normal file
21
openVulkanoCpp/Base/UI/IOpenGlWindow.hpp
Normal 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;
|
||||
};
|
||||
}
|
||||
23
openVulkanoCpp/Base/UI/IVulkanWindow.hpp
Normal file
23
openVulkanoCpp/Base/UI/IVulkanWindow.hpp
Normal 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;
|
||||
};
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <glm/vec3.hpp>
|
||||
|
||||
namespace openVulkanoCpp
|
||||
{
|
||||
@@ -56,11 +55,6 @@ namespace openVulkanoCpp
|
||||
return static_cast<typename std::underlying_type<Enumeration>::type>(value);
|
||||
}
|
||||
|
||||
static inline bool MatchesAnyElementWise(const glm::vec3& a, const glm::vec3& b)
|
||||
{
|
||||
return a.x == b.x || a.y == b.y || a.z == b.z;
|
||||
}
|
||||
|
||||
static inline size_t Align(size_t size, size_t alignment)
|
||||
{
|
||||
return (size + alignment - 1) & ~(alignment - 1);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../Base/UI/BaseWindow.hpp"
|
||||
#include "../../Base/UI/IVulkanWindow.hpp"
|
||||
#include "../../Base/UI/IOpenGlWindow.hpp"
|
||||
#include "../../Base/IPlatform.hpp"
|
||||
#include "InputProviderGLFW.hpp"
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "../Base/IGraphicsApp.hpp"
|
||||
#include "../Base/IGraphicsAppManager.hpp"
|
||||
#include "../Base/EngineConstants.hpp"
|
||||
#include "../Base/UI/IVulkanWindow.hpp"
|
||||
#include "Debuging/ValidationLayer.hpp"
|
||||
|
||||
namespace openVulkanoCpp::Vulkan
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "SwapChain.hpp"
|
||||
#include "../Base/Logger.hpp"
|
||||
#include "../Base/Utils.hpp"
|
||||
#include "../Base/UI/IVulkanWindow.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace openVulkanoCpp::Vulkan
|
||||
|
||||
Reference in New Issue
Block a user