// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY00 then bounced up to XYY01 when release tagging happens)
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
typedefsignedintImS32;// 32-bit signed integer == int
typedefunsignedintImU32;// 32-bit unsigned integer (often used to store packed colors)
#if defined(_MSC_VER) && !defined(__clang__)
@ -224,12 +228,12 @@ namespace ImGui
// Demo, Debug, Information
IMGUI_APIvoidShowDemoWindow(bool*p_open=NULL);// create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
IMGUI_APIvoidShowAboutWindow(bool*p_open=NULL);// create about window. display Dear ImGui version, credits and build/system information.
IMGUI_APIvoidShowStyleEditor(ImGuiStyle*ref=NULL);// add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
IMGUI_APIboolShowStyleSelector(constchar*label);// add style selector block (not a window), essentially a combo listing the default styles.
IMGUI_APIvoidShowFontSelector(constchar*label);// add font selector block (not a window), essentially a combo listing the loaded fonts.
IMGUI_APIvoidShowUserGuide();// add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
IMGUI_APIconstchar*GetVersion();// get the compiled version string e.g. "1.23"
IMGUI_APIconstchar*GetVersion();// get the compiled version string e.g. "1.23" (essentially the compiled value for IMGUI_VERSION)
IMGUI_APIboolSmallButton(constchar*label);// button with FramePadding=(0,0) to easily embed within text
IMGUI_APIboolInvisibleButton(constchar*str_id,constImVec2&size);// button behavior without the visuals, useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
IMGUI_APIboolInvisibleButton(constchar*str_id,constImVec2&size);// button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
IMGUI_APIboolArrowButton(constchar*str_id,ImGuiDirdir);// square button with an arrow shape
IMGUI_APIboolImageButton(ImTextureIDuser_texture_id,constImVec2&size,constImVec2&uv0=ImVec2(0,0),constImVec2&uv1=ImVec2(1,1),intframe_padding=-1,constImVec4&bg_col=ImVec4(0,0,0,0),constImVec4&tint_col=ImVec4(1,1,1,1));// <0 frame_padding uses default frame padding settings. 0 for no padding
@ -607,7 +611,7 @@ namespace ImGui
// Drag and Drop
// [BETA API] API may evolve!
IMGUI_APIboolBeginDragDropSource(ImGuiDragDropFlagsflags=0);// call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
IMGUI_APIboolSetDragDropPayload(constchar*type,constvoid*data,size_tsize,ImGuiCondcond=0);// type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
IMGUI_APIboolSetDragDropPayload(constchar*type,constvoid*data,size_tsz,ImGuiCondcond=0);// type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
IMGUI_APIvoidEndDragDropSource();// only call EndDragDropSource() if BeginDragDropSource() returns true!
IMGUI_APIboolBeginDragDropTarget();// call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
IMGUI_APIconstImGuiPayload*AcceptDragDropPayload(constchar*type,ImGuiDragDropFlagsflags=0);// accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
@ -635,9 +639,9 @@ namespace ImGui
IMGUI_APIboolIsItemActivated();// was the last item just made active (item was previously inactive).
IMGUI_APIboolIsItemDeactivated();// was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing.
IMGUI_APIboolIsItemDeactivatedAfterEdit();// was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).
IMGUI_APIboolIsAnyItemHovered();
IMGUI_APIboolIsAnyItemActive();
IMGUI_APIboolIsAnyItemFocused();
IMGUI_APIboolIsAnyItemHovered();// is any item hovered?
IMGUI_APIboolIsAnyItemActive();// is any item active?
IMGUI_APIboolIsAnyItemFocused();// is any item focused?
IMGUI_APIImVec2GetItemRectMin();// get upper-left bounding rectangle of the last item (screen space)
IMGUI_APIImVec2GetItemRectMax();// get lower-right bounding rectangle of the last item (screen space)
IMGUI_APIImVec2GetItemRectSize();// get size of last item
@ -651,7 +655,7 @@ namespace ImGui
IMGUI_APIImDrawList*GetOverlayDrawList();// get overlay draw list for the viewport associated to the current window. this draw list will be the last rendered. useful to quickly draw overlays shapes/text.
IMGUI_APIImDrawList*GetOverlayDrawList(ImGuiViewport*viewport);// get overlay draw list for the given viewport.
IMGUI_APIImDrawListSharedData*GetDrawListSharedData();// you may use this when creating your own ImDrawList instances
IMGUI_APIconstchar*GetStyleColorName(ImGuiColidx);// get a string corresponding to the enum value (for display, saving, etc.).
IMGUI_APIvoidSetStateStorage(ImGuiStorage*storage);// replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
IMGUI_APIboolIsMouseReleased(intbutton);// did mouse button released (went from Down to !Down)
IMGUI_APIboolIsMouseDragging(intbutton=0,floatlock_threshold=-1.0f);// is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold
IMGUI_APIboolIsMouseHoveringRect(constImVec2&r_min,constImVec2&r_max,boolclip=true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
IMGUI_APIboolIsMousePosValid(constImVec2*mouse_pos=NULL);// by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse
IMGUI_APIImVec2GetMousePos();// shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
IMGUI_APIImVec2GetMousePosOnOpeningCurrentPopup();// retrieve backup of mouse position at the time of opening popup we have BeginPopup() into
IMGUI_APIImVec2GetMouseDragDelta(intbutton=0,floatlock_threshold=-1.0f);// return the delta from the initial clicking position. This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lock_threshold < -1.0f uses io.MouseDraggingThreshold
@ -697,12 +701,12 @@ namespace ImGui
// - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.
IMGUI_APIvoidLoadIniSettingsFromDisk(constchar*ini_filename);// call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename).
IMGUI_APIvoidLoadIniSettingsFromMemory(constchar*ini_data,size_tini_size=0);// call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source.
IMGUI_APIvoidSaveIniSettingsToDisk(constchar*ini_filename);// this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext).
IMGUI_APIconstchar*SaveIniSettingsToMemory(size_t*out_ini_size=NULL);// return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings.
// Memory Utilities
// Memory Allocators
// - All those functions are not reliant on the current context.
// - If you reload the contents of imgui.cpp at runtime, you may need to call SetCurrentContext() + SetAllocatorFunctions() again.
// - If you reload the contents of imgui.cpp at runtime, you may need to call SetCurrentContext() + SetAllocatorFunctions() again because we use global storage for those.
ImGuiInputTextFlags_CharsUppercase=1<<2,// Turn a..z into A..Z
ImGuiInputTextFlags_CharsNoBlank=1<<3,// Filter out spaces, tabs
ImGuiInputTextFlags_AutoSelectAll=1<<4,// Select entire text when first taking mouse focus
ImGuiInputTextFlags_EnterReturnsTrue=1<<5,// Return 'true' when Enter is pressed (as opposed to when the value was modified)
ImGuiInputTextFlags_EnterReturnsTrue=1<<5,// Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function.
ImGuiInputTextFlags_CallbackCompletion=1<<6,// Callback on pressing TAB (for completion handling)
ImGuiInputTextFlags_CallbackHistory=1<<7,// Callback on pressing Up/Down arrows (for history handling)
ImGuiInputTextFlags_CallbackAlways=1<<8,// Callback on each iteration. User code may query cursor position, modify text buffer.
@ -937,10 +941,14 @@ enum ImGuiDragDropFlags_
// A primary data type
enumImGuiDataType_
{
ImGuiDataType_S8,// char
ImGuiDataType_U8,// unsigned char
ImGuiDataType_S16,// short
ImGuiDataType_U16,// unsigned short
ImGuiDataType_S32,// int
ImGuiDataType_U32,// unsigned int
ImGuiDataType_S64,// long long, __int64
ImGuiDataType_U64,// unsigned long long, unsigned __int64
ImGuiDataType_S64,// long long / __int64
ImGuiDataType_U64,// unsigned long long / unsigned __int64
ImGuiDataType_Float,// float
ImGuiDataType_Double,// double
ImGuiDataType_COUNT
@ -1128,7 +1136,7 @@ enum ImGuiCol_
// NB: if changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type.
enumImGuiStyleVar_
{
// Enum name ......................// Member in ImGuiStyle structure (see ImGuiStyle for descriptions)
// Enum name --------------------- // Member in ImGuiStyle structure (see ImGuiStyle for descriptions)
ImGuiColorEditFlags_NoAlpha=1<<1,// // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read 3 components from the input pointer).
ImGuiColorEditFlags_NoAlpha=1<<1,// // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer).
ImGuiColorEditFlags_NoPicker=1<<2,// // ColorEdit: disable picker when clicking on colored square.
ImGuiColorEditFlags_NoOptions=1<<3,// // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.
ImGuiColorEditFlags_NoSmallPreview=1<<4,// // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs)
@ -1174,24 +1182,30 @@ enum ImGuiColorEditFlags_
ImGuiColorEditFlags_NoSidePreview=1<<8,// // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead.
ImGuiColorEditFlags_NoDragDrop=1<<9,// // ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.
// User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user choose and/or call SetColorEditOptions() during startup.
// User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions().
// The intent is that you probably don't want to override them in most of your calls, let the user choose via the option menu and/or call SetColorEditOptions() during startup.
ImGuiColorEditFlags_AlphaBar=1<<16,// // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.
ImGuiColorEditFlags_AlphaPreview=1<<17,// // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.
ImGuiColorEditFlags_HDR=1<<19,// // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).
ImGuiColorEditFlags_RGB=1<<20,// [Inputs] // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX.
ImGuiColorEditFlags_HSV=1<<21,// [Inputs] // "
ImGuiColorEditFlags_HEX =1<<22,// [Inputs] // "
ImGuiColorEditFlags_DisplayRGB =1<<20,// [Display] // ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex.
ImGuiColorEditFlags_Float=1<<24,// [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.
ImGuiColorEditFlags_PickerHueBar=1<<25,// [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value.
ImGuiColorEditFlags_PickerHueWheel=1<<26,// [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value.
ImGui::SameLine();ShowHelpMarker("ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, but the user can change it with a right-click.\n\nColorPicker defaults to displaying RGB+HSV+Hex if you don't specify a display mode.\n\nYou can change the defaults using SetColorEditOptions().");
ImGui::Combo("Picker Mode",&picker_mode,"Auto/Current\0Hue bar + SV rect\0Hue wheel + SV triangle\0");
ImGui::SameLine();ShowHelpMarker("User can right-click the picker to change mode.");
ImGuiColorEditFlagsflags=misc_flags;
if(!alpha)flags|=ImGuiColorEditFlags_NoAlpha;// This is by default if you call ColorPicker3() instead of ColorPicker4()
ImGui::SameLine();ShowHelpMarker("SetColorEditOptions() is designed to allow you to set boot-time default.\nWe don't have Push/Pop functions because you can force options on a per-widget basis if needed, and the user can change non-forced ones with the options menu.\nWe don't have a getter to avoid encouraging you to persistently save values that aren't forward-compatible.");
ImGui::Checkbox("Clamp integers to 0..50",&drag_clamp);ImGui::SameLine();ShowHelpMarker("As with every widgets in dear imgui, we never modify values unless there is a user interaction.\nYou can override the clamping limits by using CTRL+Click to input a value.");
staticinlinefloatImFloorStd(floatx){returnfloorf(x);}// we already uses our own ImFloor() { return (float)(int)v } internally so the standard one wrapper is named differently (it's used by stb_truetype)
staticinlinefloatImCeil(floatx){returnceilf(x);}
#endif
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support for variety of types: signed/unsigned int/long long float/double, using templates here but we could also redefine them 6 times
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support for variety of types: signed/unsigned int/long long float/double
// (Exceptionally using templates here but we could also redefine them for variety of types)
// FIXME: We don't bother handling support for legacy operators since they are a little too crappy. Instead we may implement a proper expression evaluator in the future.
sscanf(buf,format,data_ptr);
}
elseif(data_type==ImGuiDataType_Float)
{
// For floats we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in
// We don't bother handling support for legacy operators since they are a little too crappy. Instead we will later implement a proper expression evaluator in the future.
sscanf(buf,format,data_ptr);
}
else
{
// Small types need a 32-bit buffer to receive the result from scanf()