mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Tests: Reworking hook prototypes for imgui-test to be faster and multi-context friendly.
This commit is contained in:
parent
c2db7f63bd
commit
b33977bc15
@ -2697,7 +2697,8 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg)
|
|||||||
window->DC.LastItemStatusFlags = ImGuiItemStatusFlags_None;
|
window->DC.LastItemStatusFlags = ImGuiItemStatusFlags_None;
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
ImGuiTestEngineHook_ItemAdd(bb, id);
|
if (id != 0)
|
||||||
|
ImGuiTestEngineHook_ItemAdd(&g, bb, id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clipping test
|
// Clipping test
|
||||||
@ -3251,7 +3252,7 @@ void ImGui::NewFrame()
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
ImGuiTestEngineHook_PreNewFrame();
|
ImGuiTestEngineHook_PreNewFrame(&g);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check user data
|
// Check user data
|
||||||
@ -3427,7 +3428,7 @@ void ImGui::NewFrame()
|
|||||||
g.FrameScopePushedImplicitWindow = true;
|
g.FrameScopePushedImplicitWindow = true;
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
ImGuiTestEngineHook_PostNewFrame();
|
ImGuiTestEngineHook_PostNewFrame(&g);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1429,11 +1429,11 @@ IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned ch
|
|||||||
// Test engine hooks (imgui-test)
|
// Test engine hooks (imgui-test)
|
||||||
//#define IMGUI_ENABLE_TEST_ENGINE
|
//#define IMGUI_ENABLE_TEST_ENGINE
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
extern void ImGuiTestEngineHook_PreNewFrame();
|
extern void ImGuiTestEngineHook_PreNewFrame(ImGuiContext* ctx);
|
||||||
extern void ImGuiTestEngineHook_PostNewFrame();
|
extern void ImGuiTestEngineHook_PostNewFrame(ImGuiContext* ctx);
|
||||||
extern void ImGuiTestEngineHook_ItemAdd(const ImRect& bb, ImGuiID id);
|
extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id);
|
||||||
extern void ImGuiTestEngineHook_ItemInfo(ImGuiID id, const char* label, int flags);
|
extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, int flags);
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID, _LABEL, _FLAGS) ImGuiTestEngineHook_ItemInfo(_ID, _LABEL, _FLAGS) // Register status flags
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID, _LABEL, _FLAGS) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register status flags
|
||||||
#else
|
#else
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID, _LABEL, _FLAGS) do { } while (0)
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID, _LABEL, _FLAGS) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -282,7 +282,7 @@ void ImGui::TextWrapped(const char* fmt, ...)
|
|||||||
|
|
||||||
void ImGui::TextWrappedV(const char* fmt, va_list args)
|
void ImGui::TextWrappedV(const char* fmt, va_list args)
|
||||||
{
|
{
|
||||||
bool need_backup = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set
|
bool need_backup = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set
|
||||||
if (need_backup)
|
if (need_backup)
|
||||||
PushTextWrapPos(0.0f);
|
PushTextWrapPos(0.0f);
|
||||||
TextV(fmt, args);
|
TextV(fmt, args);
|
||||||
@ -399,8 +399,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
g.HoveredWindow = window;
|
g.HoveredWindow = window;
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
if (window->DC.LastItemId != id)
|
if (id != 0 && window->DC.LastItemId != id)
|
||||||
ImGuiTestEngineHook_ItemAdd(bb, id);
|
ImGuiTestEngineHook_ItemAdd(&g, bb, id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user