Added SHWindow to SHImguiWindow
This commit is contained in:
parent
4ccfd399af
commit
fdc8a61c1d
|
@ -137,7 +137,7 @@ namespace SHADE
|
|||
std::array<float, 2> translate;
|
||||
};
|
||||
|
||||
void SHImGuiVulkanBackend::CreateInstance(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) noexcept
|
||||
void SHImGuiVulkanBackend::CreateInstance(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex, SHWindow& mainWindow) noexcept
|
||||
{
|
||||
if (ImGui::GetCurrentContext() == nullptr)
|
||||
{
|
||||
|
@ -189,6 +189,7 @@ namespace SHADE
|
|||
|
||||
//Initialize instance
|
||||
auto instance = std::make_unique<SHBreachInstance>();
|
||||
instance->window = mainWindow;
|
||||
instance->InitializePipeline(io, renderpass, subpassIndex);
|
||||
instance->lastFrameTime = std::chrono::high_resolution_clock::now();
|
||||
io.UserData = instance.release();
|
||||
|
@ -200,9 +201,10 @@ namespace SHADE
|
|||
|
||||
void SHImGuiVulkanBackend::Render(void) noexcept
|
||||
{
|
||||
GETINSTANCE
|
||||
ImGui::Render();
|
||||
ImDrawData* drawData = ImGui::GetDrawData();
|
||||
//TODO: instance draw data
|
||||
//instance.Render(io, drawData, )
|
||||
}
|
||||
|
||||
void SHImGuiVulkanBackend::CreateChildWindow(ImGuiViewport* viewport) noexcept
|
||||
|
@ -210,6 +212,7 @@ namespace SHADE
|
|||
GETINSTANCE
|
||||
|
||||
auto& info = *new SHImGuiWindow{ instance.device };
|
||||
info.window.Create({}, instance.window.GetHWND());
|
||||
viewport->RendererUserData = &info;
|
||||
}
|
||||
|
||||
|
@ -218,6 +221,8 @@ namespace SHADE
|
|||
GETINSTANCE
|
||||
|
||||
auto info = reinterpret_cast<SHImGuiWindow*>(viewport->RendererUserData);
|
||||
info->window.Close();
|
||||
info->window.Destroy();
|
||||
delete info;
|
||||
viewport->RendererUserData = nullptr;
|
||||
}
|
||||
|
@ -230,20 +235,37 @@ namespace SHADE
|
|||
|
||||
void SHImGuiVulkanBackend::SetChildWindowSize(ImGuiViewport* viewport, ImVec2 size) noexcept
|
||||
{
|
||||
|
||||
auto& info = *reinterpret_cast<SHImGuiWindow*>(viewport->RendererUserData);
|
||||
SetWindowPos
|
||||
(
|
||||
info.window.GetHWND(),
|
||||
HWND_TOPMOST,
|
||||
-1,
|
||||
-1,
|
||||
static_cast<int>(size.x),
|
||||
static_cast<int>(size.y),
|
||||
SWP_NOMOVE | SWP_NOZORDER
|
||||
);
|
||||
}
|
||||
|
||||
ImVec2 SHImGuiVulkanBackend::GetChildWindowPos(ImGuiViewport* viewport) noexcept
|
||||
{
|
||||
return {};
|
||||
auto& info = *reinterpret_cast<SHImGuiWindow*>(viewport->RendererUserData);
|
||||
auto [x, y] = info.window.GetWindowSize();
|
||||
return {static_cast<float>(x), static_cast<float>(y)};
|
||||
}
|
||||
|
||||
void SHImGuiVulkanBackend::SetChildWindowPos(ImGuiViewport* viewport, ImVec2 size) noexcept
|
||||
{
|
||||
auto& info = *reinterpret_cast<SHImGuiWindow*>(viewport->RendererUserData);
|
||||
info.window.SetPosition(size.x, size.y);
|
||||
}
|
||||
|
||||
void SHImGuiVulkanBackend::RenderChildWindow(ImGuiViewport* viewport, void*) noexcept
|
||||
{
|
||||
GETINSTANCE;
|
||||
auto& info = *reinterpret_cast<SHImGuiWindow*>(viewport->RendererUserData);
|
||||
//info.Render(io, viewport->DrawData, instance);;
|
||||
}
|
||||
|
||||
void SHImGuiVulkanBackend::ChildSwapBuffers(ImGuiViewport* viewport, void*) noexcept
|
||||
|
@ -272,6 +294,11 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
void SHImGuiVulkanBackend::SHImGuiWindow::Render(ImGuiIO& io, ImDrawData* drawData,
|
||||
Handle<SHVkDescriptorSetGroup> descriptorSetGroup)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SHImGuiVulkanBackend::SHBreachInstance::CreateFontsTexture(Handle<SHVkImage> image, ImGuiIO& io) noexcept
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <Graphics/Instance/SHVkInstance.h>
|
||||
#include "Graphics/Instance/SHVkInstance.h"
|
||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||
#include "Graphics/Images/SHVkImage.h"
|
||||
#include <Graphics/Devices/SHVkPhysicalDevice.h>
|
||||
#include <Graphics/Devices/SHVkLogicalDevice.h>
|
||||
#include <Graphics/Pipeline/SHVkPipeline.h>
|
||||
#include "Graphics/Devices/SHVkPhysicalDevice.h"
|
||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||
#include "Graphics/Swapchain/SHVkSwapchain.h"
|
||||
#include <Graphics/MiddleEnd/Interface/SHGraphicsSystem.h>
|
||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||
#include "Graphics/Debugging/SHVulkanDebugUtil.h"
|
||||
#include "Graphics/Windowing/SHWindow.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -21,15 +22,14 @@ namespace SHADE
|
|||
{
|
||||
Handle<SHVkBuffer> vertexBuffer;
|
||||
Handle<SHVkBuffer> indicesBuffer;
|
||||
|
||||
};
|
||||
|
||||
Handle<SHVkLogicalDevice> device;
|
||||
SHWindow window;
|
||||
std::array<Buffers, 2> primitiveBuffers;
|
||||
|
||||
public:
|
||||
void InitializeBuffers(void) noexcept;
|
||||
|
||||
void Render(ImGuiIO& io, ImDrawData* drawData, Handle<SHVkDescriptorSetGroup> descriptorSetGroup);
|
||||
};
|
||||
|
||||
struct SHBreachInstance : public SHImGuiWindow
|
||||
|
@ -44,7 +44,7 @@ namespace SHADE
|
|||
void InitializePipeline(ImGuiIO& io, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) noexcept;
|
||||
};
|
||||
public:
|
||||
static void CreateInstance(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) noexcept;
|
||||
static void CreateInstance(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex, SHWindow& mainWindow) noexcept;
|
||||
static void Render(void) noexcept;
|
||||
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace SHADE
|
|||
return true;
|
||||
{
|
||||
MSG Message;
|
||||
while (PeekMessageW(&Message, NULL, 0, 0, PM_REMOVE))
|
||||
while (PeekMessageW(&Message, wndHWND, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (WM_QUIT == Message.message)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue