Skip to content

Commit

Permalink
Updated to Dear ImGui 1.89.9
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Jun 2, 2024
1 parent 9a23309 commit d6eaf73
Show file tree
Hide file tree
Showing 21 changed files with 15,513 additions and 7,597 deletions.
3 changes: 2 additions & 1 deletion imgui/api/imgui.script_api
Original file line number Diff line number Diff line change
Expand Up @@ -1915,13 +1915,14 @@
- name: INPUTFLAGS_ALLOWTABINPUT
- name: INPUTFLAGS_CTRLENTERFORNEWLINE
- name: INPUTFLAGS_NOHORIZONTALSCROLL
- name: INPUTFLAGS_ALWAYSINSERTMODE
- name: INPUTFLAGS_ALWAYSOVERWRITE
- name: INPUTFLAGS_READONLY
- name: INPUTFLAGS_PASSWORD
- name: INPUTFLAGS_NOUNDOREDO
- name: INPUTFLAGS_CHARSSCIENTIFIC
- name: INPUTFLAGS_CALLBACKRESIZE
- name: INPUTFLAGS_CALLBACKEDIT
- name: INPUTFLAGS_ESCAPECLEARSALL

- name: COND_NONE
- name: COND_ALWAYS
Expand Down
8 changes: 4 additions & 4 deletions imgui/ext.manifest
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "DefoldImGui"

platforms:
x86-win32:
common:
context:
defines: ["STBI_NO_SIMD"]
flags: ["-std=c++11"]

x86_64-win32:
win32:
context:
defines: ["STBI_NO_SIMD"]
defines: ["STBI_NO_SIMD"]
44 changes: 37 additions & 7 deletions imgui/src/extension_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ static int imgui_SetKeyboardFocusHere(lua_State* L)
// ----- STYLE ----------------
// ----------------------------


static int imgui_GetStyle(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 1);
Expand All @@ -1718,6 +1719,10 @@ static int imgui_GetStyle(lua_State* L)
lua_pushnumber(L, style.Alpha);
lua_rawset(L, -3);

lua_pushliteral(L, "DisabledAlpha"); // float
lua_pushnumber(L, style.DisabledAlpha);
lua_rawset(L, -3);

lua_pushliteral(L, "WindowPadding"); // ImVec2
dmScript::PushVector3(L, dmVMath::Vector3(style.WindowPadding.x, style.WindowPadding.y, 0));
lua_rawset(L, -3);
Expand Down Expand Up @@ -1837,6 +1842,9 @@ static int imgui_GetStyle(lua_State* L)
lua_pushliteral(L, "SelectableTextAlign"); // ImVec2
dmScript::PushVector3(L, dmVMath::Vector3(style.SelectableTextAlign.x, style.SelectableTextAlign.y, 0));
lua_rawset(L, -3);
// float SeparatorTextBorderSize; // Thickkness of border in SeparatorText()
// ImVec2 SeparatorTextAlign; // Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center).
// ImVec2 SeparatorTextPadding; // Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y.

lua_pushliteral(L, "DisplayWindowPadding"); // ImVec2
dmScript::PushVector3(L, dmVMath::Vector3(style.DisplayWindowPadding.x, style.DisplayWindowPadding.y, 0));
Expand Down Expand Up @@ -1866,8 +1874,16 @@ static int imgui_GetStyle(lua_State* L)
lua_pushnumber(L, style.CurveTessellationTol);
lua_rawset(L, -3);

lua_pushliteral(L, "CircleSegmentMaxError"); // float
lua_pushnumber(L, style.CircleSegmentMaxError);
lua_pushliteral(L, "HoverStationaryDelay"); // float
lua_pushnumber(L, style.HoverStationaryDelay);
lua_rawset(L, -3);

lua_pushliteral(L, "HoverDelayShort"); // float
lua_pushnumber(L, style.HoverDelayShort);
lua_rawset(L, -3);

lua_pushliteral(L, "HoverDelayNormal"); // float
lua_pushnumber(L, style.HoverDelayNormal);
lua_rawset(L, -3);

