summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/imgui/imgui.h
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/common/imgui/imgui.h')
-rw-r--r--3rdparty/bgfx/examples/common/imgui/imgui.h64
1 files changed, 55 insertions, 9 deletions
diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.h b/3rdparty/bgfx/examples/common/imgui/imgui.h
index acd6e6daf98..e85b9d3a16a 100644
--- a/3rdparty/bgfx/examples/common/imgui/imgui.h
+++ b/3rdparty/bgfx/examples/common/imgui/imgui.h
@@ -26,8 +26,9 @@
#ifndef IMGUI_H_HEADER_GUARD
#define IMGUI_H_HEADER_GUARD
-#include <bgfx.h>
+#include <bgfx/bgfx.h>
#include <ocornut-imgui/imgui.h>
+#include <ocornut-imgui/imgui_wm.h>
#define IMGUI_MBUT_LEFT 0x01
#define IMGUI_MBUT_RIGHT 0x02
@@ -207,20 +208,65 @@ bool imguiMouseOverArea();
namespace ImGui
{
+#define IMGUI_FLAGS_NONE UINT16_C(0x0000)
+#define IMGUI_FLAGS_ALPHA_BLEND UINT16_C(0x0001)
+
+ // Helper function for passing bgfx::TextureHandle to ImGui::Image.
+ inline void Image(bgfx::TextureHandle _handle
+ , uint16_t _flags
+ , const ImVec2& _size
+ , const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
+ , const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
+ , const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
+ , const ImVec4& _borderCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
+ )
+ {
+ union { struct { uint16_t flags; bgfx::TextureHandle handle; } s; ImTextureID ptr; } texture;
+ texture.s.flags = _flags;
+ texture.s.handle = _handle;
+ Image(texture.ptr, _size, _uv0, _uv1, _tintCol, _borderCol);
+ }
+
// Helper function for passing bgfx::TextureHandle to ImGui::Image.
- inline void Image(bgfx::TextureHandle _handle, const ImVec2& _size, const ImVec2& _uv0 = ImVec2(0, 0), const ImVec2& _uv1 = ImVec2(1, 1), const ImVec4& _tint_col = ImVec4(1, 1, 1, 1), const ImVec4& _border_col = ImVec4(0, 0, 0, 0) )
+ inline void Image(bgfx::TextureHandle _handle
+ , const ImVec2& _size
+ , const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
+ , const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
+ , const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
+ , const ImVec4& _borderCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
+ )
+ {
+ Image(_handle, IMGUI_FLAGS_ALPHA_BLEND, _size, _uv0, _uv1, _tintCol, _borderCol);
+ }
+
+ // Helper function for passing bgfx::TextureHandle to ImGui::ImageButton.
+ inline bool ImageButton(bgfx::TextureHandle _handle
+ , uint16_t _flags
+ , const ImVec2& _size
+ , const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
+ , const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
+ , int _framePadding = -1
+ , const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
+ , const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
+ )
{
- union { bgfx::TextureHandle handle; ImTextureID ptr; } texture;
- texture.handle = _handle;
- Image(texture.ptr, _size, _uv0, _uv1, _tint_col, _border_col);
+ union { struct { uint16_t flags; bgfx::TextureHandle handle; } s; ImTextureID ptr; } texture;
+ texture.s.flags = _flags;
+ texture.s.handle = _handle;
+ return ImageButton(texture.ptr, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
}
// Helper function for passing bgfx::TextureHandle to ImGui::ImageButton.
- inline bool ImageButton(bgfx::TextureHandle _handle, const ImVec2& _size, const ImVec2& _uv0 = ImVec2(0,0), const ImVec2& _uv1 = ImVec2(1,1), int _frame_padding = -1, const ImVec4& _bg_col = ImVec4(0,0,0,0), const ImVec4& _tint_col = ImVec4(1,1,1,1))
+ inline bool ImageButton(bgfx::TextureHandle _handle
+ , const ImVec2& _size
+ , const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
+ , const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
+ , int _framePadding = -1
+ , const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
+ , const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
+ )
{
- union { bgfx::TextureHandle handle; ImTextureID ptr; } texture;
- texture.handle = _handle;
- return ImageButton(texture.ptr, _size, _uv0, _uv1, _frame_padding, _bg_col, _tint_col);
+ return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
}
} // namespace ImGui