diff --git a/imconfig.h b/imconfig.h index f5d971ee1..4f1deac8b 100644 --- a/imconfig.h +++ b/imconfig.h @@ -4,18 +4,22 @@ #pragma once -// Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h +//---- Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h //#include //#define ImVector std::vector //#define ImVector MyVector -// Define assertion handler. Default to calling assert(). -// #define IM_ASSERT(_EXPR) MyAssert(_EXPR) +//---- Define assertion handler. Defaults to calling assert(). +//#define IM_ASSERT(_EXPR) MyAssert(_EXPR) -// Tell ImGui to not implement default clipboard handlers for Windows (so as not to link with OpenClipboard(), etc.) -// #define IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS +//---- Don't implement default clipboard handlers for Windows (so as not to link with OpenClipboard(), etc.) +//#define IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS -// Define implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4. +//---- If you are loading a custom font, ImGui expect to find a pure white pixel at (0,0) +// Change it's UV coordinate here if you can't have a white pixel at (0,0) +//#define IMGUI_FONT_TEX_UV_FOR_WHITE ImVec2(0.f/256.f,0.f/256.f) + +//---- Define implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4. /* #define IM_VEC2_CLASS_EXTRA \ ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ @@ -26,8 +30,8 @@ operator MyVec4() const { return MyVec4(x,y,z,w); } */ -// Freely implement extra functions within the ImGui:: namespace. -// e.g. you can create variants of the ImGui::Value() helper for your low-level math types. +//---- Freely implement extra functions within the ImGui:: namespace. +//---- e.g. you can create variants of the ImGui::Value() helper for your low-level math types. /* namespace ImGui { diff --git a/imgui.cpp b/imgui.cpp index 48775f683..6943ad37e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -101,7 +101,7 @@ - if you want to use a different font than the default - create bitmap font data using BMFont. allocate ImGui::GetIO().Font and use ->LoadFromFile()/LoadFromMemory(), set ImGui::GetIO().FontHeight - - load your texture yourself. texture *MUST* have white pixel at UV coordinate 'IMDRAW_TEX_UV_FOR_WHITE' (you can #define it in imconfig.h), this is used by solid objects. + - load your texture yourself. texture *MUST* have white pixel at UV coordinate 'IMGUI_FONT_TEX_UV_FOR_WHITE' (you can #define it in imconfig.h), this is used by solid objects. - tip: the construct 'if (IMGUI_ONCE_UPON_A_FRAME)' will evaluate to true only once a frame, you can use it to add custom UI in the middle of a deep nested inner loop in your code. - tip: you can call Render() multiple times (e.g for VR renders), up to you to communicate the extra state to your RenderDrawListFn function. @@ -4703,7 +4703,7 @@ void ImDrawList::AddVtx(const ImVec2& pos, ImU32 col) { vtx_write->pos = pos; vtx_write->col = col; - vtx_write->uv = IMDRAW_TEX_UV_FOR_WHITE; + vtx_write->uv = IMGUI_FONT_TEX_UV_FOR_WHITE; vtx_write++; } diff --git a/imgui.h b/imgui.h index 0102911cb..b3549d9c7 100644 --- a/imgui.h +++ b/imgui.h @@ -509,8 +509,8 @@ struct ImDrawCmd ImVec4 clip_rect; }; -#ifndef IMDRAW_TEX_UV_FOR_WHITE -#define IMDRAW_TEX_UV_FOR_WHITE ImVec2(0,0) +#ifndef IMGUI_FONT_TEX_UV_FOR_WHITE +#define IMGUI_FONT_TEX_UV_FOR_WHITE ImVec2(0.f,0.f) #endif // sizeof() == 20