mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
ImGui: Replaced helpers Push/PopEnabled with Begin/EndDisabled functionality from ImGui.
This commit is contained in:
2
3rdparty/dear-imgui/imgui_user.h
vendored
2
3rdparty/dear-imgui/imgui_user.h
vendored
@@ -14,7 +14,7 @@ namespace ImGui
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void PushFont(Font::Enum _font);
|
void PushFont(Font::Enum _font, float _fontSizeBaseUnscaled = 0.0f);
|
||||||
|
|
||||||
// BK - simple string class for convenience.
|
// BK - simple string class for convenience.
|
||||||
class ImString
|
class ImString
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ public:
|
|||||||
|
|
||||||
ImGui::Text("%d draw calls", bgfx::getStats()->numDraw);
|
ImGui::Text("%d draw calls", bgfx::getStats()->numDraw);
|
||||||
|
|
||||||
ImGui::PushEnabled(instancingSupported);
|
ImGui::BeginDisabled(!instancingSupported);
|
||||||
ImGui::Checkbox("Use Instancing", &m_useInstancing);
|
ImGui::Checkbox("Use Instancing", &m_useInstancing);
|
||||||
ImGui::PopEnabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
ImGui::Text("Grid Side Size:");
|
ImGui::Text("Grid Side Size:");
|
||||||
ImGui::SliderInt("##size", (int*)&m_sideSize, 1, 512);
|
ImGui::SliderInt("##size", (int*)&m_sideSize, 1, 512);
|
||||||
|
|||||||
@@ -773,9 +773,9 @@ public:
|
|||||||
| BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED
|
| BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED
|
||||||
| BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED
|
| BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED
|
||||||
) );
|
) );
|
||||||
ImGui::PushEnabled(false);
|
ImGui::BeginDisabled(true);
|
||||||
ImGui::Checkbox("Emu", &emulated);
|
ImGui::Checkbox("Emu", &emulated);
|
||||||
ImGui::PopEnabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) )
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) )
|
||||||
{
|
{
|
||||||
@@ -784,9 +784,9 @@ public:
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
bool framebuffer = 0 != (formatFlags & BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER);
|
bool framebuffer = 0 != (formatFlags & BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER);
|
||||||
ImGui::PushEnabled(false);
|
ImGui::BeginDisabled(true);
|
||||||
ImGui::Checkbox("FB", &framebuffer);
|
ImGui::Checkbox("FB", &framebuffer);
|
||||||
ImGui::PopEnabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) )
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) )
|
||||||
{
|
{
|
||||||
@@ -795,9 +795,9 @@ public:
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
bool msaa = 0 != (formatFlags & BGFX_CAPS_FORMAT_TEXTURE_MSAA);
|
bool msaa = 0 != (formatFlags & BGFX_CAPS_FORMAT_TEXTURE_MSAA);
|
||||||
ImGui::PushEnabled(false);
|
ImGui::BeginDisabled(true);
|
||||||
ImGui::Checkbox("MSAA", &msaa);
|
ImGui::Checkbox("MSAA", &msaa);
|
||||||
ImGui::PopEnabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) )
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -600,23 +600,9 @@ void imguiEndFrame()
|
|||||||
|
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
void PushFont(Font::Enum _font)
|
void PushFont(Font::Enum _font, float _fontSizeBaseUnscaled)
|
||||||
{
|
{
|
||||||
PushFont(s_ctx.m_font[_font], 0.0f);
|
PushFont(s_ctx.m_font[_font], _fontSizeBaseUnscaled);
|
||||||
}
|
|
||||||
|
|
||||||
void PushEnabled(bool _enabled)
|
|
||||||
{
|
|
||||||
extern void PushItemFlag(int option, bool enabled);
|
|
||||||
PushItemFlag(ImGuiItemFlags_Disabled, !_enabled);
|
|
||||||
PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (_enabled ? 1.0f : 0.5f) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopEnabled()
|
|
||||||
{
|
|
||||||
extern void PopItemFlag();
|
|
||||||
PopItemFlag();
|
|
||||||
PopStyleVar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
|||||||
@@ -133,12 +133,6 @@ namespace ImGui
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
void PushEnabled(bool _enabled);
|
|
||||||
|
|
||||||
///
|
|
||||||
void PopEnabled();
|
|
||||||
|
|
||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
|
||||||
#endif // IMGUI_H_HEADER_GUARD
|
#endif // IMGUI_H_HEADER_GUARD
|
||||||
|
|||||||
Reference in New Issue
Block a user