@ -55,15 +55,17 @@ Integrating Dear ImGui within your custom engine is a matter of wiring mouse/key
_NB: those third-party bindings may be more or less maintained, more or less close to the spirit of original API and therefore I cannot give much guarantee about them. People who create language bindings sometimes haven't used the C++ API themselves (for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
Languages:
- C (cimgui): thin c-api wrapper for ImGui https://github.com/Extrawurst/cimgui
- C#/.Net (ImGui.NET): An ImGui wrapper for .NET Core https://github.com/mellinoe/ImGui.NET
- D (DerelictImgui): Dynamic bindings for the D programming language: https://github.com/Extrawurst/DerelictImgui
- C (cimgui): https://github.com/Extrawurst/cimgui
- Main ImGui repository include examples for DirectX9, DirectX10, DirectX11, OpenGL2/3, Vulkan, Allegro 5, SDL+GL2/3, iOS and Marmalade: https://github.com/ocornut/imgui/tree/master/examples
@ -126,6 +129,8 @@ The Immediate Mode GUI paradigm may at first appear unusual to some users. This
- [Nicolas Guillemot's CppCon'16 flashtalk about Dear ImGui](https://www.youtube.com/watch?v=LSRJ1jZq90k).
- [Thierry Excoffier's Zero Memory Widget](http://perso.univ-lyon1.fr/thierry.excoffier/ZMW/).
See the [Software using dear imgui page](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) for an incomplete list of software which are publicly known to use dear migui.
See the [Links page](https://github.com/ocornut/imgui/wiki/Links) for third-party bindings to different languages and frameworks.
The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' that you can use without any external files.
The files in this folder are only provided as a convenience, you can use any .TTF/.OTF.
The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' (by Tristan Grimmer) that is used by default.
We embed the font in source code so you can use Dear ImGui without any file system access.
You may also load external .TTF/.OTF files.
The files in this folder are suggested fonts, provided as a convenience.
(Note: .OTF support in stb_truetype.h currently doesn't appear to load every font)
Fonts are rasterized in a single texture at the time of calling either of io.Fonts.GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build().
@ -12,6 +14,7 @@
Using an icon font (such as FontAwesome: http://fontawesome.io) is an easy and practical way to use icons in your ImGui application.
A common pattern is to merge the icon font within your main font, so you can refer to the icons directly from your strings without having to change fonts back and forth.
To refer to the icon from your C++ code, you can use headers files created by Juliette Foucaut, at https://github.com/juliettef/IconFontCppHeaders
See Links below for other icons fonts and related tools.
All your strings needs to use UTF-8 encoding. Specifying literal in your source code using a local code page (such as CP-923 for Japanese CP-1251 for Cyrillic) will NOT work!
All your strings needs to use UTF-8 encoding. Specifying literal in your source code using a local code page (such as CP-923 for Japanese, or CP-1251 for Cyrillic) will NOT work!
In C++11 you can encode a string literal in UTF-8 by using the u8"hello" syntax. Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8.
You can also try to remap your local codepage characters to their Unicode codepoint using font->AddRemapChar(), but international users may have problems reading/editing your source code.
e.g.
u8"hello"
u8"こんにちは"
You may also try to remap your local codepage characters to their Unicode codepoint using font->AddRemapChar(), but international users may have problems reading/editing your source code.
---------------------------------
EMBEDDING FONT IN SOURCE CODE
---------------------------------
Compile and use 'binary_to_compressed_c.cpp' to create a compressed C style array.
Compile and use 'binary_to_compressed_c.cpp' to create a compressed C style array that you can embed in source code.
See the documentation in binary_to_compressed_c.cpp for instruction on how to use the tool.
You may find a precompiled version binary_to_compressed_c.exe for Windows instead of demo binaries package (see README).
The tool optionally used Base85 encoding to reduce the size of _source code_ but the read-only arrays will be about 20% bigger.
Then load the font with:
ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels, ...);
@ -164,36 +173,40 @@
---------------------------------
LINKS
LINKS & OTHER FONTS
---------------------------------
Icon fonts
(Icons) Icon fonts
https://fortawesome.github.io/Font-Awesome/
https://github.com/SamBrishes/kenney-icon-font
https://design.google.com/icons/
You can use https://github.com/juliettef/IconFontCppHeaders for C/C++ header files with name #define to access icon codepoint in source code.
IcoMoon - Custom Icon font builder
(Icons) IcoMoon - Custom Icon font builder
https://icomoon.io/app
Typefaces for source code beautification
https://github.com/chrissimpkins/codeface
(Regular) Open Sans Fonts
https://fonts.google.com/specimen/Open+Sans
(Regular) Google Noto Fonts (worldwide languages)
https://www.google.com/get/noto/
Programmation fonts
(Monospace) Typefaces for source code beautification
boolwindow_just_activated_by_user=(window->LastFrameActive<current_frame-1);// Not using !WasActive because the implicit "Debug" window would always toggle off->on
window->RootNonPopupWindow=g.CurrentWindowStack[root_non_popup_idx];// Used to display TitleBgActive color and for selecting which window to use for NavWindowing
// When reusing window again multiple times a frame, just append content (don't need to setup again)
window->RootNonPopupWindow=!(flags&(ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Popup))||(flags&ImGuiWindowFlags_Modal)?window:parent_window->RootNonPopupWindow;// Used to display TitleBgActive color and for selecting which window to use for NavWindowing
// Update scrollbar status (based on the Size that was effective during last frame or the auto-resized Size). We need to do this before manual resize (below) is effective.
// (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)
// AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
// AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
constboolis_shortcut_key_only=(io.OSXBehaviors ?(io.KeySuper&&!io.KeyCtrl):(io.KeyCtrl&&!io.KeySuper))&&!io.KeyAlt&&!io.KeyShift;// OS X style: Shortcuts using Cmd/Super instead of Ctrl
constboolis_wordmove_key_down=io.OSXBehaviors ?io.KeyAlt:io.KeyCtrl;// OS X style: Text editing cursor movement using Alt instead of Ctrl
constboolis_startend_key_down=io.OSXBehaviors &&io.KeySuper&&!io.KeyCtrl&&!io.KeyAlt;// OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
constboolis_shortcut_key_only=(io.OptMacOSXBehaviors ?(io.KeySuper&&!io.KeyCtrl):(io.KeyCtrl&&!io.KeySuper))&&!io.KeyAlt&&!io.KeyShift;// OS X style: Shortcuts using Cmd/Super instead of Ctrl
constboolis_wordmove_key_down=io.OptMacOSXBehaviors ?io.KeyAlt:io.KeyCtrl;// OS X style: Text editing cursor movement using Alt instead of Ctrl
constboolis_startend_key_down=io.OptMacOSXBehaviors &&io.KeySuper&&!io.KeyCtrl&&!io.KeyAlt;// OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
g.ActiveIdClickOffset.x-=column_w;// Store from center of column line (we used a 8 wide rect for columns clicking). This is used by GetDraggedColumnOffset().
g.ActiveIdClickOffset.x-=column_hw;// Store from center of column line (we used a 8 wide rect for columns clicking). This is used by GetDraggedColumnOffset().
if(held)
dragging_column=i;
}
// Draw column
// We clip the Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
ImVec2DisplayVisibleMax;// <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
// Advanced/subtle behaviors
boolOSXBehaviors;// = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
boolOptMacOSXBehaviors;// = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
boolOptCursorBlink;// = true // Enable blinking cursor, for users who consider it annoying.
draw_list->PushClipRect(canvas_pos,ImVec2(canvas_pos.x+canvas_size.x,canvas_pos.y+canvas_size.y));// clip lines within the canvas (if we resize it, etc.)
draw_list->PushClipRect(canvas_pos,ImVec2(canvas_pos.x+canvas_size.x,canvas_pos.y+canvas_size.y), true);// clip lines within the canvas (if we resize it, etc.)
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
// Implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
// Set:
// #define IMGUI_DEFINE_MATH_OPERATORS
// Define IM_PLACEMENT_NEW() macro helper.
// #define IMGUI_DEFINE_PLACEMENT_NEW
// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.