6#ifndef IMGUI_H_HEADER_GUARD
7#define IMGUI_H_HEADER_GUARD
14#include <imgui_includes.h>
19inline uint32_t
imguiRGBA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255)
21 return 0 | (uint32_t(_r) << 0) | (uint32_t(_g) << 8) | (uint32_t(_b) << 16) | (uint32_t(_a) << 24);
39#define IMGUI_FLAGS_NONE UINT8_C(1 << 0)
40#define IMGUI_FLAGS_ALPHA_BLEND UINT8_C(1 << 1)
41#define IMGUI_FLAGS_FLIP_UV UINT8_C(1 << 2)
42#define IMGUI_FLAGS_CUBEMAP UINT8_C(1 << 3)
104 ImTexture tex =
ToTex(_handle, 0, {gfx::invalid_handle}, _mip, _flags);
115 if(_handle.
info.cubeMap)
131 return ToId(*_handle, _mip, _flags);
138 return ToId(_handle.
get(), _mip, _flags);
143 return ImVec2{float(tex.
info.width * (tex.
info.cubeMap ? 4 : 1)), float(tex.
info.height * (tex.
info.cubeMap ? 3 : 1))};
150 return GetSize(*tex, fallback);
171 const ImVec2& _uv0 = ImVec2(0.0f, 0.0f),
172 const ImVec2& _uv1 = ImVec2(1.0f, 1.0f))
174 Image(
ToId(_handle, _mip, _flags), _size, _uv0, _uv1);
180 const ImVec2& _uv0 = ImVec2(0.0f, 0.0f),
181 const ImVec2& _uv1 = ImVec2(1.0f, 1.0f))
191 const ImVec2& _uv0 = ImVec2(0.0f, 0.0f),
192 const ImVec2& _uv1 = ImVec2(1.0f, 1.0f),
193 const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f),
194 const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
196 return ImageButton(
"image",
ToId(_handle, _mip, _flags), _size, _uv0, _uv1, _bgCol, _tintCol);
202 const ImVec2& _uv0 = ImVec2(0.0f, 0.0f),
203 const ImVec2& _uv1 = ImVec2(1.0f, 1.0f),
204 const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f),
205 const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
213 SetCursorPosY(GetCursorPosY() + GetTextLineHeightWithSpacing());
219 return false || ImGui::IsAnyItemActive() || ImGui::IsAnyItemHovered() ||
220 ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) || ImGuizmo::IsOver();
auto is_valid() const -> bool
std::shared_ptr< texture > ptr
auto native_handle() const -> T
#define IMGUI_FLAGS_CUBEMAP
#define IMGUI_FLAGS_ALPHA_BLEND
void imguiCreate(unravel::render_window *window, float _fontSize=18.0f, bx::AllocatorI *_allocator=NULL)
void imguiProcessEvent(os::event &e)
void imguiBeginFrame(float dt)
#define IMGUI_FLAGS_FLIP_UV
void imguiEndFrame(gfx::view_id id)
uint32_t imguiRGBA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a=255)
void PushWindowFontSize(int size)
void Image(gfx::texture_handle _handle, uint8_t _mip, uint8_t _flags, const ImVec2 &_size, const ImVec2 &_uv0=ImVec2(0.0f, 0.0f), const ImVec2 &_uv1=ImVec2(1.0f, 1.0f))
void PushFont(Font::Enum _font)
ImTexture ToTex(gfx::texture_handle _handle, uint8_t _index, gfx::program_handle _phandle, uint8_t _mip=0, uint8_t _flags=IMGUI_FLAGS_ALPHA_BLEND)
bool ImageButton(gfx::texture_handle _handle, uint8_t _mip, uint8_t _flags, const ImVec2 &_size, const ImVec2 &_uv0=ImVec2(0.0f, 0.0f), const ImVec2 &_uv1=ImVec2(1.0f, 1.0f), const ImVec4 &_bgCol=ImVec4(0.0f, 0.0f, 0.0f, 0.0f), const ImVec4 &_tintCol=ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
void PushEnabled(bool _enabled)
ImTextureID ToId(gfx::texture_handle _handle, uint8_t _mip=0, uint8_t _flags=IMGUI_FLAGS_ALPHA_BLEND)
void PopWindowFontScale()
ImFont * GetFont(Font::Enum _font)
void KeepAliveOneFrame(const gfx::texture::ptr &tex)
void PushWindowFontScale(float scale)
ImVec2 GetSize(const gfx::texture &tex, const ImVec2 &fallback={})
void PushReadonly(bool _enabled)
bgfx::TextureHandle texture_handle
bgfx::ProgramHandle program_handle
auto is_origin_bottom_left() -> bool
Represents a handle to an asset, providing access and management functions.
auto get(bool wait=true) const -> std::shared_ptr< T >
Gets the shared pointer to the asset.
auto is_ready() const -> bool
Checks if the task is ready.
auto is_render_target() const -> bool
texture_info info
Texture detail info.
Struct representing a render window.
struct ImGui::ImTexture::@57 s
gfx::program_handle phandle
gfx::texture_handle handle