return 1;
Expand All @@ -1889,6 +1905,10 @@ static int imgui_SetStyle(lua_State* L)
{
style.Alpha = luaL_checknumber(L, -1);
}
else if (strcmp(attr, "DisabledAlpha") == 0)
{
style.DisabledAlpha = luaL_checknumber(L, -1);
}
else if (strcmp(attr, "WindowPadding") == 0)
{
dmVMath::Vector3* v3 = dmScript::CheckVector3(L, -1);
Expand Down Expand Up @@ -2061,9 +2081,17 @@ static int imgui_SetStyle(lua_State* L)
{
style.CurveTessellationTol = luaL_checknumber(L, -1);
}
else if (strcmp(attr, "CircleSegmentMaxError") == 0)
else if (strcmp(attr, "HoverStationaryDelay") == 0)
{
style.HoverStationaryDelay = luaL_checknumber(L, -1);
}
else if (strcmp(attr, "HoverDelayShort") == 0)
{
style.HoverDelayShort = luaL_checknumber(L, -1);
}
else if (strcmp(attr, "HoverDelayNormal") == 0)
{
style.CircleSegmentMaxError = luaL_checknumber(L, -1);
style.HoverDelayNormal = luaL_checknumber(L, -1);
}
lua_pop(L, 1);
}
Expand Down Expand Up @@ -2466,9 +2494,10 @@ static void imgui_Init(float width, float height)

// init keymap list
// We will be sending the correct ImGuiKey_ enums from Lua
for (int i = 0; i < ImGuiKey_COUNT; i++)
for (int i = 0; i < 512; i++)
{
io.KeyMap[i] = i;
dmLogInfo("KEYMAP %d", i);
io.KeyMap[i] = 0;
}

ImGui_ImplOpenGL3_Init();
Expand Down Expand Up @@ -2939,13 +2968,14 @@ static void LuaInit(lua_State* L)
lua_setfieldstringint(L, "INPUTFLAGS_ALLOWTABINPUT", ImGuiInputTextFlags_AllowTabInput); // Pressing TAB input a '\t' character into the text field
lua_setfieldstringint(L, "INPUTFLAGS_CTRLENTERFORNEWLINE", ImGuiInputTextFlags_CtrlEnterForNewLine); // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
lua_setfieldstringint(L, "INPUTFLAGS_NOHORIZONTALSCROLL", ImGuiInputTextFlags_NoHorizontalScroll); // Disable following the cursor horizontally
lua_setfieldstringint(L, "INPUTFLAGS_ALWAYSINSERTMODE", ImGuiInputTextFlags_AlwaysInsertMode); // Insert mode
lua_setfieldstringint(L, "INPUTFLAGS_ALWAYSOVERWRITE", ImGuiInputTextFlags_AlwaysOverwrite); // Insert mode
lua_setfieldstringint(L, "INPUTFLAGS_READONLY", ImGuiInputTextFlags_ReadOnly); // Read-only mode
lua_setfieldstringint(L, "INPUTFLAGS_PASSWORD", ImGuiInputTextFlags_Password); // Password mode, display all characters as '*'
lua_setfieldstringint(L, "INPUTFLAGS_NOUNDOREDO", ImGuiInputTextFlags_NoUndoRedo); // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
lua_setfieldstringint(L, "INPUTFLAGS_CHARSSCIENTIFIC", ImGuiInputTextFlags_CharsScientific); // Allow 0123456789.+-*/eE (Scientific notation input)
lua_setfieldstringint(L, "INPUTFLAGS_CALLBACKRESIZE", ImGuiInputTextFlags_CallbackResize); // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
lua_setfieldstringint(L, "INPUTFLAGS_CALLBACKEDIT", ImGuiInputTextFlags_CallbackEdit); // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
lua_setfieldstringint(L, "INPUTFLAGS_ESCAPECLEARSALL", ImGuiInputTextFlags_EscapeClearsAll); // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)

