This commit is contained in:
Бранимир Караџић 2021-04-02 12:51:59 -07:00
parent 0df2e90edb
commit 1fb245c581
2 changed files with 23 additions and 12 deletions

View File

@ -9,6 +9,7 @@
#include <bx/math.h>
#include <bx/timer.h>
#include <dear-imgui/imgui.h>
#include <dear-imgui/imgui_internal.h>
#include "imgui.h"
#include "../bgfx_utils.h"
@ -443,6 +444,21 @@ namespace ImGui
{
PushFont(s_ctx.m_font[_font]);
}
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
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4505); // error C4505: '' : unreferenced local function has been removed

View File

@ -41,6 +41,7 @@ namespace ImGui
#define IMGUI_FLAGS_NONE UINT8_C(0x00)
#define IMGUI_FLAGS_ALPHA_BLEND UINT8_C(0x01)
///
inline ImTextureID toId(bgfx::TextureHandle _handle, uint8_t _flags, uint8_t _mip)
{
union { struct { bgfx::TextureHandle handle; uint8_t flags; uint8_t mip; } s; ImTextureID id; } tex;
@ -104,11 +105,13 @@ namespace ImGui
return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, 0, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
}
///
inline void NextLine()
{
SetCursorPosY(GetCursorPosY() + GetTextLineHeightWithSpacing() );
}
///
inline bool MouseOverArea()
{
return false
@ -119,19 +122,11 @@ namespace ImGui
;
}
inline void PushEnabled(bool _enabled)
{
extern void PushItemFlag(int option, bool enabled);
PushItemFlag(1<<2 /*ImGuiItemFlags_Disabled*/, !_enabled);
PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (_enabled ? 1.0f : 0.5f) );
}
///
void PushEnabled(bool _enabled);
inline void PopEnabled()
{
extern void PopItemFlag();
PopItemFlag();
PopStyleVar();
}
///
void PopEnabled();
} // namespace ImGui