// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
if(show_test_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiSetCond_FirstUseEver);// Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
if(show_test_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiSetCond_FirstUseEver);// Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
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 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.
// New contexts always point by default to this font atlas. It can be changed by reassigning the GetIO().Fonts variable.
staticImFontAtlasGImDefaultFontAtlas;
// Default context storage + current context pointer.
// Implicitely used by all ImGui functions. Always assumed to be != NULL. Change to a different context by calling ImGui::SetCurrentContext()
// If you are hot-reloading this code in a DLL you will lose the static/global variables. Create your own context+font atlas instead of relying on those default (see FAQ entry "How can I preserve my ImGui context across reloading a DLL?").
// ImGui is currently not thread-safe because of this variable. If you want thread-safety to allow N threads to access N different contexts, you might work around it by:
// - Having multiple instances of the ImGui code compiled inside different namespace (easiest/safest, if you have a finite number of contexts)
// - or: Changing this variable to be TLS. You may #define GImGui in imconfig.h for further custom hackery. Future development aim to make this context pointer explicit to all calls. Also read https://github.com/ocornut/imgui/issues/586
// You can use the "##" or "###" markers to use the same label with different id, or same id with different label. See documentation at the top of this file.
// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
// - Passing 'bool* p_open' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCond_FirstUseEver) prior to calling Begin().
// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiCond_FirstUseEver) prior to calling Begin().
ImGui::Text("HoveredId: 0x%08X/0x%08X",g.HoveredId,g.HoveredIdPreviousFrame);// Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
@ -74,7 +74,7 @@ typedef int ImGuiNavInput; // an input identifier for gamepad nav // e
typedefintImGuiColorEditFlags;// color edit flags for Color*() // enum ImGuiColorEditFlags_
typedefintImGuiMouseCursor;// a mouse cursor identifier // enum ImGuiMouseCursor_
typedefintImGuiWindowFlags;// window flags for Begin*() // enum ImGuiWindowFlags_
typedefintImGuiSetCond;// condition flags for Set*() // enum ImGuiSetCond_
typedefintImGuiCond;// condition flags for Set*() // enum ImGuiCond_
typedefintImGuiInputTextFlags;// flags for InputText*() // enum ImGuiInputTextFlags_
typedefintImGuiSelectableFlags;// flags for Selectable() // enum ImGuiSelectableFlags_
typedefintImGuiTreeNodeFlags;// flags for TreeNode*(), Collapsing*() // enum ImGuiTreeNodeFlags_
@ -149,22 +149,22 @@ namespace ImGui
IMGUI_APIboolIsWindowCollapsed();
IMGUI_APIvoidSetWindowFontScale(floatscale);// per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows
IMGUI_APIvoidSetNextWindowPos(constImVec2&pos,ImGuiSetCond cond=0);// set next window position. call before Begin()
IMGUI_APIvoidSetNextWindowPosCenter(ImGuiSetCond cond=0);// set next window position to be centered on screen. call before Begin()
IMGUI_APIvoidSetNextWindowSize(constImVec2&size,ImGuiSetCond cond=0);// set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
IMGUI_APIvoidSetNextWindowPos(constImVec2&pos,ImGuiCond cond=0);// set next window position. call before Begin()
IMGUI_APIvoidSetNextWindowPosCenter(ImGuiCond cond=0);// set next window position to be centered on screen. call before Begin()
IMGUI_APIvoidSetNextWindowSize(constImVec2&size,ImGuiCond cond=0);// set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
IMGUI_APIvoidSetNextWindowSizeConstraints(constImVec2&size_min,constImVec2&size_max,ImGuiSizeConstraintCallbackcustom_callback=NULL,void*custom_callback_data=NULL);// set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints.
IMGUI_APIvoidSetNextWindowContentSize(constImVec2&size);// set next window content size (enforce the range of scrollbars). set axis to 0.0f to leave it automatic. call before Begin()
IMGUI_APIvoidSetNextWindowContentWidth(floatwidth);// set next window content width (enforce the range of horizontal scrollbar). call before Begin()
IMGUI_APIvoidSetNextWindowCollapsed(boolcollapsed,ImGuiSetCond cond=0);// set next window collapsed state. call before Begin()
IMGUI_APIvoidSetNextWindowCollapsed(boolcollapsed,ImGuiCond cond=0);// set next window collapsed state. call before Begin()
IMGUI_APIvoidSetNextWindowFocus();// set next window to be focused / front-most. call before Begin()
IMGUI_APIvoidSetWindowPos(constImVec2&pos,ImGuiSetCond cond=0);// (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
IMGUI_APIvoidSetWindowSize(constImVec2&size,ImGuiSetCond cond=0);// (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
IMGUI_APIvoidSetWindowCollapsed(boolcollapsed,ImGuiSetCond cond=0);// (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
IMGUI_APIvoidSetWindowPos(constImVec2&pos,ImGuiCond cond=0);// (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
IMGUI_APIvoidSetWindowSize(constImVec2&size,ImGuiCond cond=0);// (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
IMGUI_APIvoidSetWindowCollapsed(boolcollapsed,ImGuiCond cond=0);// (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
IMGUI_APIvoidSetWindowFocus();// (not recommended) set current window to be focused / front-most. prefer using SetNextWindowFocus().
IMGUI_APIvoidSetWindowPos(constchar*name,constImVec2&pos,ImGuiSetCond cond=0);// set named window position.
IMGUI_APIvoidSetWindowSize(constchar*name,constImVec2&size,ImGuiSetCond cond=0);// set named window size. set axis to 0.0f to force an auto-fit on this axis.
IMGUI_APIvoidSetWindowCollapsed(constchar*name,boolcollapsed,ImGuiSetCond cond=0);// set named window collapsed state
IMGUI_APIvoidSetWindowFocus(constchar*name);// set named window to be focused / front-most. use NULL to remove focus.
IMGUI_APIvoidSetWindowPos(constchar*name,constImVec2&pos,ImGuiCond cond=0);// set named window position.
IMGUI_APIvoidSetWindowSize(constchar*name,constImVec2&size,ImGuiCond cond=0);// set named window size. set axis to 0.0f to force an auto-fit on this axis.
IMGUI_APIvoidSetWindowCollapsed(constchar*name,boolcollapsed,ImGuiCond cond=0);// set named window collapsed state
IMGUI_APIvoidSetWindowFocus(constchar*name);// set named window to be focused / front-most. use NULL to remove focus.
IMGUI_APIfloatGetScrollX();// get scrolling amount [0..GetScrollMaxX()]
IMGUI_APIfloatGetScrollY();// get scrolling amount [0..GetScrollMaxY()]
@ -347,7 +347,7 @@ namespace ImGui
IMGUI_APIvoidTreePop();// ~ Unindent()+PopId()
IMGUI_APIvoidTreeAdvanceToLabelPos();// advance cursor x position by GetTreeNodeToLabelSpacing()
IMGUI_APIfloatGetTreeNodeToLabelSpacing();// horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
IMGUI_APIvoidSetNextTreeNodeOpen(boolis_open,ImGuiSetCond cond=0);// set next TreeNode/CollapsingHeader open state.
IMGUI_APIvoidSetNextTreeNodeOpen(boolis_open,ImGuiCond cond=0);// set next TreeNode/CollapsingHeader open state.
IMGUI_APIboolCollapsingHeader(constchar*label,ImGuiTreeNodeFlagsflags=0);// if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
IMGUI_APIboolCollapsingHeader(constchar*label,bool*p_open,ImGuiTreeNodeFlagsflags=0);// when 'p_open' isn't NULL, display an additional small close button on upper right of the header
IMGUI_APIvoidSetTooltip(constchar*fmt,...)IM_PRINTFARGS(1);// set text tooltip under mouse-cursor, typically use with ImGui::IsItemHovered(). overidde any previous call to SetTooltip().
@ -748,13 +746,18 @@ enum ImGuiMouseCursor_
};
// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
// All those functions treat 0 as a shortcut to ImGuiSetCond_Always
enumImGuiSetCond_
// All those functions treat 0 as a shortcut to ImGuiCond_Always
enumImGuiCond_
{
ImGuiSetCond_Always=1<<0,// Set the variable
ImGuiSetCond_Once=1<<1,// Set the variable once per runtime session (only the first call with succeed)
ImGuiSetCond_FirstUseEver=1<<2,// Set the variable if the window has no saved data (if doesn't exist in the .ini file)
ImGuiSetCond_Appearing=1<<3// Set the variable if the window is appearing after being hidden/inactive (or the first time)
ImGuiCond_Always=1<<0,// Set the variable
ImGuiCond_Once=1<<1,// Set the variable once per runtime session (only the first call with succeed)
ImGuiCond_FirstUseEver=1<<2,// Set the variable if the window has no saved data (if doesn't exist in the .ini file)
ImGuiCond_Appearing=1<<3// Set the variable if the window is appearing after being hidden/inactive (or the first time)
// Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)
// NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create a UTF-8 string literally using the u8"Hello world" syntax. See FAQ for details.
// NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details.
IMGUI_APIconstImWchar*GetGlyphRangesDefault();// Basic Latin, Extended Latin
IMGUI_APIconstImWchar*GetGlyphRangesKorean();// Default + Korean characters
IMGUI_APIconstImWchar*GetGlyphRangesJapanese();// Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
@ -1403,6 +1406,19 @@ struct ImFontAtlas
IMGUI_APIconstImWchar*GetGlyphRangesCyrillic();// Default + about 400 Cyrillic characters
voidSetBit(intn){UsedChars[n>>3]|=1<<(n&7);}// Set bit 'c' in the array
voidAddChar(ImWcharc){SetBit(c);}// Add character
IMGUI_APIvoidAddText(constchar*text,constchar*text_end=NULL);// Add string (each character of the UTF-8 string are added)
IMGUI_APIvoidAddRanges(constImWchar*ranges);// Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault) to force add all of ASCII/Latin+Ext
IMGUI_APIvoidBuildRanges(ImVector<ImWchar>*out_ranges);// Output new ranges
};
// Members
// (Access texture data via GetTexData*() calls which will setup a default font for you.)
ImTextureIDTexID;// User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure.