diff --git a/README.md b/README.md index 00a8232..99ef23f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Notes: * you will need LuaJIT (https://github.com/LuaJIT/LuaJIT.git better 2.1 branch) or precompiled for linux/macOS/windows in https://luapower.com/luajit/download * you can use also a C++ compiler for doing preprocessing: gcc (In windows MinGW-W64-builds for example), clang or cl (MSVC) or not use a compiler (experimental nocompiler option) at all. (this repo was done with gcc) * update `imgui` folder to the version you desire. -* edit `generator/generator.bat` on windows, or `generator/generator.sh` on linux, to choose between gcc, clang, cl or nocompiler and to choose desired implementations. +* edit `generator/generator.bat` on windows, or `generator/generator.sh` on linux, to choose between gcc, clang, cl or nocompiler and to choose desired implementations and if imgui_internal is generated or no. * edit config_generator.lua for adding includes needed by your chosen implementations. * Run generator.bat or generator.sh with gcc, clang or cl and LuaJIT on your PATH. * as a result some files are generated: `cimgui.cpp` and `cimgui.h` for compiling and some lua/json files with information about the binding: `definitions.json` with function info, `structs_and_enums.json` with struct and enum info, `impl_definitions.json` with functions from the implementations info. diff --git a/cimgui.cpp b/cimgui.cpp index b255477..6a8b724 100644 --- a/cimgui.cpp +++ b/cimgui.cpp @@ -275,11 +275,11 @@ CIMGUI_API float igGetScrollMaxY() { return ImGui::GetScrollMaxY(); } -CIMGUI_API void igSetScrollXFloat(float scroll_x) +CIMGUI_API void igSetScrollX(float scroll_x) { return ImGui::SetScrollX(scroll_x); } -CIMGUI_API void igSetScrollYFloat(float scroll_y) +CIMGUI_API void igSetScrollY(float scroll_y) { return ImGui::SetScrollY(scroll_y); } @@ -291,11 +291,11 @@ CIMGUI_API void igSetScrollHereY(float center_y_ratio) { return ImGui::SetScrollHereY(center_y_ratio); } -CIMGUI_API void igSetScrollFromPosXFloat(float local_x,float center_x_ratio) +CIMGUI_API void igSetScrollFromPosX(float local_x,float center_x_ratio) { return ImGui::SetScrollFromPosX(local_x,center_x_ratio); } -CIMGUI_API void igSetScrollFromPosYFloat(float local_y,float center_y_ratio) +CIMGUI_API void igSetScrollFromPosY(float local_y,float center_y_ratio) { return ImGui::SetScrollFromPosY(local_y,center_y_ratio); } @@ -1072,7 +1072,7 @@ CIMGUI_API bool igOpenPopupOnItemClick(const char* str_id,ImGuiMouseButton mouse { return ImGui::OpenPopupOnItemClick(str_id,mouse_button); } -CIMGUI_API bool igIsPopupOpenStr(const char* str_id) +CIMGUI_API bool igIsPopupOpen(const char* str_id) { return ImGui::IsPopupOpen(str_id); } diff --git a/cimgui.h b/cimgui.h index a584ca3..2f62550 100644 --- a/cimgui.h +++ b/cimgui.h @@ -1842,12 +1842,12 @@ CIMGUI_API float igGetScrollX(void); CIMGUI_API float igGetScrollY(void); CIMGUI_API float igGetScrollMaxX(void); CIMGUI_API float igGetScrollMaxY(void); -CIMGUI_API void igSetScrollXFloat(float scroll_x); -CIMGUI_API void igSetScrollYFloat(float scroll_y); +CIMGUI_API void igSetScrollX(float scroll_x); +CIMGUI_API void igSetScrollY(float scroll_y); CIMGUI_API void igSetScrollHereX(float center_x_ratio); CIMGUI_API void igSetScrollHereY(float center_y_ratio); -CIMGUI_API void igSetScrollFromPosXFloat(float local_x,float center_x_ratio); -CIMGUI_API void igSetScrollFromPosYFloat(float local_y,float center_y_ratio); +CIMGUI_API void igSetScrollFromPosX(float local_x,float center_x_ratio); +CIMGUI_API void igSetScrollFromPosY(float local_y,float center_y_ratio); CIMGUI_API void igPushFont(ImFont* font); CIMGUI_API void igPopFont(void); CIMGUI_API void igPushStyleColorU32(ImGuiCol idx,ImU32 col); @@ -2032,7 +2032,7 @@ CIMGUI_API bool igBeginPopupContextVoid(const char* str_id,ImGuiMouseButton mous CIMGUI_API bool igBeginPopupModal(const char* name,bool* p_open,ImGuiWindowFlags flags); CIMGUI_API void igEndPopup(void); CIMGUI_API bool igOpenPopupOnItemClick(const char* str_id,ImGuiMouseButton mouse_button); -CIMGUI_API bool igIsPopupOpenStr(const char* str_id); +CIMGUI_API bool igIsPopupOpen(const char* str_id); CIMGUI_API void igCloseCurrentPopup(void); CIMGUI_API void igColumns(int count,const char* id,bool border); CIMGUI_API void igNextColumn(void); diff --git a/generator/generator.bat b/generator/generator.bat index e067e34..c752a4d 100644 --- a/generator/generator.bat +++ b/generator/generator.bat @@ -15,8 +15,9 @@ set PATH=%PATH%;C:\anima;C:\i686-7.2.0-release-posix-dwarf-rt_v5-rev1\mingw32\bi :: set PATH=%PATH%;C:\luaGL\sources\luajit-master\luajit-master\bin\mingw32;C:\mingw32\bin; ::process files :: arg[1] compiler name gcc, clang, cl or nocompiler -:: arg[2..n] name of implementations to generate -luajit ./generator.lua gcc glfw opengl3 opengl2 sdl +:: arg[2] imgui_internal functions generation: true or false +:: arg[3..n] name of implementations to generate +luajit ./generator.lua gcc true glfw opengl3 opengl2 sdl ::leave console open cmd /k diff --git a/generator/generator.lua b/generator/generator.lua index 81e6796..84ce28d 100644 --- a/generator/generator.lua +++ b/generator/generator.lua @@ -6,6 +6,7 @@ assert(_VERSION=='Lua 5.1',"Must use LuaJIT") assert(bit,"Must use LuaJIT") local script_args = {...} local COMPILER = script_args[1] +local INTERNAL_GENERATION = script_args[2]=="true" local CPRE,CTEST if COMPILER == "gcc" or COMPILER == "clang" then CPRE = COMPILER..[[ -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ]] @@ -39,7 +40,7 @@ end --CTEST print("HAVE_COMPILER",HAVE_COMPILER) --get implementations local implementations = {} -for i=2,#script_args do table.insert(implementations,script_args[i]) end +for i=3,#script_args do table.insert(implementations,script_args[i]) end -------------------------------------------------------------------------- --this table has the functions to be skipped in generation @@ -88,7 +89,22 @@ local cimgui_overloads = { }, igPushStyleColor = { ["(ImGuiCol,const ImVec4)"] = "igPushStyleColor" - } + }, + igSetScrollFromPosX = { + ["(float,float)"] = "igSetScrollFromPosX" + }, + igSetScrollFromPosY = { + ["(float,float)"] = "igSetScrollFromPosY" + }, + igSetScrollX = { + ["(float)"] = "igSetScrollX" + }, + igSetScrollY = { + ["(float)"] = "igSetScrollY" + }, + igIsPopupOpen ={ + ["(const char*)"] = "igIsPopupOpen" + }, } --------------------------header definitions @@ -582,12 +598,17 @@ local function parseImGuiHeader(header,names) end --generation print("------------------generation with "..COMPILER.."------------------------") -save_data("headers.h",[[#include "../imgui/imgui.h" -#include "../imgui/imgui_internal.h"]]) -local parser1 = parseImGuiHeader([[headers.h]],{[[imgui]],[[imgui_internal]],[[imstb_textedit]]}) ---local parser1 = parseImGuiHeader([[../imgui/imgui.h]],{[[imgui]]}) +local parser1 +if INTERNAL_GENERATION then + save_data("headers.h",[[#include "../imgui/imgui.h" + #include "../imgui/imgui_internal.h"]]) + parser1 = parseImGuiHeader([[headers.h]],{[[imgui]],[[imgui_internal]],[[imstb_textedit]]}) + os.remove("headers.h") +else + parser1 = parseImGuiHeader([[../imgui/imgui.h]],{[[imgui]]}) +end parser1:do_parse() -os.remove("headers.h") + ---------- generate cimgui_internal.h --[=[ local parser1i = parseImGuiHeader([[../imgui/imgui_internal.h]],{[[imgui_internal]],[[imstb_textedit]]}) diff --git a/generator/generator.sh b/generator/generator.sh index d4e05a2..cd8678e 100755 --- a/generator/generator.sh +++ b/generator/generator.sh @@ -13,5 +13,6 @@ #process files # arg[1] compiler name gcc, clang, cl or nocompiler -# arg[2..n] name of implementations to generate -luajit ./generator.lua gcc glfw opengl3 opengl2 sdl +# arg[2] imgui_internal functions generation: true or false +# arg[3..n] name of implementations to generate +luajit ./generator.lua gcc true glfw opengl3 opengl2 sdl diff --git a/generator/output/cimgui.cpp b/generator/output/cimgui.cpp index b255477..6a8b724 100644 --- a/generator/output/cimgui.cpp +++ b/generator/output/cimgui.cpp @@ -275,11 +275,11 @@ CIMGUI_API float igGetScrollMaxY() { return ImGui::GetScrollMaxY(); } -CIMGUI_API void igSetScrollXFloat(float scroll_x) +CIMGUI_API void igSetScrollX(float scroll_x) { return ImGui::SetScrollX(scroll_x); } -CIMGUI_API void igSetScrollYFloat(float scroll_y) +CIMGUI_API void igSetScrollY(float scroll_y) { return ImGui::SetScrollY(scroll_y); } @@ -291,11 +291,11 @@ CIMGUI_API void igSetScrollHereY(float center_y_ratio) { return ImGui::SetScrollHereY(center_y_ratio); } -CIMGUI_API void igSetScrollFromPosXFloat(float local_x,float center_x_ratio) +CIMGUI_API void igSetScrollFromPosX(float local_x,float center_x_ratio) { return ImGui::SetScrollFromPosX(local_x,center_x_ratio); } -CIMGUI_API void igSetScrollFromPosYFloat(float local_y,float center_y_ratio) +CIMGUI_API void igSetScrollFromPosY(float local_y,float center_y_ratio) { return ImGui::SetScrollFromPosY(local_y,center_y_ratio); } @@ -1072,7 +1072,7 @@ CIMGUI_API bool igOpenPopupOnItemClick(const char* str_id,ImGuiMouseButton mouse { return ImGui::OpenPopupOnItemClick(str_id,mouse_button); } -CIMGUI_API bool igIsPopupOpenStr(const char* str_id) +CIMGUI_API bool igIsPopupOpen(const char* str_id) { return ImGui::IsPopupOpen(str_id); } diff --git a/generator/output/cimgui.h b/generator/output/cimgui.h index a584ca3..2f62550 100644 --- a/generator/output/cimgui.h +++ b/generator/output/cimgui.h @@ -1842,12 +1842,12 @@ CIMGUI_API float igGetScrollX(void); CIMGUI_API float igGetScrollY(void); CIMGUI_API float igGetScrollMaxX(void); CIMGUI_API float igGetScrollMaxY(void); -CIMGUI_API void igSetScrollXFloat(float scroll_x); -CIMGUI_API void igSetScrollYFloat(float scroll_y); +CIMGUI_API void igSetScrollX(float scroll_x); +CIMGUI_API void igSetScrollY(float scroll_y); CIMGUI_API void igSetScrollHereX(float center_x_ratio); CIMGUI_API void igSetScrollHereY(float center_y_ratio); -CIMGUI_API void igSetScrollFromPosXFloat(float local_x,float center_x_ratio); -CIMGUI_API void igSetScrollFromPosYFloat(float local_y,float center_y_ratio); +CIMGUI_API void igSetScrollFromPosX(float local_x,float center_x_ratio); +CIMGUI_API void igSetScrollFromPosY(float local_y,float center_y_ratio); CIMGUI_API void igPushFont(ImFont* font); CIMGUI_API void igPopFont(void); CIMGUI_API void igPushStyleColorU32(ImGuiCol idx,ImU32 col); @@ -2032,7 +2032,7 @@ CIMGUI_API bool igBeginPopupContextVoid(const char* str_id,ImGuiMouseButton mous CIMGUI_API bool igBeginPopupModal(const char* name,bool* p_open,ImGuiWindowFlags flags); CIMGUI_API void igEndPopup(void); CIMGUI_API bool igOpenPopupOnItemClick(const char* str_id,ImGuiMouseButton mouse_button); -CIMGUI_API bool igIsPopupOpenStr(const char* str_id); +CIMGUI_API bool igIsPopupOpen(const char* str_id); CIMGUI_API void igCloseCurrentPopup(void); CIMGUI_API void igColumns(int count,const char* id,bool border); CIMGUI_API void igNextColumn(void); diff --git a/generator/output/definitions.json b/generator/output/definitions.json index 76b870f..e48f7a4 100644 --- a/generator/output/definitions.json +++ b/generator/output/definitions.json @@ -20336,7 +20336,7 @@ "defaults": [], "funcname": "IsPopupOpen", "namespace": "ImGui", - "ov_cimguiname": "igIsPopupOpenStr", + "ov_cimguiname": "igIsPopupOpen", "ret": "bool", "signature": "(const char*)", "stname": "" @@ -24258,7 +24258,7 @@ }, "funcname": "SetScrollFromPosX", "namespace": "ImGui", - "ov_cimguiname": "igSetScrollFromPosXFloat", + "ov_cimguiname": "igSetScrollFromPosX", "ret": "void", "signature": "(float,float)", "stname": "" @@ -24314,7 +24314,7 @@ }, "funcname": "SetScrollFromPosY", "namespace": "ImGui", - "ov_cimguiname": "igSetScrollFromPosYFloat", + "ov_cimguiname": "igSetScrollFromPosY", "ret": "void", "signature": "(float,float)", "stname": "" @@ -24410,7 +24410,7 @@ "defaults": [], "funcname": "SetScrollX", "namespace": "ImGui", - "ov_cimguiname": "igSetScrollXFloat", + "ov_cimguiname": "igSetScrollX", "ret": "void", "signature": "(float)", "stname": "" @@ -24454,7 +24454,7 @@ "defaults": [], "funcname": "SetScrollY", "namespace": "ImGui", - "ov_cimguiname": "igSetScrollYFloat", + "ov_cimguiname": "igSetScrollY", "ret": "void", "signature": "(float)", "stname": "" diff --git a/generator/output/definitions.lua b/generator/output/definitions.lua index 4218b6c..e1fc4fe 100644 --- a/generator/output/definitions.lua +++ b/generator/output/definitions.lua @@ -17147,7 +17147,7 @@ defs["igIsPopupOpen"][1]["cimguiname"] = "igIsPopupOpen" defs["igIsPopupOpen"][1]["defaults"] = {} defs["igIsPopupOpen"][1]["funcname"] = "IsPopupOpen" defs["igIsPopupOpen"][1]["namespace"] = "ImGui" -defs["igIsPopupOpen"][1]["ov_cimguiname"] = "igIsPopupOpenStr" +defs["igIsPopupOpen"][1]["ov_cimguiname"] = "igIsPopupOpen" defs["igIsPopupOpen"][1]["ret"] = "bool" defs["igIsPopupOpen"][1]["signature"] = "(const char*)" defs["igIsPopupOpen"][1]["stname"] = "" @@ -20444,7 +20444,7 @@ defs["igSetScrollFromPosX"][1]["defaults"] = {} defs["igSetScrollFromPosX"][1]["defaults"]["center_x_ratio"] = "0.5f" defs["igSetScrollFromPosX"][1]["funcname"] = "SetScrollFromPosX" defs["igSetScrollFromPosX"][1]["namespace"] = "ImGui" -defs["igSetScrollFromPosX"][1]["ov_cimguiname"] = "igSetScrollFromPosXFloat" +defs["igSetScrollFromPosX"][1]["ov_cimguiname"] = "igSetScrollFromPosX" defs["igSetScrollFromPosX"][1]["ret"] = "void" defs["igSetScrollFromPosX"][1]["signature"] = "(float,float)" defs["igSetScrollFromPosX"][1]["stname"] = "" @@ -20490,7 +20490,7 @@ defs["igSetScrollFromPosY"][1]["defaults"] = {} defs["igSetScrollFromPosY"][1]["defaults"]["center_y_ratio"] = "0.5f" defs["igSetScrollFromPosY"][1]["funcname"] = "SetScrollFromPosY" defs["igSetScrollFromPosY"][1]["namespace"] = "ImGui" -defs["igSetScrollFromPosY"][1]["ov_cimguiname"] = "igSetScrollFromPosYFloat" +defs["igSetScrollFromPosY"][1]["ov_cimguiname"] = "igSetScrollFromPosY" defs["igSetScrollFromPosY"][1]["ret"] = "void" defs["igSetScrollFromPosY"][1]["signature"] = "(float,float)" defs["igSetScrollFromPosY"][1]["stname"] = "" @@ -20570,7 +20570,7 @@ defs["igSetScrollX"][1]["cimguiname"] = "igSetScrollX" defs["igSetScrollX"][1]["defaults"] = {} defs["igSetScrollX"][1]["funcname"] = "SetScrollX" defs["igSetScrollX"][1]["namespace"] = "ImGui" -defs["igSetScrollX"][1]["ov_cimguiname"] = "igSetScrollXFloat" +defs["igSetScrollX"][1]["ov_cimguiname"] = "igSetScrollX" defs["igSetScrollX"][1]["ret"] = "void" defs["igSetScrollX"][1]["signature"] = "(float)" defs["igSetScrollX"][1]["stname"] = "" @@ -20608,7 +20608,7 @@ defs["igSetScrollY"][1]["cimguiname"] = "igSetScrollY" defs["igSetScrollY"][1]["defaults"] = {} defs["igSetScrollY"][1]["funcname"] = "SetScrollY" defs["igSetScrollY"][1]["namespace"] = "ImGui" -defs["igSetScrollY"][1]["ov_cimguiname"] = "igSetScrollYFloat" +defs["igSetScrollY"][1]["ov_cimguiname"] = "igSetScrollY" defs["igSetScrollY"][1]["ret"] = "void" defs["igSetScrollY"][1]["signature"] = "(float)" defs["igSetScrollY"][1]["stname"] = "" diff --git a/generator/output/overloads.txt b/generator/output/overloads.txt index 08f8472..12b3b4d 100644 --- a/generator/output/overloads.txt +++ b/generator/output/overloads.txt @@ -3,7 +3,7 @@ ImVector_resize 2 1 void ImVector_resize (int) 2 void ImVector_resizeT (int,const T) igSetScrollFromPosY 2 -1 void igSetScrollFromPosYFloat (float,float) +1 void igSetScrollFromPosY (float,float) 2 void igSetScrollFromPosYWindowPtr (ImGuiWindow*,float,float) ImVec4_ImVec4 2 1 nil ImVec4_ImVec4 () @@ -61,7 +61,7 @@ ImGuiStoragePair_ImGuiStoragePair 3 2 nil ImGuiStoragePair_ImGuiStoragePairFloat (ImGuiID,float) 3 nil ImGuiStoragePair_ImGuiStoragePairPtr (ImGuiID,void*) igSetScrollFromPosX 2 -1 void igSetScrollFromPosXFloat (float,float) +1 void igSetScrollFromPosX (float,float) 2 void igSetScrollFromPosXWindowPtr (ImGuiWindow*,float,float) igGetForegroundDrawList 2 1 ImDrawList* igGetForegroundDrawList () @@ -85,7 +85,7 @@ igCombo 3 2 bool igComboStr (const char*,int*,const char*,int) 3 bool igComboFnPtr (const char*,int*,bool(*)(void*,int,const char**),void*,int,int) igSetScrollY 2 -1 void igSetScrollYFloat (float) +1 void igSetScrollY (float) 2 void igSetScrollYWindowPtr (ImGuiWindow*,float) ImVector_erase 2 1 T* ImVector_erase (const T*) @@ -117,7 +117,7 @@ igMarkIniSettingsDirty 2 1 void igMarkIniSettingsDirty () 2 void igMarkIniSettingsDirtyWindowPtr (ImGuiWindow*) igIsPopupOpen 2 -1 bool igIsPopupOpenStr (const char*) +1 bool igIsPopupOpen (const char*) 2 bool igIsPopupOpenID (ImGuiID) ImVector_ImVector 2 1 nil ImVector_ImVector () @@ -200,7 +200,7 @@ igTreeNodeEx 3 2 bool igTreeNodeExStrStr (const char*,ImGuiTreeNodeFlags,const char*,...) 3 bool igTreeNodeExPtr (const void*,ImGuiTreeNodeFlags,const char*,...) igSetScrollX 2 -1 void igSetScrollXFloat (float) +1 void igSetScrollX (float) 2 void igSetScrollXWindowPtr (ImGuiWindow*,float) igMenuItem 2 1 bool igMenuItemBool (const char*,const char*,bool,bool)