SDEngine
Game Engine
Loading...
Searching...
No Matches
SDImGuiContext.hpp
Go to the documentation of this file.
1// TODO(docs): Add file-level Doxygen header
2// - @file SDImGuiContext.hpp
3// - @brief ImGui context and Vulkan backend setup
4// - Dock space management
5// - Texture descriptor set utilities
6#pragma once
7#include <imgui.h>
8
9#include <backends/imgui_impl_vulkan.h>
10
11#include "SD/core/Window.hpp"
14
15namespace sd {
16
18 std::function<void()> close_app;
19};
20// TODO(docs): Document SDImGuiContext class
21// - Purpose: Manages ImGui context and Vulkan integration
22// - Init/Shutdown lifecycle
23// - Frame begin/end pattern
24// - Dock space creation (BeginDockSpace/EndDockSpace)
25// - Texture utilities (CreateTextureFromView, RemoveTexture)
26// - Example: Setting up ImGui in a custom layer
28public:
32 SDImGuiContext(SDImGuiContext&& other) noexcept = delete;
35
36
38
39 void shutdown();
40
41 void begin_frame();
42 void end_frame();
43 void render_draw_data(vk::CommandBuffer cmd);
45
46 void begin_dock_space(const std::string& title = "SDEngine Editor");
47 void end_dock_space();
48
49 ImGuiContext* get_context() const { return m_context; }
50 vk::DescriptorPool get_descriptor_pool() const { return *m_descriptor_pool; }
51
56
57
58private:
61
62private:
64
66
67 vk::UniqueDescriptorPool m_descriptor_pool;
68 vk::UniqueRenderPass m_render_pass;
69 vk::UniqueSampler m_default_sampler;
71};
72
73} // namespace sd
Definition SDImGuiContext.hpp:27
SDImGuiContext(SDImGuiContext &&other) noexcept=delete
void update_platform_windows()
Definition SDImGuiContext.cpp:112
vk::UniqueRenderPass m_render_pass
Definition SDImGuiContext.hpp:68
VkDescriptorSet create_texture_from_view(VkImageView view, VkImageLayout layout=VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
Definition SDImGuiContext.cpp:245
void init(Window &window, VulkanWindow &vw)
Definition SDImGuiContext.cpp:13
SDImGuiContext(const SDImGuiCallbacks &callbacks)
Definition SDImGuiContext.hpp:29
ImGuiContext * m_context
Definition SDImGuiContext.hpp:63
vk::UniqueSampler m_default_sampler
Definition SDImGuiContext.hpp:69
void end_dock_space()
Definition SDImGuiContext.cpp:185
void shutdown()
Definition SDImGuiContext.cpp:80
void end_frame()
Definition SDImGuiContext.cpp:104
~SDImGuiContext()
Definition SDImGuiContext.cpp:9
void create_compatible_render_pass(VulkanContext &ctx, vk::Format format)
Definition SDImGuiContext.cpp:213
bool m_is_vulkan_initialized
Definition SDImGuiContext.hpp:70
ImGuiContext * get_context() const
Definition SDImGuiContext.hpp:49
SDImGuiContext(const SDImGuiContext &other)=delete
void begin_dock_space(const std::string &title="SDEngine Editor")
Definition SDImGuiContext.cpp:120
vk::DescriptorPool get_descriptor_pool() const
Definition SDImGuiContext.hpp:50
void render_draw_data(vk::CommandBuffer cmd)
Definition SDImGuiContext.cpp:108
void remove_texture(VkDescriptorSet descriptor_set)
Definition SDImGuiContext.cpp:249
vk::UniqueDescriptorPool m_descriptor_pool
Definition SDImGuiContext.hpp:67
SDImGuiContext & operator=(const SDImGuiContext &other)=delete
void begin_frame()
Definition SDImGuiContext.cpp:97
void create_descriptor_pool(VulkanContext &ctx)
Definition SDImGuiContext.cpp:189
SDImGuiCallbacks m_callbacks
Definition SDImGuiContext.hpp:65
SDImGuiContext & operator=(SDImGuiContext &&other) noexcept=delete
Definition VulkanContext.hpp:22
Definition VulkanWindow.hpp:35
Definition Window.hpp:49
Definition Application.hpp:28
Definition SDImGuiContext.hpp:17
std::function< void()> close_app
Definition SDImGuiContext.hpp:18
constexpr T g_type_max
Definition types.hpp:21