lua_setfieldstringint(L, "COND_NONE", ImGuiCond_None); // No condition (always set the variable), same as _Always
lua_setfieldstringint(L, "COND_ALWAYS", ImGuiCond_Always); // No condition (always set the variable)
Expand Down
61 changes: 35 additions & 26 deletions imgui/src/imgui/imconfig.h
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//-----------------------------------------------------------------------------
// COMPILE-TIME OPTIONS FOR DEAR IMGUI
// DEAR IMGUI COMPILE-TIME OPTIONS
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
//-----------------------------------------------------------------------------
Expand All @@ -9,7 +9,7 @@
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
// Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
// Call IMGUI_CHECKVERSION() from your .cpp file to verify that the data structures your files are using are matching the ones imgui.cpp is using.
//-----------------------------------------------------------------------------

#pragma once
Expand Down Expand Up @@ -56,24 +56,28 @@
//#define IMGUI_API __declspec( dllexport )
//#define IMGUI_API __declspec( dllimport )

//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions.

//---- Disable all of Dear ImGui or don't implement standard windows.
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger window: ShowMetricsWindow() will be empty.
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88).

//---- Don't implement some functions to reduce linkage requirements.
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. (imm32.lib/.a)
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime).
//#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, IME).
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available

//---- Include imgui_user.h at the end of imgui.h as a convenience
//#define IMGUI_INCLUDE_IMGUI_USER_H
Expand All @@ -88,33 +92,43 @@
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if IMGUI_USE_STB_SPRINTF is defined.
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
//#define IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION // only disabled if IMGUI_USE_STB_SPRINTF is defined.

//---- Use stb_printf's faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
// Requires 'stb_sprintf.h' to be available in the include path. Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf.
// #define IMGUI_USE_STB_SPRINTF
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
//#define IMGUI_USE_STB_SPRINTF

//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
// On Windows you may use vcpkg with 'vcpkg install freetype' + 'vcpkg integrate install'.
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
//#define IMGUI_ENABLE_FREETYPE

//---- Use FreeType+lunasvg library to render OpenType SVG fonts (SVGinOT)
// Requires lunasvg headers to be available in the include path + program to be linked with the lunasvg library (not provided).
// Only works in combination with IMGUI_ENABLE_FREETYPE.
// (implementation is based on Freetype's rsvg-port.c which is licensed under CeCILL-C Free Software License Agreement)
//#define IMGUI_ENABLE_FREETYPE_LUNASVG

//---- Use stb_truetype to build and rasterize the font atlas (default)
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
//#define IMGUI_ENABLE_STB_TRUETYPE

//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
/*
#define IM_VEC2_CLASS_EXTRA \
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
#define IM_VEC2_CLASS_EXTRA \
constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \
operator MyVec2() const { return MyVec2(x,y); }
#define IM_VEC4_CLASS_EXTRA \
ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
#define IM_VEC4_CLASS_EXTRA \
constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \
operator MyVec4() const { return MyVec4(x,y,z,w); }
*/
//---- ...Or use Dear ImGui's own very basic math operators.
//#define IMGUI_DEFINE_MATH_OPERATORS

//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
Expand All @@ -128,23 +142,18 @@
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
//#define ImDrawCallback MyImDrawCallback

//---- Debug Tools: Macro to break in Debugger
//---- Debug Tools: Macro to break in Debugger (we provide a default implementation of this in the codebase)
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
//#define IM_DEBUG_BREAK IM_ASSERT(0)
//#define IM_DEBUG_BREAK __debugbreak()

//---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(),
// (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.)
// This adds a small runtime cost which is why it is not enabled by default.
//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX

//---- Debug Tools: Enable slower asserts
//#define IMGUI_DEBUG_PARANOID

//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
//---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files)
/*
namespace ImGui
{
void MyFunction(const char* name, const MyMatrix44& v);
void MyFunction(const char* name, MyMatrix44* mtx);
}
*/
Loading

0 comments on commit d6eaf73

Please sign in to comment.