From 7adac4ab3e42950e45c34a1bc2237b2763c25c41 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 26 Jul 2018 12:55:40 +0200 Subject: [PATCH] FAQ update --- README.md | 1 + imconfig.h | 2 +- imgui.cpp | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d91b40e4..14e11cf1 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,7 @@ The library started its life and is best known as "ImGui" only due to the fact t How can I tell whether to dispatch mouse/keyboard to imgui or to my application?
How can I display an image? What is ImTextureID, how does it works?
How can I have multiple widgets with the same label or without a label? A primer on labels and the ID Stack. +
How can I use my own math types instead of ImVec2/ImVec4?
How can I load a different font than the default?
How can I easily use icons in my application?
How can I load multiple fonts? diff --git a/imconfig.h b/imconfig.h index c6298cca..50b7f471 100644 --- a/imconfig.h +++ b/imconfig.h @@ -48,7 +48,7 @@ //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION -//---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4. +//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. // This will be inlined as part of ImVec2 and ImVec4 class declarations. /* #define IM_VEC2_CLASS_EXTRA \ diff --git a/imgui.cpp b/imgui.cpp index 1b5042f8..da6befed 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -32,6 +32,7 @@ - How can I tell whether to dispatch mouse/keyboard to imgui or to my application? - How can I display an image? What is ImTextureID, how does it works? - How can I have multiple widgets with the same label or without a label? A primer on labels and the ID Stack. + - How can I use my own math types instead of ImVec2/ImVec4? - How can I load a different font than the default? - How can I easily use icons in my application? - How can I load multiple fonts? @@ -685,6 +686,10 @@ e.g. when displaying a list of objects, using indices or pointers as ID will preserve the node open/closed state differently. See what makes more sense in your situation! + Q: How can I use my own math types instead of ImVec2/ImVec4? + A: You can edit imconfig.h and setup the IM_VEC2_CLASS_EXTRA/IM_VEC4_CLASS_EXTRA macros to add implicit type conversions. + This way you'll be able to use your own types everywhere, e.g. passsing glm::vec2 to ImGui functions instead of ImVec2. + Q: How can I load a different font than the default? A: Use the font atlas to load the TTF/OTF file you want: ImGuiIO& io = ImGui::GetIO();