@ -30,13 +30,34 @@ The Immediate Mode GUI paradigm may at first appear unusual to some users. This
- [Jari Komppa's tutorial on building an ImGui library](http://iki.fi/sol/imgui/).
- [Casey Muratori's original video that popularized the concept](https://mollyrocket.com/861).
Frequently Asked Question
-------------------------
<b>How do you use ImGui on a platform that may not have a mouse and keyboard?</b>
I recommend using [Synergy](http://synergy-project.org) and the uSynergy.c micro client to share your mouse and keyboard. This way you can seemingly use your PC input devices on a video game console or a tablet. ImGui was also designed to function with touch inputs if you increase the padding of widgets to compensate for the lack of precision of touch devices, but it is recommended you use a mouse to allow optimising for screen real-estate.
<b>I integrated ImGui in my engine and the text or lines are blurry..</b>
- Try adjusting ImGui::GetIO().PixelCenterOffset to 0.0f or 0.5f.
- In your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f).
<b>Can you create elaborate/serious tools with ImGui?</b>
Yes. I have written data browsers, debuggers, profilers and all sort of non-trivial tools with the library. There's no reason you cannot, and in my experience the simplicity of the API is very empowering. However note that ImGui is programmer centric and the immediate-mode GUI paradigm might requires a bit of adaptation before you can realize its full potential.
<b>Can you reskin the look of ImGui?</b>
Yes, you can alter the look of the interface to some degree: changing colors, sizes and padding, font. However, as ImGui is designed and optimised to create debug tools, the amount of skinning you can apply is limited. There is only so much you can stray away from the default look and feel of the interface. The example below uses modified settings to create a more compact UI with different colors:
Developed by [Omar Cornut](http://www.miracleworld.net). The library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com).
Embeds [proggy_clean](http://www.proggyfonts.net/) font by Tristan Grimmer (also MIT license).
Embeds [proggy_clean](http://upperbounds.net) font by Tristan Grimmer (also MIT license).
Inspiration, feedback, and testing: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. Thanks!
io.DisplaySize=ImVec2((float)w,(float)h);// Display size, in pixels. For clamping windows positions.
io.DeltaTime=1.0f/60.0f;// Time elapsed since last frame, in seconds (in this sample app we'll override this every frame because our timestep is variable)
io.PixelCenterOffset=0.5f;// Align OpenGL texels
io.PixelCenterOffset=0.0f;// Align OpenGL texels
io.KeyMap[ImGuiKey_Tab]=GLFW_KEY_TAB;// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
// - if (IMGUI_ONCE_UPON_A_FRAME) // Execute a block of code once per frame only
// - struct ImGuiTextFilter // Parse and apply text filter. In format "aaaaa[,bbbb][,ccccc]"
// - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text
// - struct ImGuiStorage // Custom key value storage (if you need to alter open/close states manually)
// - struct ImDrawList // Draw command list
@ -168,8 +179,11 @@ namespace ImGui
floatGetColumnOffset(intcolumn_index=-1);
voidSetColumnOffset(intcolumn_index,floatoffset);
floatGetColumnWidth(intcolumn_index=-1);
ImVec2GetCursorPos();// cursor position is relative to window position
ImVec2GetCursorPos();// cursor position relative to window position
voidSetCursorPos(constImVec2&pos);// "
voidSetCursorPosX(floatx);// "
voidSetCursorPosY(floaty);// "
ImVec2GetCursorScreenPos();// cursor position in screen space
voidAlignFirstTextHeightToWidgets();// call once if the first item on the line is a Text() item and you want to vertically lower it to match higher widgets.
// See constructor for comments of individual fields.
structImGuiStyle
{
ImVec2WindowPadding;
ImVec2WindowMinSize;
ImVec2FramePadding;
ImVec2ItemSpacing;
ImVec2ItemInnerSpacing;
ImVec2TouchExtraPadding;
ImVec2AutoFitPadding;
floatWindowFillAlphaDefault;
floatWindowRounding;
floatTreeNodeSpacing;
floatColumnsMinSpacing;
floatScrollBarWidth;
floatAlpha;// Global alpha applies to everything in ImGui
ImVec2WindowPadding;// Padding within a window
ImVec2WindowMinSize;// Minimum window size
ImVec2FramePadding;// Padding within a framed rectangle (used by most widgets)
ImVec2ItemSpacing;// Horizontal and vertical spacing between widgets/lines
ImVec2ItemInnerSpacing;// Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
ImVec2TouchExtraPadding;// Expand bounding box for touch-based system where touch position is not accurate enough (unnecessary for mouse inputs). Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget running. So dont grow this too much!
ImVec2AutoFitPadding;// Extra space after auto-fit (double-clicking on resize grip)
floatWindowFillAlphaDefault;// Default alpha of window background, if not specified in ImGui::Begin()
floatWindowRounding;// Radius of window corners rounding. Set to 0.0f to have rectangular windows
floatTreeNodeSpacing;// Horizontal spacing when entering a tree node
floatColumnsMinSpacing;// Minimum horizontal spacing between two columns
floatScrollBarWidth;// Width of the vertical scroll bar
ImVec4Colors[ImGuiCol_COUNT];
ImGuiStyle();
@ -389,9 +404,10 @@ struct ImGuiIO
floatMouseDoubleClickMaxDist;// = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
intKeyMap[ImGuiKey_COUNT];// <unset> // Map of indices into the KeysDown[512] entries array
ImFontFont;// <auto> // Gets passed to text functions. Typedef ImFont to the type you want (ImBitmapFont* or your own font).
floatFontHeight;// <auto> // Default font height, must be the vertical distance between two lines of text, aka == CalcTextSize(" ").y
floatFontYOffset;// = 0.0f // Offset font rendering by xx pixels in Y axis.
ImVec2FontTexUvForWhite;// = (0.0f,0.0f) // Font texture must have a white pixel at this UV coordinate. Adjust if you are using custom texture.
boolFontAllowScaling;// = false // Set to allow scaling text with CTRL+Wheel.
floatPixelCenterOffset;// = 0.5f // Set to 0.0f for DirectX <= 9, 0.5f for Direct3D >= 10 and OpenGL.
floatPixelCenterOffset;// = 0.0f // Try to set to 0.5f or 0.375f if rendering is blurry
// Settings - Rendering function (REQUIRED)
// See example code if you are unsure of how to implement this.