41 lines
957 B
C++
41 lines
957 B
C++
#pragma once
|
|
|
|
#include <imgui.h>
|
|
|
|
#include <sophia/handles.hpp>
|
|
#include <sophia/resource_registry_ref.hpp>
|
|
|
|
namespace sophia {
|
|
|
|
class ImGuiRenderer;
|
|
|
|
class UI {
|
|
public:
|
|
UI(const UI&) = delete;
|
|
UI& operator=(const UI&) = delete;
|
|
|
|
/**
|
|
* Draws the target filling the space left in the current window, and keeps
|
|
* the target sized to match. The target catches up on the next frame, so the
|
|
* image may be a frame behind while the window is being resized.
|
|
*/
|
|
void image(RenderTargetHandle handle);
|
|
|
|
/**
|
|
* Texture to hand to ImGui::Image() that shows the target's contents.
|
|
* Changes when the target is resized, so fetch it each frame rather than
|
|
* caching it.
|
|
*/
|
|
ImTextureID getTextureId(RenderTargetHandle handle);
|
|
|
|
private:
|
|
friend class Application;
|
|
|
|
explicit UI(ResourceRegistryRef resources) : resources{resources} {}
|
|
|
|
ResourceRegistryRef resources;
|
|
ImGuiRenderer* renderer = nullptr;
|
|
};
|
|
|
|
} // namespace sophia
|