imgui.h (imgui-1.86) | : | imgui.h (imgui-1.87) | ||
---|---|---|---|---|
// dear imgui, v1.86 | // dear imgui, v1.87 | |||
// (headers) | // (headers) | |||
// Help: | // Help: | |||
// - Read FAQ at http://dearimgui.org/faq | // - Read FAQ at http://dearimgui.org/faq | |||
// - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup D ear ImGui in your codebase. | // - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup D ear ImGui in your codebase. | |||
// - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications i n examples/ are doing that. | // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications i n examples/ are doing that. | |||
// Read imgui.cpp for details, links and comments. | // Read imgui.cpp for details, links and comments. | |||
// Resources: | // Resources: | |||
// - FAQ http://dearimgui.org/faq | // - FAQ http://dearimgui.org/faq | |||
skipping to change at line 38 | skipping to change at line 38 | |||
// [SECTION] Dear ImGui end-user API functions | // [SECTION] Dear ImGui end-user API functions | |||
// [SECTION] Flags & Enumerations | // [SECTION] Flags & Enumerations | |||
// [SECTION] Helpers: Memory allocations macros, ImVector<> | // [SECTION] Helpers: Memory allocations macros, ImVector<> | |||
// [SECTION] ImGuiStyle | // [SECTION] ImGuiStyle | |||
// [SECTION] ImGuiIO | // [SECTION] ImGuiIO | |||
// [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallback Data, ImGuiPayload, ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs) | // [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallback Data, ImGuiPayload, ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs) | |||
// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImG uiStorage, ImGuiListClipper, ImColor) | // [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImG uiStorage, ImGuiListClipper, ImColor) | |||
// [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDr awChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList, ImDrawD ata) | // [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDr awChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList, ImDrawD ata) | |||
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFo ntAtlasFlags, ImFontAtlas, ImFont) | // [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFo ntAtlasFlags, ImFontAtlas, ImFont) | |||
// [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport) | // [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport) | |||
// [SECTION] Platform Dependent Interfaces (ImGuiPlatformImeData) | ||||
// [SECTION] Obsolete functions and types | // [SECTION] Obsolete functions and types | |||
*/ | */ | |||
#pragma once | #pragma once | |||
// Configuration file with compile-time options (edit imconfig.h or '#define IMG UI_USER_CONFIG "myfilename.h" from your build system') | // Configuration file with compile-time options (edit imconfig.h or '#define IMG UI_USER_CONFIG "myfilename.h" from your build system') | |||
#ifdef IMGUI_USER_CONFIG | #ifdef IMGUI_USER_CONFIG | |||
#include IMGUI_USER_CONFIG | #include IMGUI_USER_CONFIG | |||
#endif | #endif | |||
skipping to change at line 66 | skipping to change at line 67 | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// Includes | // Includes | |||
#include <float.h> // FLT_MIN, FLT_MAX | #include <float.h> // FLT_MIN, FLT_MAX | |||
#include <stdarg.h> // va_list, va_start, va_end | #include <stdarg.h> // va_list, va_start, va_end | |||
#include <stddef.h> // ptrdiff_t, NULL | #include <stddef.h> // ptrdiff_t, NULL | |||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp | #include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp | |||
// Version | // Version | |||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in p rogress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. w hen release tagging happens) | // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in p rogress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. w hen release tagging happens) | |||
#define IMGUI_VERSION "1.86" | #define IMGUI_VERSION "1.87" | |||
#define IMGUI_VERSION_NUM 18600 | #define IMGUI_VERSION_NUM 18700 | |||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_ VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), si zeof(ImDrawVert), sizeof(ImDrawIdx)) | #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_ VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), si zeof(ImDrawVert), sizeof(ImDrawIdx)) | |||
#define IMGUI_HAS_TABLE | #define IMGUI_HAS_TABLE | |||
// Define attributes of all API symbols declarations (e.g. for DLL under Windows ) | // Define attributes of all API symbols declarations (e.g. for DLL under Windows ) | |||
// IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the de fault backends files (imgui_impl_xxx.h) | // IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the de fault backends files (imgui_impl_xxx.h) | |||
// Using dear imgui via a shared library is not recommended, because we don't gu arantee backward nor forward ABI compatibility (also function call overhead, as dear imgui is a call-heavy API) | // Using dear imgui via a shared library is not recommended, because we don't gu arantee backward nor forward ABI compatibility (also function call overhead, as dear imgui is a call-heavy API) | |||
#ifndef IMGUI_API | #ifndef IMGUI_API | |||
#define IMGUI_API | #define IMGUI_API | |||
#endif | #endif | |||
#ifndef IMGUI_IMPL_API | #ifndef IMGUI_IMPL_API | |||
#define IMGUI_IMPL_API IMGUI_API | #define IMGUI_IMPL_API IMGUI_API | |||
#endif | #endif | |||
// Helper Macros | // Helper Macros | |||
#ifndef IM_ASSERT | #ifndef IM_ASSERT | |||
#include <assert.h> | #include <assert.h> | |||
#define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h | #define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h | |||
#endif | #endif | |||
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers! | #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers! | |||
#define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be st ripped out from final builds. | #define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be st ripped out from final builds. | |||
#if (__cplusplus >= 201100) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201100) | ||||
#define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11 | #define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11 | |||
#else | ||||
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) | ||||
// Offset of _MEMBER within _TYPE. Old style macro. | ||||
#endif | ||||
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our fo rmatting functions. | // Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our fo rmatting functions. | |||
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang_ _) | #if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang_ _) | |||
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1 ))) | #define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1 ))) | |||
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0))) | #define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0))) | |||
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__ )) | #elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__ )) | |||
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) | #define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) | |||
#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0))) | #define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0))) | |||
#else | #else | |||
#define IM_FMTARGS(FMT) | #define IM_FMTARGS(FMT) | |||
#define IM_FMTLIST(FMT) | #define IM_FMTLIST(FMT) | |||
#endif | #endif | |||
// Disable some of MSVC most aggressive Debug runtime checks in function header/ footer (used in some simple/low-level functions) | // Disable some of MSVC most aggressive Debug runtime checks in function header/ footer (used in some simple/low-level functions) | |||
#if defined(_MSC_VER) && !defined(__clang__) && !defined(IMGUI_DEBUG_PARANOID) | #if defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && ! defined(IMGUI_DEBUG_PARANOID) | |||
#define IM_MSVC_RUNTIME_CHECKS_OFF __pragma(runtime_checks("",off)) __p ragma(check_stack(off)) __pragma(strict_gs_check(push,off)) | #define IM_MSVC_RUNTIME_CHECKS_OFF __pragma(runtime_checks("",off)) __p ragma(check_stack(off)) __pragma(strict_gs_check(push,off)) | |||
#define IM_MSVC_RUNTIME_CHECKS_RESTORE __pragma(runtime_checks("",restore)) __p ragma(check_stack()) __pragma(strict_gs_check(pop)) | #define IM_MSVC_RUNTIME_CHECKS_RESTORE __pragma(runtime_checks("",restore)) __p ragma(check_stack()) __pragma(strict_gs_check(pop)) | |||
#else | #else | |||
#define IM_MSVC_RUNTIME_CHECKS_OFF | #define IM_MSVC_RUNTIME_CHECKS_OFF | |||
#define IM_MSVC_RUNTIME_CHECKS_RESTORE | #define IM_MSVC_RUNTIME_CHECKS_RESTORE | |||
#endif | #endif | |||
// Warnings | // Warnings | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#pragma warning (push) | #pragma warning (push) | |||
skipping to change at line 154 | skipping to change at line 151 | |||
struct ImFont; // Runtime data for a single font within a p arent ImFontAtlas | struct ImFont; // Runtime data for a single font within a p arent ImFontAtlas | |||
struct ImFontAtlas; // Runtime data for multiple fonts, bake mul tiple fonts into a single texture, TTF/OTF font loader | struct ImFontAtlas; // Runtime data for multiple fonts, bake mul tiple fonts into a single texture, TTF/OTF font loader | |||
struct ImFontBuilderIO; // Opaque interface to a font builder (stb_t ruetype or FreeType). | struct ImFontBuilderIO; // Opaque interface to a font builder (stb_t ruetype or FreeType). | |||
struct ImFontConfig; // Configuration data when adding a font or merging fonts | struct ImFontConfig; // Configuration data when adding a font or merging fonts | |||
struct ImFontGlyph; // A single font glyph (code point + coordin ates within in ImFontAtlas + offset) | struct ImFontGlyph; // A single font glyph (code point + coordin ates within in ImFontAtlas + offset) | |||
struct ImFontGlyphRangesBuilder; // Helper to build glyph ranges from text/st ring data | struct ImFontGlyphRangesBuilder; // Helper to build glyph ranges from text/st ring data | |||
struct ImColor; // Helper functions to create a color that c an be converted to either u32 or float4 (*OBSOLETE* please avoid using) | struct ImColor; // Helper functions to create a color that c an be converted to either u32 or float4 (*OBSOLETE* please avoid using) | |||
struct ImGuiContext; // Dear ImGui context (opaque structure, unl ess including imgui_internal.h) | struct ImGuiContext; // Dear ImGui context (opaque structure, unl ess including imgui_internal.h) | |||
struct ImGuiIO; // Main configuration and I/O between your a pplication and ImGui | struct ImGuiIO; // Main configuration and I/O between your a pplication and ImGui | |||
struct ImGuiInputTextCallbackData; // Shared state of InputText() when using cu stom ImGuiInputTextCallback (rare/advanced use) | struct ImGuiInputTextCallbackData; // Shared state of InputText() when using cu stom ImGuiInputTextCallback (rare/advanced use) | |||
struct ImGuiKeyData; // Storage for ImGuiIO and IsKeyDown(), IsKe yPressed() etc functions. | ||||
struct ImGuiListClipper; // Helper to manually clip large list of ite ms | struct ImGuiListClipper; // Helper to manually clip large list of ite ms | |||
struct ImGuiOnceUponAFrame; // Helper for running a block of code not mo re than once a frame | struct ImGuiOnceUponAFrame; // Helper for running a block of code not mo re than once a frame | |||
struct ImGuiPayload; // User data payload for drag and drop opera tions | struct ImGuiPayload; // User data payload for drag and drop opera tions | |||
struct ImGuiPlatformImeData; // Platform IME data for io.SetPlatformImeDa taFn() function. | ||||
struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSiz eConstraints() (rare/advanced use) | struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSiz eConstraints() (rare/advanced use) | |||
struct ImGuiStorage; // Helper for key->value storage | struct ImGuiStorage; // Helper for key->value storage | |||
struct ImGuiStyle; // Runtime data for styling/colors | struct ImGuiStyle; // Runtime data for styling/colors | |||
struct ImGuiTableSortSpecs; // Sorting specifications for a table (often handling sort specs for a single column, occasionally more) | struct ImGuiTableSortSpecs; // Sorting specifications for a table (often handling sort specs for a single column, occasionally more) | |||
struct ImGuiTableColumnSortSpecs; // Sorting specification for one column of a table | struct ImGuiTableColumnSortSpecs; // Sorting specification for one column of a table | |||
struct ImGuiTextBuffer; // Helper to hold and append into a text buf fer (~string builder) | struct ImGuiTextBuffer; // Helper to hold and append into a text buf fer (~string builder) | |||
struct ImGuiTextFilter; // Helper to parse and apply text filters (e .g. "aaaaa[,bbbbb][,ccccc]") | struct ImGuiTextFilter; // Helper to parse and apply text filters (e .g. "aaaaa[,bbbbb][,ccccc]") | |||
struct ImGuiViewport; // A Platform Window (always only one in 'ma ster' branch), in the future may represent Platform Monitor | struct ImGuiViewport; // A Platform Window (always only one in 'ma ster' branch), in the future may represent Platform Monitor | |||
// Enums/Flags (declared as int for compatibility with old C++, to allow using a s flags without overhead, and to not pollute the top of this file) | // Enums/Flags (declared as int for compatibility with old C++, to allow using a s flags without overhead, and to not pollute the top of this file) | |||
// - Tip: Use your programming IDE navigation facilities on the names in the _ce ntral column_ below to find the actual flags/enum lists! | // - Tip: Use your programming IDE navigation facilities on the names in the _ce ntral column_ below to find the actual flags/enum lists! | |||
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. | // In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. | |||
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can als o follow symbols in comments. | // With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can als o follow symbols in comments. | |||
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling | typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling | |||
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions | typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions | |||
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type | typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type | |||
typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction | typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction | |||
typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier (ImGui-side enum) | typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier | |||
typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation | typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation | |||
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle) | typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle) | |||
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier | typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier | |||
typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending) | typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending) | |||
typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling | typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling | |||
typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor() | typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor() | |||
typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: f or ImDrawList functions | typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: f or ImDrawList functions | |||
typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: f or ImDrawList instance | typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: f or ImDrawList instance | |||
typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: f or ImFontAtlas build | typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: f or ImFontAtlas build | |||
typedef int ImGuiBackendFlags; // -> enum ImGuiBackendFlags_ // Flags: f or io.BackendFlags | typedef int ImGuiBackendFlags; // -> enum ImGuiBackendFlags_ // Flags: f or io.BackendFlags | |||
skipping to change at line 228 | skipping to change at line 227 | |||
#endif | #endif | |||
// Scalar data types | // Scalar data types | |||
typedef unsigned int ImGuiID;// A unique ID used by widgets (typically th e result of hashing a stack of string) | typedef unsigned int ImGuiID;// A unique ID used by widgets (typically th e result of hashing a stack of string) | |||
typedef signed char ImS8; // 8-bit signed integer | typedef signed char ImS8; // 8-bit signed integer | |||
typedef unsigned char ImU8; // 8-bit unsigned integer | typedef unsigned char ImU8; // 8-bit unsigned integer | |||
typedef signed short ImS16; // 16-bit signed integer | typedef signed short ImS16; // 16-bit signed integer | |||
typedef unsigned short ImU16; // 16-bit unsigned integer | typedef unsigned short ImU16; // 16-bit unsigned integer | |||
typedef signed int ImS32; // 32-bit signed integer == int | typedef signed int ImS32; // 32-bit signed integer == int | |||
typedef unsigned int ImU32; // 32-bit unsigned integer (often used to st ore packed colors) | typedef unsigned int ImU32; // 32-bit unsigned integer (often used to st ore packed colors) | |||
#if defined(_MSC_VER) && !defined(__clang__) | typedef signed long long ImS64; // 64-bit signed integer | |||
typedef signed __int64 ImS64; // 64-bit signed integer (pre and post C++11 | typedef unsigned long long ImU64; // 64-bit unsigned integer | |||
with Visual Studio) | ||||
typedef unsigned __int64 ImU64; // 64-bit unsigned integer (pre and post C++ | ||||
11 with Visual Studio) | ||||
#elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100) | ||||
#include <stdint.h> | ||||
typedef int64_t ImS64; // 64-bit signed integer (pre C++11) | ||||
typedef uint64_t ImU64; // 64-bit unsigned integer (pre C++11) | ||||
#else | ||||
typedef signed long long ImS64; // 64-bit signed integer (post C++11) | ||||
typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11) | ||||
#endif | ||||
// Character types | // Character types | |||
// (we generally use UTF-8 encoded string in the API. This is storage specifical ly for a decoded character used for keyboard input and display) | // (we generally use UTF-8 encoded string in the API. This is storage specifical ly for a decoded character used for keyboard input and display) | |||
typedef unsigned short ImWchar16; // A single decoded U16 character/code point . We encode them as multi bytes UTF-8 when used in strings. | typedef unsigned short ImWchar16; // A single decoded U16 character/code point . We encode them as multi bytes UTF-8 when used in strings. | |||
typedef unsigned int ImWchar32; // A single decoded U32 character/code point . We encode them as multi bytes UTF-8 when used in strings. | typedef unsigned int ImWchar32; // A single decoded U32 character/code point . We encode them as multi bytes UTF-8 when used in strings. | |||
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in i mconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16] | #ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in i mconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16] | |||
typedef ImWchar32 ImWchar; | typedef ImWchar32 ImWchar; | |||
#else | #else | |||
typedef ImWchar16 ImWchar; | typedef ImWchar16 ImWchar; | |||
#endif | #endif | |||
skipping to change at line 527 | skipping to change at line 517 | |||
// - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. | // - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. | |||
// - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are cre ated. | // - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are cre ated. | |||
IMGUI_API bool BeginCombo(const char* label, const char* preview_va lue, ImGuiComboFlags flags = 0); | IMGUI_API bool BeginCombo(const char* label, const char* preview_va lue, ImGuiComboFlags flags = 0); | |||
IMGUI_API void EndCombo(); // only call EndCombo() if BeginCombo() returns true! | IMGUI_API void EndCombo(); // only call EndCombo() if BeginCombo() returns true! | |||
IMGUI_API bool Combo(const char* label, int* current_item, const ch ar* const items[], int items_count, int popup_max_height_in_items = -1); | IMGUI_API bool Combo(const char* label, int* current_item, const ch ar* const items[], int items_count, int popup_max_height_in_items = -1); | |||
IMGUI_API bool Combo(const char* label, int* current_item, const ch ar* items_separated_by_zeros, int popup_max_height_in_items = -1); // Separ ate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Thre e\0" | IMGUI_API bool Combo(const char* label, int* current_item, const ch ar* items_separated_by_zeros, int popup_max_height_in_items = -1); // Separ ate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Thre e\0" | |||
IMGUI_API bool Combo(const char* label, int* current_item, bool(*it ems_getter)(void* data, int idx, const char** out_text), void* data, int items_c ount, int popup_max_height_in_items = -1); | IMGUI_API bool Combo(const char* label, int* current_item, bool(*it ems_getter)(void* data, int idx, const char** out_text), void* data, int items_c ount, int popup_max_height_in_items = -1); | |||
// Widgets: Drag Sliders | // Widgets: Drag Sliders | |||
// - CTRL+Click on any drag box to turn them into an input box. Manually inp ut values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_ AlwaysClamp to always clamp. | // - CTRL+Click on any drag box to turn them into an input box. Manually inp ut values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_ AlwaysClamp to always clamp. | |||
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every funct | // - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every funct | |||
ions, note that a 'float v[X]' function argument is the same as 'float* v', the | ions, note that a 'float v[X]' function argument is the same as 'float* v', | |||
array syntax is just a way to document the number of elements that are expected | // the array syntax is just a way to document the number of elements that | |||
to be accessible. You can pass address of your first element out of a contiguous | are expected to be accessible. You can pass address of your first element out of | |||
set, e.g. &myvector.x | a contiguous set, e.g. &myvector.x | |||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01 .23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. | // - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01 .23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. | |||
// - Format string may also be set to NULL or use the default format ("%f" o r "%d"). | // - Format string may also be set to NULL or use the default format ("%f" o r "%d"). | |||
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to mov e by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision). | // - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to mov e by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision). | |||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not us ed. | // - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not us ed. | |||
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum. | // - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum. | |||
// - We use the same sets of flags for DragXXX() and SliderXXX() functions a s the features are the same and it makes it easier to swap them. | // - We use the same sets of flags for DragXXX() and SliderXXX() functions a s the features are the same and it makes it easier to swap them. | |||
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a f inal `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argum ent. | // - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a f inal `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argum ent. | |||
// If you get a warning converting a float to ImGuiSliderFlags, read https ://github.com/ocornut/imgui/issues/3361 | // If you get a warning converting a float to ImGuiSliderFlags, read https ://github.com/ocornut/imgui/issues/3361 | |||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", Im GuiSliderFlags flags = 0); // If v_min >= v_max we have no bound | IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", Im GuiSliderFlags flags = 0); // If v_min >= v_max we have no bound | |||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_sp eed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); | IMGUI_API bool DragFloat2(const char* label, float v[2], float v_sp eed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); | |||
skipping to change at line 693 | skipping to change at line 684 | |||
IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NUL L, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it. | IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NUL L, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it. | |||
IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() retur ns true! | IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() retur ns true! | |||
// Popups: open/close functions | // Popups: open/close functions | |||
// - OpenPopup(): set popup state to open. ImGuiPopupFlags are available fo r opening options. | // - OpenPopup(): set popup state to open. ImGuiPopupFlags are available fo r opening options. | |||
// - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. | // - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. | |||
// - CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to c lose manually. | // - CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to c lose manually. | |||
// - CloseCurrentPopup() is called by default by Selectable()/MenuItem() wh en activated (FIXME: need some options). | // - CloseCurrentPopup() is called by default by Selectable()/MenuItem() wh en activated (FIXME: need some options). | |||
// - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup i f there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup(). | // - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup i f there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup(). | |||
// - Use IsWindowAppearing() after BeginPopup() to tell if a window just op ened. | // - Use IsWindowAppearing() after BeginPopup() to tell if a window just op ened. | |||
// - IMPORTANT: Notice that for OpenPopupOnItemClick() we exceptionally def ault flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter | ||||
IMGUI_API void OpenPopup(const char* str_id, ImGuiPopupFlags popup_ flags = 0); // call to mark popup as open (don't call every frame!). | IMGUI_API void OpenPopup(const char* str_id, ImGuiPopupFlags popup_ flags = 0); // call to mark popup as open (don't call every frame!). | |||
IMGUI_API void OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags = 0); // id overload to facilitate calling from nested stacks | IMGUI_API void OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags = 0); // id overload to facilitate calling from nested stacks | |||
IMGUI_API void OpenPopupOnItemClick(const char* str_id = NULL, ImGu iPopupFlags popup_flags = 1); // helper to open popup when clicked on last ite m. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) | IMGUI_API void OpenPopupOnItemClick(const char* str_id = NULL, ImGu iPopupFlags popup_flags = 1); // helper to open popup when clicked on last ite m. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) | |||
IMGUI_API void CloseCurrentPopup(); // manually close the popup we have begin-ed int o. | IMGUI_API void CloseCurrentPopup(); // manually close the popup we have begin-ed int o. | |||
// Popups: open+begin combined functions helpers | // Popups: open+begin combined functions helpers | |||
// - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking. | // - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking. | |||
// - They are convenient to easily create context menus, hence the name. | // - They are convenient to easily create context menus, hence the name. | |||
// - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGu iWindowFlags to the BeginPopupContextXXX functions in the future. | // - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGu iWindowFlags to the BeginPopupContextXXX functions in the future. | |||
// - IMPORTANT: we exceptionally default their flags to 1 (== ImGuiPopupFla gs_MouseButtonRight) for backward compatibility with older API taking 'int mouse _button = 1' parameter, so if you add other flags remember to re-add the ImGuiPo pupFlags_MouseButtonRight. | // - IMPORTANT: Notice that we exceptionally default their flags to 1 (== I mGuiPopupFlags_MouseButtonRight) for backward compatibility with older API takin g 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight. | |||
IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, ImG uiPopupFlags popup_flags = 1); // open+begin popup when clicked on last item. U se str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID her e. read comments in .cpp! | IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, ImG uiPopupFlags popup_flags = 1); // open+begin popup when clicked on last item. U se str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID her e. read comments in .cpp! | |||
IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, I mGuiPopupFlags popup_flags = 1);// open+begin popup when clicked on current wind ow. | IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, I mGuiPopupFlags popup_flags = 1);// open+begin popup when clicked on current wind ow. | |||
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, ImG uiPopupFlags popup_flags = 1); // open+begin popup when clicked in void (where there are no windows). | IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, ImG uiPopupFlags popup_flags = 1); // open+begin popup when clicked in void (where there are no windows). | |||
// Popups: query functions | // Popups: query functions | |||
// - IsPopupOpen(): return true if the popup is open at the current BeginPo pup() level of the popup stack. | // - IsPopupOpen(): return true if the popup is open at the current BeginPo pup() level of the popup stack. | |||
// - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popu p is open at the current BeginPopup() level of the popup stack. | // - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popu p is open at the current BeginPopup() level of the popup stack. | |||
// - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPop upLevel: return true if any popup is open. | // - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPop upLevel: return true if any popup is open. | |||
IMGUI_API bool IsPopupOpen(const char* str_id, ImGuiPopupFlags flag s = 0); // return true if the popup is open. | IMGUI_API bool IsPopupOpen(const char* str_id, ImGuiPopupFlags flag s = 0); // return true if the popup is open. | |||
// Tables | // Tables | |||
// [BETA API] API may evolve slightly! If you use this, please update to the next version when it comes out! | ||||
// - Full-featured replacement for old Columns API. | // - Full-featured replacement for old Columns API. | |||
// - See Demo->Tables for demo code. | // - See Demo->Tables for demo code. | |||
// - See top of imgui_tables.cpp for general commentary. | // - See top of imgui_tables.cpp for general commentary. | |||
// - See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags. | // - See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags. | |||
// The typical call flow is: | // The typical call flow is: | |||
// - 1. Call BeginTable(). | // - 1. Call BeginTable(). | |||
// - 2. Optionally call TableSetupColumn() to submit column name/flags/defau lts. | // - 2. Optionally call TableSetupColumn() to submit column name/flags/defau lts. | |||
// - 3. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows. | // - 3. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows. | |||
// - 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data. | // - 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data. | |||
// - 5. Populate contents: | // - 5. Populate contents: | |||
skipping to change at line 810 | skipping to change at line 801 | |||
IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard | IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard | |||
IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed) | IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed) | |||
IMGUI_API void LogTextV(const char* fmt, va_list args) IM_FMTLIST(1 ); | IMGUI_API void LogTextV(const char* fmt, va_list args) IM_FMTLIST(1 ); | |||
// Drag and Drop | // Drag and Drop | |||
// - On source items, call BeginDragDropSource(), if it returns true also ca ll SetDragDropPayload() + EndDragDropSource(). | // - On source items, call BeginDragDropSource(), if it returns true also ca ll SetDragDropPayload() + EndDragDropSource(). | |||
// - On target candidates, call BeginDragDropTarget(), if it returns true al so call AcceptDragDropPayload() + EndDragDropTarget(). | // - On target candidates, call BeginDragDropTarget(), if it returns true al so call AcceptDragDropPayload() + EndDragDropTarget(). | |||
// - If you stop calling BeginDragDropSource() the payload is preserved howe ver it won't have a preview tooltip (we currently display a fallback "..." toolt ip, see #1725) | // - If you stop calling BeginDragDropSource() the payload is preserved howe ver it won't have a preview tooltip (we currently display a fallback "..." toolt ip, see #1725) | |||
// - An item can be both drag source and drop target. | // - An item can be both drag source and drop target. | |||
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call after submitting an item which may b e dragged. when this return true, you can call SetDragDropPayload() + EndDragDro pSource() | IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call after submitting an item which may b e dragged. when this return true, you can call SetDragDropPayload() + EndDragDro pSource() | |||
IMGUI_API bool SetDragDropPayload(const char* type, const void* dat a, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal ty pes. Data is copied and held by imgui. | IMGUI_API bool SetDragDropPayload(const char* type, const void* dat a, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal ty pes. Data is copied and held by imgui. Return true when payload has been accepte d. | |||
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDra gDropSource() returns true! | IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDra gDropSource() returns true! | |||
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may re ceive a payload. If this returns true, you can call AcceptDragDropPayload() + En dDragDropTarget() | IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may re ceive a payload. If this returns true, you can call AcceptDragDropPayload() + En dDragDropTarget() | |||
IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGu iDragDropFlags flags = 0); // accept contents of a given type. If ImGui DragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before t he mouse button is released. | IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGu iDragDropFlags flags = 0); // accept contents of a given type. If ImGui DragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before t he mouse button is released. | |||
IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDra gDropTarget() returns true! | IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDra gDropTarget() returns true! | |||
IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload fr om anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the pay load type. | IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload fr om anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the pay load type. | |||
// Disabling [BETA API] | // Disabling [BETA API] | |||
// - Disable all user interactions and dim items visuals (applying style.Dis abledAlpha over current colors) | // - Disable all user interactions and dim items visuals (applying style.Dis abledAlpha over current colors) | |||
// - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled) | // - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled) | |||
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(F alse)/EndDisabled() best to avoid it. | // - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(F alse)/EndDisabled() best to avoid it. | |||
skipping to change at line 885 | skipping to change at line 876 | |||
// Text Utilities | // Text Utilities | |||
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); | IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); | |||
// Color Utilities | // Color Utilities | |||
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in); | IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in); | |||
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in); | IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in); | |||
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, floa t& out_h, float& out_s, float& out_v); | IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, floa t& out_h, float& out_s, float& out_v); | |||
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, floa t& out_r, float& out_g, float& out_b); | IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, floa t& out_r, float& out_g, float& out_b); | |||
// Inputs Utilities: Keyboard | // Inputs Utilities: Keyboard | |||
// - For 'int user_key_index' you can use your own indices/enums according t | // Without IMGUI_DISABLE_OBSOLETE_KEYIO: (legacy support) | |||
o how your backend/engine stored them in io.KeysDown[]. | // - For 'ImGuiKey key' you can still use your legacy native/user indices | |||
// - We don't know the meaning of those value. You can use GetKeyIndex() to | according to how your backend/engine stored them in io.KeysDown[]. | |||
map a ImGuiKey_ value into the user index. | // With IMGUI_DISABLE_OBSOLETE_KEYIO: (this is the way forward) | |||
IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); | // - Any use of 'ImGuiKey' will assert when key < 512 will be passed, prev | |||
// map ImGuiKey_* values into user's key index. == io.KeyMap[key | iously reserved as native/user keys indices | |||
] | // - GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI | |||
IMGUI_API bool IsKeyDown(int user_key_index); | _DISABLE_OBSOLETE_KEYIO is defined) | |||
// is key being held. == io.KeysDown[user_key_index]. | IMGUI_API bool IsKeyDown(ImGuiKey key); | |||
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true) | // is key being held. | |||
; // was key pressed (went from !Down to Down)? if repeat=true, us | IMGUI_API bool IsKeyPressed(ImGuiKey key, bool repeat = true); | |||
es io.KeyRepeatDelay / KeyRepeatRate | // was key pressed (went from !Down to Down)? if repeat=true, us | |||
IMGUI_API bool IsKeyReleased(int user_key_index); | es io.KeyRepeatDelay / KeyRepeatRate | |||
// was key released (went from Down to !Down)? | IMGUI_API bool IsKeyReleased(ImGuiKey key); | |||
IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_dela | // was key released (went from Down to !Down)? | |||
y, float rate); // uses provided repeat rate/delay. return a count, most often 0 | IMGUI_API int GetKeyPressedAmount(ImGuiKey key, float repeat_delay | |||
or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate | , float rate); // uses provided repeat rate/delay. return a count, most often 0 | |||
or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate | ||||
IMGUI_API const char* GetKeyName(ImGuiKey key); | ||||
// [DEBUG] returns English name of the key. Those names a provid | ||||
ed for debugging purpose and are not meant to be saved persistently not compared | ||||
. | ||||
IMGUI_API void CaptureKeyboardFromApp(bool want_capture_keyboard_va lue = true); // attention: misleading name! manually override io.WantCaptureK eyboard flag next frame (said flag is entirely left for your application to hand le). e.g. force capture keyboard when your widget is being hovered. This is equi valent to setting "io.WantCaptureKeyboard = want_capture_keyboard_value"; after the next NewFrame() call. | IMGUI_API void CaptureKeyboardFromApp(bool want_capture_keyboard_va lue = true); // attention: misleading name! manually override io.WantCaptureK eyboard flag next frame (said flag is entirely left for your application to hand le). e.g. force capture keyboard when your widget is being hovered. This is equi valent to setting "io.WantCaptureKeyboard = want_capture_keyboard_value"; after the next NewFrame() call. | |||
// Inputs Utilities: Mouse | // Inputs Utilities: Mouse | |||
// - To refer to a mouse button, you may use named enums in your code e.g. I mGuiMouseButton_Left, ImGuiMouseButton_Right. | // - To refer to a mouse button, you may use named enums in your code e.g. I mGuiMouseButton_Left, ImGuiMouseButton_Right. | |||
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle. | // - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle. | |||
// - Dragging operations are only reported after mouse has moved a certain d istance away from the initial clicking position (see 'lock_threshold' and 'io.Mo useDraggingThreshold') | // - Dragging operations are only reported after mouse has moved a certain d istance away from the initial clicking position (see 'lock_threshold' and 'io.Mo useDraggingThreshold') | |||
IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held? | IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held? | |||
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down). Same as GetMouseClickedCount() == 1. | IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down). Same as GetMouseClickedCount() == 1. | |||
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down) | IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down) | |||
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? Same as GetMouseClickedCount () == 2. (note that a double-click will also report IsMouseClicked() == true) | IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? Same as GetMouseClickedCount () == 2. (note that a double-click will also report IsMouseClicked() == true) | |||
IMGUI_API int GetMouseClickedCount(ImGuiMouseButton button); // return the number of successive mouse-clicks at the time wher e a click happen (otherwise 0). | IMGUI_API int GetMouseClickedCount(ImGuiMouseButton button); // return the number of successive mouse-clicks at the time wher e a click happen (otherwise 0). | |||
IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec 2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consider ation of focus/window ordering/popup-block. | IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec 2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consider ation of focus/window ordering/popup-block. | |||
IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available | IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available | |||
IMGUI_API bool IsAnyMouseDown(); // is any mouse button held? | IMGUI_API bool IsAnyMouseDown(); // [WILL OBSOLETE] is any mouse button held? This was designed f or backends, but prefer having backend maintain a mask of held mouse buttons, be cause upcoming input queue system will make this invalid. | |||
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be c onsistent with other calls | IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be c onsistent with other calls | |||
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves) | IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves) | |||
IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_ threshold = -1.0f); // is mouse dragging? (if lock_threshold < -1.0f, us es io.MouseDraggingThreshold) | IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_ threshold = -1.0f); // is mouse dragging? (if lock_threshold < -1.0f, us es io.MouseDraggingThreshold) | |||
IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking positi on while the mouse button is pressed or was just released. This is locked and re turn 0.0f until the mouse moves past a distance threshold at least once (if lock _threshold < -1.0f, uses io.MouseDraggingThreshold) | IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking positi on while the mouse button is pressed or was just released. This is locked and re turn 0.0f until the mouse moves past a distance threshold at least once (if lock _threshold < -1.0f, uses io.MouseDraggingThreshold) | |||
IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); // | IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); // | |||
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering b y setting io.MouseDrawCursor ImGui will render those for you | IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering b y setting io.MouseDrawCursor ImGui will render those for you | |||
IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired cursor type | IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired cursor type | |||
IMGUI_API void CaptureMouseFromApp(bool want_capture_mouse_value = true); // attention: misleading name! manually override io.WantCaptureM ouse flag next frame (said flag is entirely left for your application to handle) . This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse_value; " after the next NewFrame() call. | IMGUI_API void CaptureMouseFromApp(bool want_capture_mouse_value = true); // attention: misleading name! manually override io.WantCaptureM ouse flag next frame (said flag is entirely left for your application to handle) . This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse_value; " after the next NewFrame() call. | |||
// Clipboard Utilities | // Clipboard Utilities | |||
skipping to change at line 983 | skipping to change at line 977 | |||
ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGu iWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollap se, | ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGu iWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollap se, | |||
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | I mGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, | ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | I mGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, | |||
// [Internal] | // [Internal] | |||
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] On child windo w: allow gamepad/keyboard navigation to cross over parent border to this child o r between sibling child windows. | ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] On child windo w: allow gamepad/keyboard navigation to cross over parent border to this child o r between sibling child windows. | |||
ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For intern al use by BeginChild() | ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For intern al use by BeginChild() | |||
ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For intern al use by BeginTooltip() | ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For intern al use by BeginTooltip() | |||
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For intern al use by BeginPopup() | ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For intern al use by BeginPopup() | |||
ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For intern al use by BeginPopupModal() | ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For intern al use by BeginPopupModal() | |||
ImGuiWindowFlags_ChildMenu = 1 << 28 // Don't use! For intern al use by BeginMenu() | ImGuiWindowFlags_ChildMenu = 1 << 28 // Don't use! For intern al use by BeginMenu() | |||
//ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // [Obsolete] --> Set io | ||||
// [Obsolete] | .ConfigWindowsResizeFromEdges=true and make sure mouse cursors are supported by | |||
//ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.ConfigWind | backend (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) | |||
owsResizeFromEdges=true and make sure mouse cursors are supported by backend (io | ||||
.BackendFlags & ImGuiBackendFlags_HasMouseCursors) | ||||
}; | }; | |||
// Flags for ImGui::InputText() | // Flags for ImGui::InputText() | |||
enum ImGuiInputTextFlags_ | enum ImGuiInputTextFlags_ | |||
{ | { | |||
ImGuiInputTextFlags_None = 0, | ImGuiInputTextFlags_None = 0, | |||
ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/ | ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/ | |||
ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDE Fabcdef | ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDE Fabcdef | |||
ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z | ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z | |||
ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, ta bs | ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, ta bs | |||
skipping to change at line 1120 | skipping to change at line 1112 | |||
ImGuiTabItemFlags_SetSelected = 1 << 1, // Trigger flag to programmatically make the tab selected when calling BeginTabItem() | ImGuiTabItemFlags_SetSelected = 1 << 1, // Trigger flag to programmatically make the tab selected when calling BeginTabItem() | |||
ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behav ior of closing tabs (that are submitted with p_open != NULL) with middle mouse b utton. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. | ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behav ior of closing tabs (that are submitted with p_open != NULL) with middle mouse b utton. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. | |||
ImGuiTabItemFlags_NoPushId = 1 << 3, // Don't call Pu shID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() | ImGuiTabItemFlags_NoPushId = 1 << 3, // Don't call Pu shID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() | |||
ImGuiTabItemFlags_NoTooltip = 1 << 4, // Disable toolt ip for the given tab | ImGuiTabItemFlags_NoTooltip = 1 << 4, // Disable toolt ip for the given tab | |||
ImGuiTabItemFlags_NoReorder = 1 << 5, // Disable reord ering this tab or having another tab cross over this tab | ImGuiTabItemFlags_NoReorder = 1 << 5, // Disable reord ering this tab or having another tab cross over this tab | |||
ImGuiTabItemFlags_Leading = 1 << 6, // Enforce the t ab position to the left of the tab bar (after the tab list popup button) | ImGuiTabItemFlags_Leading = 1 << 6, // Enforce the t ab position to the left of the tab bar (after the tab list popup button) | |||
ImGuiTabItemFlags_Trailing = 1 << 7 // Enforce the t ab position to the right of the tab bar (before the scrolling buttons) | ImGuiTabItemFlags_Trailing = 1 << 7 // Enforce the t ab position to the right of the tab bar (before the scrolling buttons) | |||
}; | }; | |||
// Flags for ImGui::BeginTable() | // Flags for ImGui::BeginTable() | |||
// [BETA API] API may evolve slightly! If you use this, please update to the nex | // - Important! Sizing policies have complex and subtle side effects, much more | |||
t version when it comes out! | so than you would expect. | |||
// - Important! Sizing policies have complex and subtle side effects, more so th | ||||
an you would expect. | ||||
// Read comments/demos carefully + experiment with live demos to get acquainte d with them. | // Read comments/demos carefully + experiment with live demos to get acquainte d with them. | |||
// - The DEFAULT sizing policies are: | // - The DEFAULT sizing policies are: | |||
// - Default to ImGuiTableFlags_SizingFixedFit if ScrollX is on, or if hos t window has ImGuiWindowFlags_AlwaysAutoResize. | // - Default to ImGuiTableFlags_SizingFixedFit if ScrollX is on, or if hos t window has ImGuiWindowFlags_AlwaysAutoResize. | |||
// - Default to ImGuiTableFlags_SizingStretchSame if ScrollX is off. | // - Default to ImGuiTableFlags_SizingStretchSame if ScrollX is off. | |||
// - When ScrollX is off: | // - When ScrollX is off: | |||
// - Table defaults to ImGuiTableFlags_SizingStretchSame -> all Columns defau lts to ImGuiTableColumnFlags_WidthStretch with same weight. | // - Table defaults to ImGuiTableFlags_SizingStretchSame -> all Columns defau lts to ImGuiTableColumnFlags_WidthStretch with same weight. | |||
// - Columns sizing policy allowed: Stretch (default), Fixed/Auto. | // - Columns sizing policy allowed: Stretch (default), Fixed/Auto. | |||
// - Fixed Columns will generally obtain their requested width (unless the ta | // - Fixed Columns (if any) will generally obtain their requested width (unle | |||
ble cannot fit them all). | ss the table cannot fit them all). | |||
// - Stretch Columns will share the remaining width. | // - Stretch Columns will share the remaining width according to their respec | |||
tive weight. | ||||
// - Mixed Fixed/Stretch columns is possible but has various side-effects on resizing behaviors. | // - Mixed Fixed/Stretch columns is possible but has various side-effects on resizing behaviors. | |||
// The typical use of mixing sizing policies is: any number of LEADING Fixe d columns, followed by one or two TRAILING Stretch columns. | // The typical use of mixing sizing policies is: any number of LEADING Fixe d columns, followed by one or two TRAILING Stretch columns. | |||
// (this is because the visible order of columns have subtle but necessary effects on how they react to manual resizing). | // (this is because the visible order of columns have subtle but necessary effects on how they react to manual resizing). | |||
// - When ScrollX is on: | // - When ScrollX is on: | |||
// - Table defaults to ImGuiTableFlags_SizingFixedFit -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed | // - Table defaults to ImGuiTableFlags_SizingFixedFit -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed | |||
// - Columns sizing policy allowed: Fixed/Auto mostly. | // - Columns sizing policy allowed: Fixed/Auto mostly. | |||
// - Fixed Columns can be enlarged as needed. Table will show an horizontal s crollbar if needed. | // - Fixed Columns can be enlarged as needed. Table will show an horizontal s crollbar if needed. | |||
// - When using auto-resizing (non-resizable) fixed columns, querying the con tent width to use item right-alignment e.g. SetNextItemWidth(-FLT_MIN) doesn't m ake sense, would create a feedback loop. | // - When using auto-resizing (non-resizable) fixed columns, querying the con tent width to use item right-alignment e.g. SetNextItemWidth(-FLT_MIN) doesn't m ake sense, would create a feedback loop. | |||
// - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable(). | // - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable(). | |||
// If you specify a value for 'inner_width' then effectively the scrolling space is known and Stretch or mixed Fixed/Stretch columns become meaningful agai n. | // If you specify a value for 'inner_width' then effectively the scrolling space is known and Stretch or mixed Fixed/Stretch columns become meaningful agai n. | |||
skipping to change at line 1244 | skipping to change at line 1235 | |||
// Obsolete names (will be removed soon) | // Obsolete names (will be removed soon) | |||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | |||
//ImGuiTableColumnFlags_WidthAuto = ImGuiTableColumnFlags_WidthFix ed | ImGuiTableColumnFlags_NoResize, // Column will not stretch and keep resizin g based on submitted contents. | //ImGuiTableColumnFlags_WidthAuto = ImGuiTableColumnFlags_WidthFix ed | ImGuiTableColumnFlags_NoResize, // Column will not stretch and keep resizin g based on submitted contents. | |||
#endif | #endif | |||
}; | }; | |||
// Flags for ImGui::TableNextRow() | // Flags for ImGui::TableNextRow() | |||
enum ImGuiTableRowFlags_ | enum ImGuiTableRowFlags_ | |||
{ | { | |||
ImGuiTableRowFlags_None = 0, | ImGuiTableRowFlags_None = 0, | |||
ImGuiTableRowFlags_Headers = 1 << 0 // Identify head er row (set default background color + width of its contents accounted different for auto column width) | ImGuiTableRowFlags_Headers = 1 << 0 // Identify head er row (set default background color + width of its contents accounted different ly for auto column width) | |||
}; | }; | |||
// Enum for ImGui::TableSetBgColor() | // Enum for ImGui::TableSetBgColor() | |||
// Background colors are rendering in 3 layers: | // Background colors are rendering in 3 layers: | |||
// - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if s et. | // - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if s et. | |||
// - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if s et. | // - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if s et. | |||
// - Layer 2: draw with CellBg color if set. | // - Layer 2: draw with CellBg color if set. | |||
// The purpose of the two row/columns layers is to let you decide if a backgroun d color changes should override or blend with the existing color. | // The purpose of the two row/columns layers is to let you decide if a backgroun d color changes should override or blend with the existing color. | |||
// When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows. | // When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows. | |||
// If you set the color of RowBg0 target, your color will override the existing RowBg0 color. | // If you set the color of RowBg0 target, your color will override the existing RowBg0 color. | |||
skipping to change at line 1353 | skipping to change at line 1344 | |||
}; | }; | |||
// A sorting direction | // A sorting direction | |||
enum ImGuiSortDirection_ | enum ImGuiSortDirection_ | |||
{ | { | |||
ImGuiSortDirection_None = 0, | ImGuiSortDirection_None = 0, | |||
ImGuiSortDirection_Ascending = 1, // Ascending = 0->9, A->Z etc. | ImGuiSortDirection_Ascending = 1, // Ascending = 0->9, A->Z etc. | |||
ImGuiSortDirection_Descending = 2 // Descending = 9->0, Z->A etc. | ImGuiSortDirection_Descending = 2 // Descending = 9->0, Z->A etc. | |||
}; | }; | |||
// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array | ||||
enum ImGuiKey_ | enum ImGuiKey_ | |||
{ | { | |||
ImGuiKey_Tab, | // Keyboard | |||
ImGuiKey_None = 0, | ||||
ImGuiKey_Tab = 512, // == ImGuiKey_NamedKey_BEGIN | ||||
ImGuiKey_LeftArrow, | ImGuiKey_LeftArrow, | |||
ImGuiKey_RightArrow, | ImGuiKey_RightArrow, | |||
ImGuiKey_UpArrow, | ImGuiKey_UpArrow, | |||
ImGuiKey_DownArrow, | ImGuiKey_DownArrow, | |||
ImGuiKey_PageUp, | ImGuiKey_PageUp, | |||
ImGuiKey_PageDown, | ImGuiKey_PageDown, | |||
ImGuiKey_Home, | ImGuiKey_Home, | |||
ImGuiKey_End, | ImGuiKey_End, | |||
ImGuiKey_Insert, | ImGuiKey_Insert, | |||
ImGuiKey_Delete, | ImGuiKey_Delete, | |||
ImGuiKey_Backspace, | ImGuiKey_Backspace, | |||
ImGuiKey_Space, | ImGuiKey_Space, | |||
ImGuiKey_Enter, | ImGuiKey_Enter, | |||
ImGuiKey_Escape, | ImGuiKey_Escape, | |||
ImGuiKey_KeyPadEnter, | ImGuiKey_LeftCtrl, ImGuiKey_LeftShift, ImGuiKey_LeftAlt, ImGuiKey_LeftSuper, | |||
ImGuiKey_A, // for text edit CTRL+A: select all | ImGuiKey_RightCtrl, ImGuiKey_RightShift, ImGuiKey_RightAlt, ImGuiKey_RightSu | |||
ImGuiKey_C, // for text edit CTRL+C: copy | per, | |||
ImGuiKey_V, // for text edit CTRL+V: paste | ImGuiKey_Menu, | |||
ImGuiKey_X, // for text edit CTRL+X: cut | ImGuiKey_0, ImGuiKey_1, ImGuiKey_2, ImGuiKey_3, ImGuiKey_4, ImGuiKey_5, ImGu | |||
ImGuiKey_Y, // for text edit CTRL+Y: redo | iKey_6, ImGuiKey_7, ImGuiKey_8, ImGuiKey_9, | |||
ImGuiKey_Z, // for text edit CTRL+Z: undo | ImGuiKey_A, ImGuiKey_B, ImGuiKey_C, ImGuiKey_D, ImGuiKey_E, ImGuiKey_F, ImGu | |||
ImGuiKey_COUNT | iKey_G, ImGuiKey_H, ImGuiKey_I, ImGuiKey_J, | |||
ImGuiKey_K, ImGuiKey_L, ImGuiKey_M, ImGuiKey_N, ImGuiKey_O, ImGuiKey_P, ImGu | ||||
iKey_Q, ImGuiKey_R, ImGuiKey_S, ImGuiKey_T, | ||||
ImGuiKey_U, ImGuiKey_V, ImGuiKey_W, ImGuiKey_X, ImGuiKey_Y, ImGuiKey_Z, | ||||
ImGuiKey_F1, ImGuiKey_F2, ImGuiKey_F3, ImGuiKey_F4, ImGuiKey_F5, ImGuiKey_F6 | ||||
, | ||||
ImGuiKey_F7, ImGuiKey_F8, ImGuiKey_F9, ImGuiKey_F10, ImGuiKey_F11, ImGuiKey_ | ||||
F12, | ||||
ImGuiKey_Apostrophe, // ' | ||||
ImGuiKey_Comma, // , | ||||
ImGuiKey_Minus, // - | ||||
ImGuiKey_Period, // . | ||||
ImGuiKey_Slash, // / | ||||
ImGuiKey_Semicolon, // ; | ||||
ImGuiKey_Equal, // = | ||||
ImGuiKey_LeftBracket, // [ | ||||
ImGuiKey_Backslash, // \ (this text inhibit multiline comment caused | ||||
by backslash) | ||||
ImGuiKey_RightBracket, // ] | ||||
ImGuiKey_GraveAccent, // ` | ||||
ImGuiKey_CapsLock, | ||||
ImGuiKey_ScrollLock, | ||||
ImGuiKey_NumLock, | ||||
ImGuiKey_PrintScreen, | ||||
ImGuiKey_Pause, | ||||
ImGuiKey_Keypad0, ImGuiKey_Keypad1, ImGuiKey_Keypad2, ImGuiKey_Keypad3, ImGu | ||||
iKey_Keypad4, | ||||
ImGuiKey_Keypad5, ImGuiKey_Keypad6, ImGuiKey_Keypad7, ImGuiKey_Keypad8, ImGu | ||||
iKey_Keypad9, | ||||
ImGuiKey_KeypadDecimal, | ||||
ImGuiKey_KeypadDivide, | ||||
ImGuiKey_KeypadMultiply, | ||||
ImGuiKey_KeypadSubtract, | ||||
ImGuiKey_KeypadAdd, | ||||
ImGuiKey_KeypadEnter, | ||||
ImGuiKey_KeypadEqual, | ||||
// Gamepad (some of those are analog values, 0.0f to 1.0f) | ||||
// NAVIGATION action | ||||
ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/O | ||||
ptions (PS) // -- | ||||
ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share ( | ||||
PS) // -- | ||||
ImGuiKey_GamepadFaceUp, // Y (Xbox) X (Switch) Triangl | ||||
e (PS) // -> ImGuiNavInput_Input | ||||
ImGuiKey_GamepadFaceDown, // A (Xbox) B (Switch) Cross ( | ||||
PS) // -> ImGuiNavInput_Activate | ||||
ImGuiKey_GamepadFaceLeft, // X (Xbox) Y (Switch) Square | ||||
(PS) // -> ImGuiNavInput_Menu | ||||
ImGuiKey_GamepadFaceRight, // B (Xbox) A (Switch) Circle | ||||
(PS) // -> ImGuiNavInput_Cancel | ||||
ImGuiKey_GamepadDpadUp, // D-pad Up | ||||
// -> ImGuiNavInput_DpadUp | ||||
ImGuiKey_GamepadDpadDown, // D-pad Down | ||||
// -> ImGuiNavInput_DpadDown | ||||
ImGuiKey_GamepadDpadLeft, // D-pad Left | ||||
// -> ImGuiNavInput_DpadLeft | ||||
ImGuiKey_GamepadDpadRight, // D-pad Right | ||||
// -> ImGuiNavInput_DpadRight | ||||
ImGuiKey_GamepadL1, // L Bumper (Xbox) L (Switch) L1 (PS) | ||||
// -> ImGuiNavInput_FocusPrev + ImGuiNavInput_TweakSlow | ||||
ImGuiKey_GamepadR1, // R Bumper (Xbox) R (Switch) R1 (PS) | ||||
// -> ImGuiNavInput_FocusNext + ImGuiNavInput_TweakFast | ||||
ImGuiKey_GamepadL2, // L Trigger (Xbox) ZL (Switch) L2 (PS) | ||||
[Analog] | ||||
ImGuiKey_GamepadR2, // R Trigger (Xbox) ZR (Switch) R2 (PS) | ||||
[Analog] | ||||
ImGuiKey_GamepadL3, // L Thumbstick (Xbox) L3 (Switch) L3 (PS) | ||||
ImGuiKey_GamepadR3, // R Thumbstick (Xbox) R3 (Switch) R3 (PS) | ||||
ImGuiKey_GamepadLStickUp, // [Analog] | ||||
// -> ImGuiNavInput_LStickUp | ||||
ImGuiKey_GamepadLStickDown, // [Analog] | ||||
// -> ImGuiNavInput_LStickDown | ||||
ImGuiKey_GamepadLStickLeft, // [Analog] | ||||
// -> ImGuiNavInput_LStickLeft | ||||
ImGuiKey_GamepadLStickRight, // [Analog] | ||||
// -> ImGuiNavInput_LStickRight | ||||
ImGuiKey_GamepadRStickUp, // [Analog] | ||||
ImGuiKey_GamepadRStickDown, // [Analog] | ||||
ImGuiKey_GamepadRStickLeft, // [Analog] | ||||
ImGuiKey_GamepadRStickRight, // [Analog] | ||||
// Keyboard Modifiers | ||||
// - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io. | ||||
KeyAlt, io.KeySuper, in a format allowing | ||||
// them to be accessed via standard key API, allowing calls such as IsKeyP | ||||
ressed(), IsKeyReleased(), querying duration etc. | ||||
// - Code polling every keys (e.g. an interface to detect a key press for in | ||||
put mapping) might want to ignore those | ||||
// and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightC | ||||
trl instead of ImGuiKey_ModCtrl). | ||||
// - In theory the value of keyboard modifiers should be roughly equivalent | ||||
to a logical or of the equivalent left/right keys. | ||||
// In practice: it's complicated; mods are often provided from different s | ||||
ources. Keyboard layout, IME, sticky keys and | ||||
// backends tend to interfere and break that equivalence. The safer decisi | ||||
on is to relay that ambiguity down to the end-user... | ||||
ImGuiKey_ModCtrl, | ||||
ImGuiKey_ModShift, | ||||
ImGuiKey_ModAlt, | ||||
ImGuiKey_ModSuper, | ||||
ImGuiKey_COUNT, // No valid ImGuiKey is ever greater than th | ||||
is value | ||||
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using | ||||
their own native index + a io.KeyMap[] array. | ||||
// We are ditching this method but keeping a legacy path for user code doing | ||||
e.g. IsKeyPressed(MY_NATIVE_KEY_CODE) | ||||
ImGuiKey_NamedKey_BEGIN = 512, | ||||
ImGuiKey_NamedKey_END = ImGuiKey_COUNT, | ||||
ImGuiKey_NamedKey_COUNT = ImGuiKey_NamedKey_END - ImGuiKey_NamedKey_ | ||||
BEGIN, | ||||
#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO | ||||
ImGuiKey_KeysData_SIZE = ImGuiKey_NamedKey_COUNT, // Size | ||||
of KeysData[]: only hold named keys | ||||
ImGuiKey_KeysData_OFFSET = ImGuiKey_NamedKey_BEGIN // First | ||||
key stored in KeysData[0] | ||||
#else | ||||
ImGuiKey_KeysData_SIZE = ImGuiKey_COUNT, // Size | ||||
of KeysData[]: hold legacy 0..512 keycodes + named keys | ||||
ImGuiKey_KeysData_OFFSET = 0 // First | ||||
key stored in KeysData[0] | ||||
#endif | ||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | ||||
, ImGuiKey_KeyPadEnter = ImGuiKey_KeypadEnter // Renamed in 1.87 | ||||
#endif | ||||
}; | }; | |||
// To test io.KeyMods (which is a combination of individual fields io.KeyCtrl, i o.KeyShift, io.KeyAlt set by user/backend) | // Helper "flags" version of key-mods to store and compare multiple key-mods eas ily. Sometimes used for storage (e.g. io.KeyMods) but otherwise not much used in public API. | |||
enum ImGuiKeyModFlags_ | enum ImGuiKeyModFlags_ | |||
{ | { | |||
ImGuiKeyModFlags_None = 0, | ImGuiKeyModFlags_None = 0, | |||
ImGuiKeyModFlags_Ctrl = 1 << 0, | ImGuiKeyModFlags_Ctrl = 1 << 0, | |||
ImGuiKeyModFlags_Shift = 1 << 1, | ImGuiKeyModFlags_Shift = 1 << 1, | |||
ImGuiKeyModFlags_Alt = 1 << 2, | ImGuiKeyModFlags_Alt = 1 << 2, | |||
ImGuiKeyModFlags_Super = 1 << 3 | ImGuiKeyModFlags_Super = 1 << 3 // Cmd/Super/Windows key | |||
}; | }; | |||
// Gamepad/Keyboard navigation | // Gamepad/Keyboard navigation | |||
// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. | // Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.AddKeyEvent( ) calls. | |||
// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields bef ore calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame(). | // Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields bef ore calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame(). | |||
// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://d earimgui.org/controls_sheets. | // Read instructions in imgui.cpp for more details. Download PNG/PSD at http://d earimgui.org/controls_sheets. | |||
enum ImGuiNavInput_ | enum ImGuiNavInput_ | |||
{ | { | |||
// Gamepad Mapping | // Gamepad Mapping | |||
ImGuiNavInput_Activate, // activate / open / toggle / tweak value | ImGuiNavInput_Activate, // Activate / Open / Toggle / Tweak value | |||
// e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) | // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) | |||
ImGuiNavInput_Cancel, // cancel / close / exit | ImGuiNavInput_Cancel, // Cancel / Close / Exit | |||
// e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) | // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) | |||
ImGuiNavInput_Input, // text input / on-screen keyboard | ImGuiNavInput_Input, // Text input / On-Screen keyboard | |||
// e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) | // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) | |||
ImGuiNavInput_Menu, // tap: toggle menu / hold: focus, move, resize | ImGuiNavInput_Menu, // Tap: Toggle menu / Hold: Focus, Move, Resize | |||
// e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) | // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) | |||
ImGuiNavInput_DpadLeft, // move / tweak / resize window (w/ PadMenu) | ImGuiNavInput_DpadLeft, // Move / Tweak / Resize window (w/ PadMenu) | |||
// e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) | // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) | |||
ImGuiNavInput_DpadRight, // | ImGuiNavInput_DpadRight, // | |||
ImGuiNavInput_DpadUp, // | ImGuiNavInput_DpadUp, // | |||
ImGuiNavInput_DpadDown, // | ImGuiNavInput_DpadDown, // | |||
ImGuiNavInput_LStickLeft, // scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down | ImGuiNavInput_LStickLeft, // Scroll / Move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down | |||
ImGuiNavInput_LStickRight, // | ImGuiNavInput_LStickRight, // | |||
ImGuiNavInput_LStickUp, // | ImGuiNavInput_LStickUp, // | |||
ImGuiNavInput_LStickDown, // | ImGuiNavInput_LStickDown, // | |||
ImGuiNavInput_FocusPrev, // next window (w/ PadMenu) | ImGuiNavInput_FocusPrev, // Focus Next window (w/ PadMenu) | |||
// e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) | // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) | |||
ImGuiNavInput_FocusNext, // prev window (w/ PadMenu) | ImGuiNavInput_FocusNext, // Focus Prev window (w/ PadMenu) | |||
// e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) | // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) | |||
ImGuiNavInput_TweakSlow, // slower tweaks | ImGuiNavInput_TweakSlow, // Slower tweaks | |||
// e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) | // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) | |||
ImGuiNavInput_TweakFast, // faster tweaks | ImGuiNavInput_TweakFast, // Faster tweaks | |||
// e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) | // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) | |||
// [Internal] Don't use directly! This is used internally to differentiate k eyboard from gamepad inputs for behaviors that require to differentiate them. | // [Internal] Don't use directly! This is used internally to differentiate k eyboard from gamepad inputs for behaviors that require to differentiate them. | |||
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+T | // Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+T | |||
AB) will be directly reading from io.KeysDown[] instead of io.NavInputs[]. | AB) will be directly reading from keyboard keys instead of io.NavInputs[]. | |||
ImGuiNavInput_KeyLeft_, // move left | ImGuiNavInput_KeyLeft_, // Move left | |||
// = Arrow keys | // = Arrow keys | |||
ImGuiNavInput_KeyRight_, // move right | ImGuiNavInput_KeyRight_, // Move right | |||
ImGuiNavInput_KeyUp_, // move up | ImGuiNavInput_KeyUp_, // Move up | |||
ImGuiNavInput_KeyDown_, // move down | ImGuiNavInput_KeyDown_, // Move down | |||
ImGuiNavInput_COUNT, | ImGuiNavInput_COUNT | |||
ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyLeft_ | ||||
}; | }; | |||
// Configuration flags stored in io.ConfigFlags. Set by user/application. | // Configuration flags stored in io.ConfigFlags. Set by user/application. | |||
enum ImGuiConfigFlags_ | enum ImGuiConfigFlags_ | |||
{ | { | |||
ImGuiConfigFlags_None = 0, | ImGuiConfigFlags_None = 0, | |||
ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navig ation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io .KeysDown[]. | ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navig ation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io .AddKeyEvent() calls | |||
ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad naviga tion enable flag. This is mostly to instruct your imgui backend to fill io.NavIn puts[]. Backend also needs to set ImGuiBackendFlags_HasGamepad. | ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad naviga tion enable flag. This is mostly to instruct your imgui backend to fill io.NavIn puts[]. Backend also needs to set ImGuiBackendFlags_HasGamepad. | |||
ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation t o move the mouse cursor. May be useful on TV/console systems where moving a virt ual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. I f enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth. | ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation t o move the mouse cursor. May be useful on TV/console systems where moving a virt ual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. I f enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth. | |||
ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation t o not set the io.WantCaptureKeyboard flag when io.NavActive is set. | ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation t o not set the io.WantCaptureKeyboard flag when io.NavActive is set. | |||
ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to cle ar mouse position/buttons in NewFrame(). This allows ignoring the mouse informat ion set by the backend. | ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to cle ar mouse position/buttons in NewFrame(). This allows ignoring the mouse informat ion set by the backend. | |||
ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct backend to n ot alter mouse cursor shape and visibility. Use if the backend cursor changes ar e interfering with yours and you don't want to use SetMouseCursor() to change mo use cursor. You may want to honor requests from imgui by reading GetMouseCursor( ) yourself instead. | ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct backend to n ot alter mouse cursor shape and visibility. Use if the backend cursor changes ar e interfering with yours and you don't want to use SetMouseCursor() to change mo use cursor. You may want to honor requests from imgui by reading GetMouseCursor( ) yourself instead. | |||
// User storage (to allow your backend/engine to communicate to code that ma y be shared between multiple projects. Those flags are not used by core Dear ImG ui) | // User storage (to allow your backend/engine to communicate to code that ma y be shared between multiple projects. Those flags are not used by core Dear ImG ui) | |||
ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-a ware. | ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-a ware. | |||
ImGuiConfigFlags_IsTouchScreen = 1 << 21 // Application is using a touch screen instead of a mouse. | ImGuiConfigFlags_IsTouchScreen = 1 << 21 // Application is using a touch screen instead of a mouse. | |||
}; | }; | |||
skipping to change at line 1602 | skipping to change at line 1677 | |||
// override them in most of your calls. Let the user choose via the option m enu and/or call SetColorEditOptions() once during startup. | // override them in most of your calls. Let the user choose via the option m enu and/or call SetColorEditOptions() once during startup. | |||
ImGuiColorEditFlags_DefaultOptions_ = ImGuiColorEditFlags_Uint8 | ImGuiColor EditFlags_DisplayRGB | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Picker HueBar, | ImGuiColorEditFlags_DefaultOptions_ = ImGuiColorEditFlags_Uint8 | ImGuiColor EditFlags_DisplayRGB | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Picker HueBar, | |||
// [Internal] Masks | // [Internal] Masks | |||
ImGuiColorEditFlags_DisplayMask_ = ImGuiColorEditFlags_DisplayRGB | ImGui ColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex, | ImGuiColorEditFlags_DisplayMask_ = ImGuiColorEditFlags_DisplayRGB | ImGui ColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex, | |||
ImGuiColorEditFlags_DataTypeMask_ = ImGuiColorEditFlags_Uint8 | ImGuiColor EditFlags_Float, | ImGuiColorEditFlags_DataTypeMask_ = ImGuiColorEditFlags_Uint8 | ImGuiColor EditFlags_Float, | |||
ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | I mGuiColorEditFlags_PickerHueBar, | ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | I mGuiColorEditFlags_PickerHueBar, | |||
ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiCo lorEditFlags_InputHSV | ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiCo lorEditFlags_InputHSV | |||
// Obsolete names (will be removed) | // Obsolete names (will be removed) | |||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | // ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditF | |||
, ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFl | lags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorE | |||
ags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEd | ditFlags_DisplayHex // [renamed in 1.69] | |||
itFlags_DisplayHex // [renamed in 1.69] | ||||
#endif | ||||
}; | }; | |||
// Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. | // Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. | |||
// We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them. | // We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them. | |||
enum ImGuiSliderFlags_ | enum ImGuiSliderFlags_ | |||
{ | { | |||
ImGuiSliderFlags_None = 0, | ImGuiSliderFlags_None = 0, | |||
ImGuiSliderFlags_AlwaysClamp = 1 << 4, // Clamp value to mi n/max bounds when input manually with CTRL+Click. By default CTRL+Click allows g oing out of bounds. | ImGuiSliderFlags_AlwaysClamp = 1 << 4, // Clamp value to mi n/max bounds when input manually with CTRL+Click. By default CTRL+Click allows g oing out of bounds. | |||
ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget l ogarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat w ith this if using a format-string with small amount of digits. | ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget l ogarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat w ith this if using a format-string with small amount of digits. | |||
ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f valu es are rounded to those 3 digits) | ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f valu es are rounded to those 3 digits) | |||
skipping to change at line 1820 | skipping to change at line 1893 | |||
IMGUI_API void ScaleAllSizes(float scale_factor); | IMGUI_API void ScaleAllSizes(float scale_factor); | |||
}; | }; | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// [SECTION] ImGuiIO | // [SECTION] ImGuiIO | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// Communicate most settings and inputs/outputs to Dear ImGui using this structu re. | // Communicate most settings and inputs/outputs to Dear ImGui using this structu re. | |||
// Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for g eneral usage. | // Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for g eneral usage. | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// [Internal] Storage used by IsKeyDown(), IsKeyPressed() etc functions. | ||||
// If prior to 1.87 you used io.KeysDownDuration[] (which was marked as internal | ||||
), you should use GetKeyData(key)->DownDuration and not io.KeysData[key]->DownDu | ||||
ration. | ||||
struct ImGuiKeyData | ||||
{ | ||||
bool Down; // True for if key is down | ||||
float DownDuration; // Duration the key has been down (<0.0f: no | ||||
t pressed, 0.0f: just pressed, >0.0f: time held) | ||||
float DownDurationPrev; // Last frame duration the key has been down | ||||
float AnalogValue; // 0.0f..1.0f for gamepad values | ||||
}; | ||||
struct ImGuiIO | struct ImGuiIO | |||
{ | { | |||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
// Configuration (fill once) // Default value | // Configuration (fill once) // Default value | |||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
ImGuiConfigFlags ConfigFlags; // = 0 // See ImGui ConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc. | ImGuiConfigFlags ConfigFlags; // = 0 // See ImGui ConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc. | |||
ImGuiBackendFlags BackendFlags; // = 0 // See ImGui BackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to c ommunicate features supported by the backend. | ImGuiBackendFlags BackendFlags; // = 0 // See ImGui BackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to c ommunicate features supported by the backend. | |||
ImVec2 DisplaySize; // <unset> // Main disp lay size, in pixels (generally == GetMainViewport()->Size) | ImVec2 DisplaySize; // <unset> // Main disp lay size, in pixels (generally == GetMainViewport()->Size) | |||
float DeltaTime; // = 1.0f/60.0f // Time elap sed since last frame, in seconds. | float DeltaTime; // = 1.0f/60.0f // Time elap sed since last frame, in seconds. | |||
float IniSavingRate; // = 5.0f // Minimum t ime between saving positions/sizes to .ini file, in seconds. | float IniSavingRate; // = 5.0f // Minimum t ime between saving positions/sizes to .ini file, in seconds. | |||
const char* IniFilename; // = "imgui.ini" // Path to . ini file (important: default "imgui.ini" is relative to current working dir!). S et NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions. | const char* IniFilename; // = "imgui.ini" // Path to . ini file (important: default "imgui.ini" is relative to current working dir!). S et NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions. | |||
const char* LogFilename; // = "imgui_log.txt"// Path to . log file (default parameter to ImGui::LogToFile when no file is specified). | const char* LogFilename; // = "imgui_log.txt"// Path to . log file (default parameter to ImGui::LogToFile when no file is specified). | |||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. | float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. | |||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. | float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. | |||
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging. | float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging. | |||
int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of in dices into the KeysDown[512] entries array which represent your "native" keyboar d state. | ||||
float KeyRepeatDelay; // = 0.250f // When hold ing a key/button, time before it starts repeating, in seconds (for buttons in Re peat mode, etc.). | float KeyRepeatDelay; // = 0.250f // When hold ing a key/button, time before it starts repeating, in seconds (for buttons in Re peat mode, etc.). | |||
float KeyRepeatRate; // = 0.050f // When hold ing a key/button, rate at which it repeats, in seconds. | float KeyRepeatRate; // = 0.050f // When hold ing a key/button, rate at which it repeats, in seconds. | |||
void* UserData; // = NULL // Store you r own data for retrieval by callbacks. | void* UserData; // = NULL // Store you r own data for retrieval by callbacks. | |||
ImFontAtlas*Fonts; // <auto> // Font atla s: load, rasterize and pack one or more fonts into a single texture. | ImFontAtlas*Fonts; // <auto> // Font atla s: load, rasterize and pack one or more fonts into a single texture. | |||
float FontGlobalScale; // = 1.0f // Global sc ale all fonts | float FontGlobalScale; // = 1.0f // Global sc ale all fonts | |||
bool FontAllowUserScaling; // = false // Allow use r scaling text of individual window with CTRL+Wheel. | bool FontAllowUserScaling; // = false // Allow use r scaling text of individual window with CTRL+Wheel. | |||
ImFont* FontDefault; // = NULL // Font to u se on NewFrame(). Use NULL to uses Fonts->Fonts[0]. | ImFont* FontDefault; // = NULL // Font to u se on NewFrame(). Use NULL to uses Fonts->Fonts[0]. | |||
ImVec2 DisplayFramebufferScale; // = (1, 1) // For retin a display or other situations where window coordinates are different from frameb uffer coordinates. This generally ends up in ImDrawData::FramebufferScale. | ImVec2 DisplayFramebufferScale; // = (1, 1) // For retin a display or other situations where window coordinates are different from frameb uffer coordinates. This generally ends up in ImDrawData::FramebufferScale. | |||
// Miscellaneous options | // Miscellaneous options | |||
bool MouseDrawCursor; // = false // Request I mGui to draw a mouse cursor for you (if you are on a platform without a mouse cu rsor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently use d by backend implementations. | bool MouseDrawCursor; // = false // Request I mGui to draw a mouse cursor for you (if you are on a platform without a mouse cu rsor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently use d by backend implementations. | |||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using C md/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Ho me/End, Double click selects by word instead of selecting whole text, Multi-sele ction in lists uses Cmd/Super instead of Ctrl. | bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using C md/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Ho me/End, Double click selects by word instead of selecting whole text, Multi-sele ction in lists uses Cmd/Super instead of Ctrl. | |||
bool ConfigInputTrickleEventQueue; // = true // Enable in put queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions wi th low framerates. | ||||
bool ConfigInputTextCursorBlink; // = true // Enable bl inking cursor (optional as some users consider it to be distracting). | bool ConfigInputTextCursorBlink; // = true // Enable bl inking cursor (optional as some users consider it to be distracting). | |||
bool ConfigDragClickToInputText; // = false // [BETA] En able turning DragXXX widgets into text input with a simple mouse click-release ( without moving). Not desirable on devices without a keyboard. | bool ConfigDragClickToInputText; // = false // [BETA] En able turning DragXXX widgets into text input with a simple mouse click-release ( without moving). Not desirable on devices without a keyboard. | |||
bool ConfigWindowsResizeFromEdges; // = true // Enable re sizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cu rsor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) | bool ConfigWindowsResizeFromEdges; // = true // Enable re sizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cu rsor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) | |||
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable al lowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. | bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable al lowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. | |||
float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1 .0f to disable. | float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1 .0f to disable. | |||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
// Platform Functions | // Platform Functions | |||
// (the imgui_impl_xxxx backend files are setting those up for you) | // (the imgui_impl_xxxx backend files are setting those up for you) | |||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
skipping to change at line 1876 | skipping to change at line 1959 | |||
void* BackendLanguageUserData; // = NULL // User data for non C++ programming language backend | void* BackendLanguageUserData; // = NULL // User data for non C++ programming language backend | |||
// Optional: Access OS clipboard | // Optional: Access OS clipboard | |||
// (default to use native Win32 clipboard on Windows, otherwise uses a priva te clipboard. Override to access OS clipboard on other architectures) | // (default to use native Win32 clipboard on Windows, otherwise uses a priva te clipboard. Override to access OS clipboard on other architectures) | |||
const char* (*GetClipboardTextFn)(void* user_data); | const char* (*GetClipboardTextFn)(void* user_data); | |||
void (*SetClipboardTextFn)(void* user_data, const char* text); | void (*SetClipboardTextFn)(void* user_data, const char* text); | |||
void* ClipboardUserData; | void* ClipboardUserData; | |||
// Optional: Notify OS Input Method Editor of the screen position of your cu rsor for text input position (e.g. when using Japanese/Chinese IME on Windows) | // Optional: Notify OS Input Method Editor of the screen position of your cu rsor for text input position (e.g. when using Japanese/Chinese IME on Windows) | |||
// (default to use native imm32 api on Windows) | // (default to use native imm32 api on Windows) | |||
void (*ImeSetInputScreenPosFn)(int x, int y); | void (*SetPlatformImeDataFn)(ImGuiViewport* viewport, ImGuiPlatformIm | |||
void* ImeWindowHandle; // = NULL // (Windows) | eData* data); | |||
Set this to your HWND to get automatic IME cursor positioning. | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | |||
void* ImeWindowHandle; // = NULL // [Obsolete | ||||
] Set ImGuiViewport::PlatformHandleRaw instead. Set this to your HWND to get aut | ||||
omatic IME cursor positioning. | ||||
#else | ||||
void* _UnusedPadding; // Unused fi | ||||
eld to keep data structure the same size. | ||||
#endif | ||||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
// Input - Fill before calling NewFrame() | // Input - Call before calling NewFrame() | |||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
ImVec2 MousePos; // Mouse position, in pixels. Se | // Input Functions | |||
t to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc. | IMGUI_API void AddKeyEvent(ImGuiKey key, bool down); // Q | |||
) | ueue a new key down/up event. Key should be "translated" (as in, generally ImGui | |||
bool MouseDown[5]; // Mouse buttons: 0=left, 1=righ | Key_A matches the key end-user would use to emit an 'A' character) | |||
t, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left | IMGUI_API void AddKeyAnalogEvent(ImGuiKey key, bool down, float v); // Q | |||
and right buttons. Others buttons allows us to track if the mouse is being used | ueue a new key down/up event for analog values (e.g. ImGuiKey_Gamepad_ values). | |||
by your application + available to user as a convenience via IsMouse** API. | Dead-zones should be handled by the backend. | |||
float MouseWheel; // Mouse wheel Vertical: 1 unit | IMGUI_API void AddMousePosEvent(float x, float y); // Q | |||
scrolls about 5 lines text. | ueue a mouse position update. Use -FLT_MAX,-FLT_MAX to signify no mouse (e.g. ap | |||
float MouseWheelH; // Mouse wheel Horizontal. Most | p not focused and not hovered) | |||
users don't have a mouse with an horizontal wheel, may not be filled by all back | IMGUI_API void AddMouseButtonEvent(int button, bool down); // Q | |||
ends. | ueue a mouse button change | |||
bool KeyCtrl; // Keyboard modifier pressed: Co | IMGUI_API void AddMouseWheelEvent(float wh_x, float wh_y); // Q | |||
ntrol | ueue a mouse wheel update | |||
bool KeyShift; // Keyboard modifier pressed: Sh | IMGUI_API void AddFocusEvent(bool focused); // Q | |||
ift | ueue a gain/loss of focus for the application (generally based on OS/platform fo | |||
bool KeyAlt; // Keyboard modifier pressed: Al | cus of your window) | |||
t | IMGUI_API void AddInputCharacter(unsigned int c); // Q | |||
bool KeySuper; // Keyboard modifier pressed: Cm | ueue a new character input | |||
d/Super/Windows | IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Q | |||
bool KeysDown[512]; // Keyboard keys that are presse | ueue a new character input from an UTF-16 character, it can be a surrogate | |||
d (ideally left in the "native" order your engine has access to keyboard keys, s | IMGUI_API void AddInputCharactersUTF8(const char* str); // Q | |||
o you can use your own defines/enums for keys). | ueue a new characters input from an UTF-8 string | |||
float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared back | ||||
to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by | IMGUI_API void ClearInputCharacters(); // [ | |||
NewFrame(). | Internal] Clear the text input buffer manually | |||
IMGUI_API void ClearInputKeys(); // [ | ||||
// Functions | Internal] Release all keys | |||
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new cha | IMGUI_API void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int | |||
racter input | native_scancode, int native_legacy_index = -1); // [Optional] Specify index for | |||
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new cha | legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, | |||
racter input from an UTF-16 character, it can be a surrogate | scancode. | |||
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new cha | ||||
racters input from an UTF-8 string | ||||
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear | ||||
ImGui when hosting platform windows lose or gain input focus | ||||
IMGUI_API void ClearInputCharacters(); // [Internal] Cl | ||||
ear the text input buffer manually | ||||
IMGUI_API void ClearInputKeys(); // [Internal] Re | ||||
lease all keys | ||||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
// Output - Updated by NewFrame() or EndFrame()/Render() | // Output - Updated by NewFrame() or EndFrame()/Render() | |||
// (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is | // (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is | |||
// generally easier and more correct to use their state BEFORE calling NewF rame(). See FAQ for details!) | // generally easier and more correct to use their state BEFORE calling NewF rame(). See FAQ for details!) | |||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
bool WantCaptureMouse; // Set when Dear ImGui will use | bool WantCaptureMouse; // Set when Dear ImGui will | |||
mouse inputs, in this case do not dispatch them to your main game/application (e | use mouse inputs, in this case do not dispatch them to your main game/applicatio | |||
ither way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hover | n (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is h | |||
ing over an imgui window, widget is active, mouse was clicked over an imgui wind | overing over an imgui window, widget is active, mouse was clicked over an imgui | |||
ow, etc.). | window, etc.). | |||
bool WantCaptureKeyboard; // Set when Dear ImGui will use | bool WantCaptureKeyboard; // Set when Dear ImGui will | |||
keyboard inputs, in this case do not dispatch them to your main game/application | use keyboard inputs, in this case do not dispatch them to your main game/applica | |||
(either way, always pass keyboard inputs to imgui). (e.g. InputText active, or | tion (either way, always pass keyboard inputs to imgui). (e.g. InputText active, | |||
an imgui window is focused and navigation is enabled, etc.). | or an imgui window is focused and navigation is enabled, etc.). | |||
bool WantTextInput; // Mobile/console: when set, you | bool WantTextInput; // Mobile/console: when set, | |||
may display an on-screen keyboard. This is set by Dear ImGui when it wants text | you may display an on-screen keyboard. This is set by Dear ImGui when it wants | |||
ual keyboard input to happen (e.g. when a InputText widget is active). | textual keyboard input to happen (e.g. when a InputText widget is active). | |||
bool WantSetMousePos; // MousePos has been altered, ba | bool WantSetMousePos; // MousePos has been altered | |||
ckend should reposition mouse on next frame. Rarely used! Set only when ImGuiCon | , backend should reposition mouse on next frame. Rarely used! Set only when ImGu | |||
figFlags_NavEnableSetMousePos flag is enabled. | iConfigFlags_NavEnableSetMousePos flag is enabled. | |||
bool WantSaveIniSettings; // When manual .ini load/save is | bool WantSaveIniSettings; // When manual .ini load/sav | |||
active (io.IniFilename == NULL), this will be set to notify your application th | e is active (io.IniFilename == NULL), this will be set to notify your applicatio | |||
at you can call SaveIniSettingsToMemory() and save yourself. Important: clear io | n that you can call SaveIniSettingsToMemory() and save yourself. Important: clea | |||
.WantSaveIniSettings yourself after saving! | r io.WantSaveIniSettings yourself after saving! | |||
bool NavActive; // Keyboard/Gamepad navigation i | bool NavActive; // Keyboard/Gamepad navigati | |||
s currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused a | on is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focus | |||
nd it doesn't use the ImGuiWindowFlags_NoNavInputs flag. | ed and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. | |||
bool NavVisible; // Keyboard/Gamepad navigation i | bool NavVisible; // Keyboard/Gamepad navigati | |||
s visible and allowed (will handle ImGuiKey_NavXXX events). | on is visible and allowed (will handle ImGuiKey_NavXXX events). | |||
float Framerate; // Rough estimate of application | float Framerate; // Rough estimate of applica | |||
framerate, in frame per second. Solely for convenience. Rolling average estimat | tion framerate, in frame per second. Solely for convenience. Rolling average est | |||
ion based on io.DeltaTime over 120 frames. | imation based on io.DeltaTime over 120 frames. | |||
int MetricsRenderVertices; // Vertices output during last c | int MetricsRenderVertices; // Vertices output during la | |||
all to Render() | st call to Render() | |||
int MetricsRenderIndices; // Indices output during last ca | int MetricsRenderIndices; // Indices output during las | |||
ll to Render() = number of triangles * 3 | t call to Render() = number of triangles * 3 | |||
int MetricsRenderWindows; // Number of visible windows | int MetricsRenderWindows; // Number of visible windows | |||
int MetricsActiveWindows; // Number of active windows | int MetricsActiveWindows; // Number of active windows | |||
int MetricsActiveAllocations; // Number of active allocations, | int MetricsActiveAllocations; // Number of active allocati | |||
updated by MemAlloc/MemFree based on current context. May be off if you have mu | ons, updated by MemAlloc/MemFree based on current context. May be off if you hav | |||
ltiple imgui contexts. | e multiple imgui contexts. | |||
ImVec2 MouseDelta; // Mouse delta. Note that this i | ImVec2 MouseDelta; // Mouse delta. Note that th | |||
s zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), s | is is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX | |||
o a disappearing/reappearing mouse won't have a huge delta. | ), so a disappearing/reappearing mouse won't have a huge delta. | |||
// Legacy: before 1.87, we required backend to fill io.KeyMap[] (imgui->nati | ||||
ve map) during initialization and io.KeysDown[] (native indices) every frame. | ||||
// This is still temporarily supported as a legacy feature. However the new | ||||
preferred scheme is for backend to call io.AddKeyEvent(). | ||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO | ||||
int KeyMap[ImGuiKey_COUNT]; // [LEGACY] Input: map of in | ||||
dices into the KeysDown[512] entries array which represent your "native" keyboar | ||||
d state. The first 512 are now unused and should be kept zero. Legacy backend wi | ||||
ll write into KeyMap[] using ImGuiKey_ indices which are always >512. | ||||
bool KeysDown[512]; // [LEGACY] Input: Keyboard | ||||
keys that are pressed (ideally left in the "native" order your engine has access | ||||
to keyboard keys, so you can use your own defines/enums for keys). | ||||
#endif | ||||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
// [Internal] Dear ImGui will maintain those fields. Forward compatibility n ot guaranteed! | // [Internal] Dear ImGui will maintain those fields. Forward compatibility n ot guaranteed! | |||
//------------------------------------------------------------------ | //------------------------------------------------------------------ | |||
bool WantCaptureMouseUnlessPopupClose;// Alternative to WantCaptureMo | // Main Input State | |||
use: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) whe | // (this block used to be written by backend, since 1.87 it is best to NOT w | |||
n a click over void is expected to close a popup. | rite to those directly, call the AddXXX functions above instead) | |||
ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.Ke | // (reading from those variables is fair game, as they are extremely unlikel | |||
yCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame() | y to be moving anywhere) | |||
ImGuiKeyModFlags KeyModsPrev; // Previous key mods | ImVec2 MousePos; // Mouse position, in pixels | |||
ImVec2 MousePosPrev; // Previous mouse position (note | . Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, | |||
that MouseDelta is not necessary == MousePos-MousePosPrev, in case either posit | etc.) | |||
ion is invalid) | bool MouseDown[5]; // Mouse buttons: 0=left, 1= | |||
ImVec2 MouseClickedPos[5]; // Position at time of clicking | right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses l | |||
double MouseClickedTime[5]; // Time of last click (used to f | eft and right buttons. Others buttons allows us to track if the mouse is being u | |||
igure out double-click) | sed by your application + available to user as a convenience via IsMouse** API. | |||
bool MouseClicked[5]; // Mouse button went from !Down | float MouseWheel; // Mouse wheel Vertical: 1 u | |||
to Down (same as MouseClickedCount[x] != 0) | nit scrolls about 5 lines text. | |||
bool MouseDoubleClicked[5]; // Has mouse button been double- | float MouseWheelH; // Mouse wheel Horizontal. M | |||
clicked? (same as MouseClickedCount[x] == 2) | ost users don't have a mouse with an horizontal wheel, may not be filled by all | |||
ImU16 MouseClickedCount[5]; // == 0 (not clicked), == 1 (sam | backends. | |||
e as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when goi | bool KeyCtrl; // Keyboard modifier down: C | |||
ng from !Down to Down | ontrol | |||
ImU16 MouseClickedLastCount[5]; // Count successive number of cl | bool KeyShift; // Keyboard modifier down: S | |||
icks. Stays valid after mouse release. Reset after another click is done. | hift | |||
bool MouseReleased[5]; // Mouse button went from Down t | bool KeyAlt; // Keyboard modifier down: A | |||
o !Down | lt | |||
bool MouseDownOwned[5]; // Track if button was clicked i | bool KeySuper; // Keyboard modifier down: C | |||
nside a dear imgui window or over void blocked by a popup. We don't request mous | md/Super/Windows | |||
e capture from the application if click started outside ImGui bounds. | float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared b | |||
bool MouseDownOwnedUnlessPopupClose[5];//Track if button was clicked | ack to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here | |||
inside a dear imgui window. | by NewFrame(). | |||
float MouseDownDuration[5]; // Duration the mouse button has | ||||
been down (0.0f == just clicked) | // Other state maintained from data above + IO function calls | |||
float MouseDownDurationPrev[5]; // Previous time the mouse butto | ImGuiKeyModFlags KeyMods; // Key mods flags (same as i | |||
n has been down | o.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame() | |||
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, o | ImGuiKeyModFlags KeyModsPrev; // Key mods flags (from prev | |||
n each axis, of how much mouse has traveled from the clicking point | ious frame) | |||
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of h | ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known k | |||
ow much mouse has traveled from the clicking point | eys. Use IsKeyXXX() functions to access this. | |||
float KeysDownDuration[512]; // Duration the keyboard key has | bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptur | |||
been down (0.0f == just pressed) | eMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) | |||
float KeysDownDurationPrev[512]; // Previous duration the key has | when a click over void is expected to close a popup. | |||
been down | ImVec2 MousePosPrev; // Previous mouse position ( | |||
note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either p | ||||
osition is invalid) | ||||
ImVec2 MouseClickedPos[5]; // Position at time of click | ||||
ing | ||||
double MouseClickedTime[5]; // Time of last click (used | ||||
to figure out double-click) | ||||
bool MouseClicked[5]; // Mouse button went from !D | ||||
own to Down (same as MouseClickedCount[x] != 0) | ||||
bool MouseDoubleClicked[5]; // Has mouse button been dou | ||||
ble-clicked? (same as MouseClickedCount[x] == 2) | ||||
ImU16 MouseClickedCount[5]; // == 0 (not clicked), == 1 | ||||
(same as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when | ||||
going from !Down to Down | ||||
ImU16 MouseClickedLastCount[5]; // Count successive number o | ||||
f clicks. Stays valid after mouse release. Reset after another click is done. | ||||
bool MouseReleased[5]; // Mouse button went from Do | ||||
wn to !Down | ||||
bool MouseDownOwned[5]; // Track if button was click | ||||
ed inside a dear imgui window or over void blocked by a popup. We don't request | ||||
mouse capture from the application if click started outside ImGui bounds. | ||||
bool MouseDownOwnedUnlessPopupClose[5]; //Track if button was clicke | ||||
d inside a dear imgui window. | ||||
float MouseDownDuration[5]; // Duration the mouse button | ||||
has been down (0.0f == just clicked) | ||||
float MouseDownDurationPrev[5]; // Previous time the mouse b | ||||
utton has been down | ||||
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance | ||||
of how much mouse has traveled from the clicking point (used for moving threshol | ||||
ds) | ||||
float NavInputsDownDuration[ImGuiNavInput_COUNT]; | float NavInputsDownDuration[ImGuiNavInput_COUNT]; | |||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; | float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; | |||
float PenPressure; // Touch/Pen pressure (0.0f to 1 .0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently u nused by Dear ImGui. | float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage current ly unused by Dear ImGui. | |||
bool AppFocusLost; | bool AppFocusLost; | |||
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16 | ImS8 BackendUsingLegacyKeyArrays; // -1: unknown, 0: using Add | |||
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input ( | KeyEvent(), 1: using legacy io.KeysDown[] | |||
obtained by platform backend). Fill using AddInputCharacter() helper. | bool BackendUsingLegacyNavInputArray; // 0: using AddKeyAnalogEven | |||
t(), 1: writing to legacy io.NavInputs[] directly | ||||
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF1 | ||||
6() | ||||
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ inp | ||||
ut (obtained by platform backend). Fill using AddInputCharacter() helper. | ||||
IMGUI_API ImGuiIO(); | IMGUI_API ImGuiIO(); | |||
}; | }; | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// [SECTION] Misc data structures | // [SECTION] Misc data structures | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// Shared state of InputText(), passed as an argument to your callback when a Im GuiInputTextFlags_Callback* flag is used. | // Shared state of InputText(), passed as an argument to your callback when a Im GuiInputTextFlags_Callback* flag is used. | |||
// The callback function should return 0 by default. | // The callback function should return 0 by default. | |||
skipping to change at line 2286 | skipping to change at line 2390 | |||
typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* c md); | typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* c md); | |||
#endif | #endif | |||
// Special Draw callback value to request renderer backend to reset the graphics /render state. | // Special Draw callback value to request renderer backend to reset the graphics /render state. | |||
// The renderer backend needs to handle this special value, otherwise it will cr ash trying to call a function at this address. | // The renderer backend needs to handle this special value, otherwise it will cr ash trying to call a function at this address. | |||
// This is useful for example if you submitted callbacks which you know have alt ered the render state and you want it to be restored. | // This is useful for example if you submitted callbacks which you know have alt ered the render state and you want it to be restored. | |||
// It is not done by default because they are many perfectly useful way of alter ing render state for imgui contents (e.g. changing shader/blending settings befo re an Image call). | // It is not done by default because they are many perfectly useful way of alter ing render state for imgui contents (e.g. changing shader/blending settings befo re an Image call). | |||
#define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1) | #define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1) | |||
// Typically, 1 command = 1 GPU draw call (unless command is a callback) | // Typically, 1 command = 1 GPU draw call (unless command is a callback) | |||
// - VtxOffset/IdxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasV | // - VtxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' | |||
txOffset' is enabled, | is enabled, | |||
// those fields allow us to render meshes larger than 64K vertices while keepi | // this fields allow us to render meshes larger than 64K vertices while keepin | |||
ng 16-bit indices. | g 16-bit indices. | |||
// Pre-1.71 backends will typically ignore the VtxOffset/IdxOffset fields. | // Backends made for <1.71. will typically ignore the VtxOffset fields. | |||
// - The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() t hem together (this is asserted for). | // - The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() t hem together (this is asserted for). | |||
struct ImDrawCmd | struct ImDrawCmd | |||
{ | { | |||
ImVec4 ClipRect; // 4*4 // Clipping rectangle (x1, y1, x 2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates | ImVec4 ClipRect; // 4*4 // Clipping rectangle (x1, y1, x 2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates | |||
ImTextureID TextureId; // 4-8 // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. I gnore if never using images or multiple fonts atlas. | ImTextureID TextureId; // 4-8 // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. I gnore if never using images or multiple fonts atlas. | |||
unsigned int VtxOffset; // 4 // Start offset in vertex buffer . ImGuiBackendFlags_RendererHasVtxOffset: always 0, otherwise may be >0 to suppo rt meshes larger than 64K vertices with 16-bit indices. | unsigned int VtxOffset; // 4 // Start offset in vertex buffer . ImGuiBackendFlags_RendererHasVtxOffset: always 0, otherwise may be >0 to suppo rt meshes larger than 64K vertices with 16-bit indices. | |||
unsigned int IdxOffset; // 4 // Start offset in index buffer. Always equal to sum of ElemCount drawn so far. | unsigned int IdxOffset; // 4 // Start offset in index buffer. | |||
unsigned int ElemCount; // 4 // Number of indices (multiple o f 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. | unsigned int ElemCount; // 4 // Number of indices (multiple o f 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. | |||
ImDrawCallback UserCallback; // 4-8 // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normall y. | ImDrawCallback UserCallback; // 4-8 // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normall y. | |||
void* UserCallbackData; // 4-8 // The draw callback code can ac cess this. | void* UserCallbackData; // 4-8 // The draw callback code can ac cess this. | |||
ImDrawCmd() { memset(this, 0, sizeof(*this)); } // Also ensure our padding f ields are zeroed | ImDrawCmd() { memset(this, 0, sizeof(*this)); } // Also ensure our padding f ields are zeroed | |||
// Since 1.83: returns ImTextureID associated with this draw call. Warning: DO NOT assume this is always same as 'TextureId' (we will change this function f or an upcoming feature) | // Since 1.83: returns ImTextureID associated with this draw call. Warning: DO NOT assume this is always same as 'TextureId' (we will change this function f or an upcoming feature) | |||
inline ImTextureID GetTexID() const { return TextureId; } | inline ImTextureID GetTexID() const { return TextureId; } | |||
}; | }; | |||
skipping to change at line 2500 | skipping to change at line 2604 | |||
IMGUI_API void PrimReserve(int idx_count, int vtx_count); | IMGUI_API void PrimReserve(int idx_count, int vtx_count); | |||
IMGUI_API void PrimUnreserve(int idx_count, int vtx_count); | IMGUI_API void PrimUnreserve(int idx_count, int vtx_count); | |||
IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) | IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) | |||
IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& u v_a, const ImVec2& uv_b, ImU32 col); | IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& u v_a, const ImVec2& uv_b, ImU32 col); | |||
IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c , const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, c onst ImVec2& uv_d, ImU32 col); | IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c , const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, c onst ImVec2& uv_d, ImU32 col); | |||
inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _ VtxWritePtr++; _VtxCurrentIdx++; } | inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _ VtxWritePtr++; _VtxCurrentIdx++; } | |||
inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } | inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } | |||
inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index | inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index | |||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | |||
inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImV | inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImV | |||
ec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { A | ec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { A | |||
ddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } | ddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } // OBSOLETED in 1 | |||
inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const | .80 (Jan 2021) | |||
ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segme | inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const | |||
nts); } | ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segme | |||
nts); } // OBSOLETED in 1.80 (Jan 2021) | ||||
#endif | #endif | |||
// [Internal helpers] | // [Internal helpers] | |||
IMGUI_API void _ResetForNewFrame(); | IMGUI_API void _ResetForNewFrame(); | |||
IMGUI_API void _ClearFreeMemory(); | IMGUI_API void _ClearFreeMemory(); | |||
IMGUI_API void _PopUnusedDrawCmd(); | IMGUI_API void _PopUnusedDrawCmd(); | |||
IMGUI_API void _TryMergeDrawCmds(); | IMGUI_API void _TryMergeDrawCmds(); | |||
IMGUI_API void _OnChangedClipRect(); | IMGUI_API void _OnChangedClipRect(); | |||
IMGUI_API void _OnChangedTextureID(); | IMGUI_API void _OnChangedTextureID(); | |||
IMGUI_API void _OnChangedVtxOffset(); | IMGUI_API void _OnChangedVtxOffset(); | |||
skipping to change at line 2730 | skipping to change at line 2834 | |||
ImVec4 TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1]; // UVs for baked anti-aliased lines | ImVec4 TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1]; // UVs for baked anti-aliased lines | |||
// [Internal] Font builder | // [Internal] Font builder | |||
const ImFontBuilderIO* FontBuilderIO; // Opaque interface to a fon t builder (default to stb_truetype, can be changed to use FreeType by defining I MGUI_ENABLE_FREETYPE). | const ImFontBuilderIO* FontBuilderIO; // Opaque interface to a fon t builder (default to stb_truetype, can be changed to use FreeType by defining I MGUI_ENABLE_FREETYPE). | |||
unsigned int FontBuilderFlags; // Shared flags (for all fon ts) for custom font builder. THIS IS BUILD IMPLEMENTATION DEPENDENT. Per-font ov erride is also available in ImFontConfig. | unsigned int FontBuilderFlags; // Shared flags (for all fon ts) for custom font builder. THIS IS BUILD IMPLEMENTATION DEPENDENT. Per-font ov erride is also available in ImFontConfig. | |||
// [Internal] Packing data | // [Internal] Packing data | |||
int PackIdMouseCursors; // Custom texture rectangle ID for white pixel and mouse cursors | int PackIdMouseCursors; // Custom texture rectangle ID for white pixel and mouse cursors | |||
int PackIdLines; // Custom texture rectangle ID for baked anti-aliased lines | int PackIdLines; // Custom texture rectangle ID for baked anti-aliased lines | |||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | // [Obsolete] | |||
typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+ | //typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+ | |||
//typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+ | //typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+ | |||
#endif | ||||
}; | }; | |||
// Font runtime data and rendering | // Font runtime data and rendering | |||
// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). | // ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). | |||
struct ImFont | struct ImFont | |||
{ | { | |||
// Members: Hot ~20/24 bytes (for CalcTextSize) | // Members: Hot ~20/24 bytes (for CalcTextSize) | |||
ImVector<float> IndexAdvanceX; // 12-16 // out // // Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for Ca lcTextSize functions which only this this info, and are often bottleneck in larg e UI). | ImVector<float> IndexAdvanceX; // 12-16 // out // // Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for Ca lcTextSize functions which only this this info, and are often bottleneck in larg e UI). | |||
float FallbackAdvanceX; // 4 // out // = Fallbac kGlyph->AdvanceX | float FallbackAdvanceX; // 4 // out // = Fallbac kGlyph->AdvanceX | |||
float FontSize; // 4 // in // // Height of characters/line, set during loading (don't change after loading) | float FontSize; // 4 // in // // Height of characters/line, set during loading (don't change after loading) | |||
skipping to change at line 2817 | skipping to change at line 2920 | |||
// - Work Area = entire viewport minus sections used by main menu bars (for pl atform windows), or by task bar (for platform monitor). | // - Work Area = entire viewport minus sections used by main menu bars (for pl atform windows), or by task bar (for platform monitor). | |||
// - Windows are generally trying to stay within the Work Area of their host v iewport. | // - Windows are generally trying to stay within the Work Area of their host v iewport. | |||
struct ImGuiViewport | struct ImGuiViewport | |||
{ | { | |||
ImGuiViewportFlags Flags; // See ImGuiViewportFlags_ | ImGuiViewportFlags Flags; // See ImGuiViewportFlags_ | |||
ImVec2 Pos; // Main Area: Position of the vi ewport (Dear ImGui coordinates are the same as OS desktop/native coordinates) | ImVec2 Pos; // Main Area: Position of the vi ewport (Dear ImGui coordinates are the same as OS desktop/native coordinates) | |||
ImVec2 Size; // Main Area: Size of the viewpo rt. | ImVec2 Size; // Main Area: Size of the viewpo rt. | |||
ImVec2 WorkPos; // Work Area: Position of the vi ewport minus task bars, menus bars, status bars (>= Pos) | ImVec2 WorkPos; // Work Area: Position of the vi ewport minus task bars, menus bars, status bars (>= Pos) | |||
ImVec2 WorkSize; // Work Area: Size of the viewpo rt minus task bars, menu bars, status bars (<= Size) | ImVec2 WorkSize; // Work Area: Size of the viewpo rt minus task bars, menu bars, status bars (<= Size) | |||
// Platform/Backend Dependent Data | ||||
void* PlatformHandleRaw; // void* to hold lower-level, pl | ||||
atform-native window handle (under Win32 this is expected to be a HWND, unused f | ||||
or other platforms) | ||||
ImGuiViewport() { memset(this, 0, sizeof(*this)); } | ImGuiViewport() { memset(this, 0, sizeof(*this)); } | |||
// Helpers | // Helpers | |||
ImVec2 GetCenter() const { return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); } | ImVec2 GetCenter() const { return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); } | |||
ImVec2 GetWorkCenter() const { return ImVec2(WorkPos.x + Work Size.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); } | ImVec2 GetWorkCenter() const { return ImVec2(WorkPos.x + Work Size.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); } | |||
}; | }; | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// [SECTION] Platform Dependent Interfaces | ||||
//----------------------------------------------------------------------------- | ||||
// (Optional) Support for IME (Input Method Editor) via the io.SetPlatformImeDat | ||||
aFn() function. | ||||
struct ImGuiPlatformImeData | ||||
{ | ||||
bool WantVisible; // A widget wants the IME to be visible | ||||
ImVec2 InputPos; // Position of the input cursor | ||||
float InputLineHeight; // Line height | ||||
ImGuiPlatformImeData() { memset(this, 0, sizeof(*this)); } | ||||
}; | ||||
//----------------------------------------------------------------------------- | ||||
// [SECTION] Obsolete functions and types | // [SECTION] Obsolete functions and types | |||
// (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for detail s) | // (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for detail s) | |||
// Please keep your copy of dear imgui up to date! Occasionally set '#define IMG UI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead. | // Please keep your copy of dear imgui up to date! Occasionally set '#define IMG UI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead. | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
namespace ImGui | ||||
{ | ||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO | ||||
IMGUI_API int GetKeyIndex(ImGuiKey key); // map ImGuiKey_* values int | ||||
o legacy native key index. == io.KeyMap[key] | ||||
#else | ||||
static inline int GetKeyIndex(ImGuiKey key) { IM_ASSERT(key >= ImGuiKey_ | ||||
NamedKey_BEGIN && key < ImGuiKey_NamedKey_END && "ImGuiKey and native_index was | ||||
merged together and native_index is disabled by IMGUI_DISABLE_OBSOLETE_KEYIO. Pl | ||||
ease switch to ImGuiKey."); return key; } | ||||
#endif | ||||
} | ||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | |||
namespace ImGui | namespace ImGui | |||
{ | { | |||
// OBSOLETED in 1.86 (from November 2021) | // OBSOLETED in 1.86 (from November 2021) | |||
IMGUI_API void CalcListClipping(int items_count, float items_height, in t* out_items_display_start, int* out_items_display_end); // Calculate coarse cli pping for large list of evenly sized items. Prefer using ImGuiListClipper. | IMGUI_API void CalcListClipping(int items_count, float items_height, in t* out_items_display_start, int* out_items_display_end); // Calculate coarse cli pping for large list of evenly sized items. Prefer using ImGuiListClipper. | |||
// OBSOLETED in 1.85 (from August 2021) | // OBSOLETED in 1.85 (from August 2021) | |||
static inline float GetWindowContentRegionWidth() { return GetWindowContentR egionMax().x - GetWindowContentRegionMin().x; } | static inline float GetWindowContentRegionWidth() { return GetWindowContentR egionMax().x - GetWindowContentRegionMin().x; } | |||
// OBSOLETED in 1.81 (from February 2021) | // OBSOLETED in 1.81 (from February 2021) | |||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int he ight_in_items = -1); // Helper to calculate size from items_count and height_in_ items | IMGUI_API bool ListBoxHeader(const char* label, int items_count, int he ight_in_items = -1); // Helper to calculate size from items_count and height_in_ items | |||
static inline bool ListBoxHeader(const char* label, const ImVec2& size = Im Vec2(0, 0)) { return BeginListBox(label, size); } | static inline bool ListBoxHeader(const char* label, const ImVec2& size = Im Vec2(0, 0)) { return BeginListBox(label, size); } | |||
skipping to change at line 2860 | skipping to change at line 2989 | |||
static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN (label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); } | static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN (label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); } | |||
static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN (label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); } | static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN (label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); } | |||
IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float p ower); | IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float p ower); | |||
IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type , void* p_data, int components, const void* p_min, const void* p_max, const char * format, float power); | IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type , void* p_data, int components, const void* p_min, const void* p_max, const char * format, float power); | |||
static inline bool SliderFloat(const char* label, float* v, float v_min, fl oat v_max, const char* format, float power) { return SliderScala r(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); } | static inline bool SliderFloat(const char* label, float* v, float v_min, fl oat v_max, const char* format, float power) { return SliderScala r(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); } | |||
static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power) { return SliderScala rN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); } | static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power) { return SliderScala rN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); } | |||
static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power) { return SliderScala rN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); } | static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power) { return SliderScala rN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); } | |||
static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power) { return SliderScala rN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); } | static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power) { return SliderScala rN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); } | |||
// OBSOLETED in 1.77 (from June 2020) | // OBSOLETED in 1.77 (from June 2020) | |||
static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseBu tton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_it ems ? 0 : ImGuiPopupFlags_NoOpenOverItems)); } | static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseBu tton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_it ems ? 0 : ImGuiPopupFlags_NoOpenOverItems)); } | |||
// OBSOLETED in 1.72 (from April 2019) | ||||
static inline void TreeAdvanceToLabelPos() { SetCursorPosX(GetC | ||||
ursorPosX() + GetTreeNodeToLabelSpacing()); } | ||||
// OBSOLETED in 1.71 (from June 2019) | ||||
static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { Set | ||||
NextItemOpen(open, cond); } | ||||
// OBSOLETED in 1.70 (from May 2019) | ||||
static inline float GetContentRegionAvailWidth() { return GetContentR | ||||
egionAvail().x; } | ||||
// Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE) | // Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE) | |||
//static inline ImDrawList* GetOverlayDrawList() { return GetFore | //static inline void TreeAdvanceToLabelPos() { SetCursorPosX( | |||
groundDrawList(); } // OBSOLETED in 1.69 (from Mar 2019) | GetCursorPosX() + GetTreeNodeToLabelSpacing()); } // OBSOLETED in 1.72 (from J | |||
//static inline void SetScrollHere(float ratio = 0.5f) { SetScrollHereY | uly 2019) | |||
(ratio); } // OBSOLETED in 1.66 (from Nov 2018) | //static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { S | |||
//static inline bool IsItemDeactivatedAfterChange() { return IsItemD | etNextItemOpen(open, cond); } // OBSOLETED in 1.71 (from J | |||
eactivatedAfterEdit(); } // OBSOLETED in 1.63 (from Aug 2018) | une 2019) | |||
//static inline bool IsAnyWindowFocused() { return IsWindo | //static inline float GetContentRegionAvailWidth() { return GetCont | |||
wFocused(ImGuiFocusedFlags_AnyWindow); } // OBSOLETED in 1.60 (from Apr 2018) | entRegionAvail().x; } // OBSOLETED in 1.70 (from M | |||
//static inline bool IsAnyWindowHovered() { return IsWindo | ay 2019) | |||
wHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.60 (between Dec 20 | //static inline ImDrawList* GetOverlayDrawList() { return GetFore | |||
17 and Apr 2018) | groundDrawList(); } // OBSOLETED in 1.69 (from M | |||
//static inline void ShowTestWindow() { return ShowDem | ar 2019) | |||
oWindow(); } // OBSOLETED in 1.53 (between Oct 20 | //static inline void SetScrollHere(float ratio = 0.5f) { SetScrollHereY | |||
17 and Dec 2017) | (ratio); } // OBSOLETED in 1.66 (from N | |||
//static inline bool IsRootWindowFocused() { return IsWindo | ov 2018) | |||
wFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETED in 1.53 (between Oct 20 | //static inline bool IsItemDeactivatedAfterChange() { return IsItemD | |||
17 and Dec 2017) | eactivatedAfterEdit(); } // OBSOLETED in 1.63 (from A | |||
//static inline bool IsRootWindowOrAnyChildFocused() { return IsWindo | ug 2018) | |||
wFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between | //static inline bool IsAnyWindowFocused() { return IsWindo | |||
Oct 2017 and Dec 2017) | wFocused(ImGuiFocusedFlags_AnyWindow); } // OBSOLETED in 1.60 (from A | |||
//static inline void SetNextWindowContentWidth(float w) { SetNextWindowC | pr 2018) | |||
ontentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (between Oct 20 | //static inline bool IsAnyWindowHovered() { return IsWindo | |||
17 and Dec 2017) | wHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.60 (betwee | |||
//static inline float GetItemsLineHeightWithSpacing() { return GetFram | n Dec 2017 and Apr 2018) | |||
eHeightWithSpacing(); } // OBSOLETED in 1.53 (between Oct 20 | //static inline void ShowTestWindow() { return ShowDem | |||
17 and Dec 2017) | oWindow(); } // OBSOLETED in 1.53 (betwee | |||
n Oct 2017 and Dec 2017) | ||||
//static inline bool IsRootWindowFocused() { return IsWindo | ||||
wFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETED in 1.53 (betwee | ||||
n Oct 2017 and Dec 2017) | ||||
//static inline bool IsRootWindowOrAnyChildFocused() { return IsWindo | ||||
wFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (betwee | ||||
n Oct 2017 and Dec 2017) | ||||
//static inline void SetNextWindowContentWidth(float w) { SetNextWindowC | ||||
ontentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (betwee | ||||
n Oct 2017 and Dec 2017) | ||||
//static inline float GetItemsLineHeightWithSpacing() { return GetFram | ||||
eHeightWithSpacing(); } // OBSOLETED in 1.53 (betwee | ||||
n Oct 2017 and Dec 2017) | ||||
} | } | |||
// OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), Add ImageRounded(), PathRect() | // OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), Add ImageRounded(), PathRect() | |||
typedef ImDrawFlags ImDrawCornerFlags; | typedef ImDrawFlags ImDrawCornerFlags; | |||
enum ImDrawCornerFlags_ | enum ImDrawCornerFlags_ | |||
{ | { | |||
ImDrawCornerFlags_None = ImDrawFlags_RoundCornersNone, // Was = = 0 prior to 1.82, this is now == ImDrawFlags_RoundCornersNone which is != 0 and not implicit | ImDrawCornerFlags_None = ImDrawFlags_RoundCornersNone, // Was = = 0 prior to 1.82, this is now == ImDrawFlags_RoundCornersNone which is != 0 and not implicit | |||
ImDrawCornerFlags_TopLeft = ImDrawFlags_RoundCornersTopLeft, // Was = = 0x01 (1 << 0) prior to 1.82. Order matches ImDrawFlags_NoRoundCorner* flag (we exploit this internally). | ImDrawCornerFlags_TopLeft = ImDrawFlags_RoundCornersTopLeft, // Was = = 0x01 (1 << 0) prior to 1.82. Order matches ImDrawFlags_NoRoundCorner* flag (we exploit this internally). | |||
ImDrawCornerFlags_TopRight = ImDrawFlags_RoundCornersTopRight, // Was = = 0x02 (1 << 1) prior to 1.82. | ImDrawCornerFlags_TopRight = ImDrawFlags_RoundCornersTopRight, // Was = = 0x02 (1 << 1) prior to 1.82. | |||
ImDrawCornerFlags_BotLeft = ImDrawFlags_RoundCornersBottomLeft, // Was = = 0x04 (1 << 2) prior to 1.82. | ImDrawCornerFlags_BotLeft = ImDrawFlags_RoundCornersBottomLeft, // Was = = 0x04 (1 << 2) prior to 1.82. | |||
End of changes. 53 change blocks. | ||||
291 lines changed or deleted | 502 lines changed or added |