some cosmetics and PushStyleColor overload name

This commit is contained in:
sonoro1234
2018-06-20 11:42:19 +02:00
parent a4b061f8c7
commit 77cf5fc1e3
7 changed files with 1665 additions and 1577 deletions

View File

@@ -276,7 +276,7 @@ CIMGUI_API void igPushStyleColorU32(ImGuiCol idx,ImU32 col)
{ {
return ImGui::PushStyleColor(idx,col); return ImGui::PushStyleColor(idx,col);
} }
CIMGUI_API void igPushStyleColorVec4(ImGuiCol idx,const ImVec4 col) CIMGUI_API void igPushStyleColor(ImGuiCol idx,const ImVec4 col)
{ {
return ImGui::PushStyleColor(idx,col); return ImGui::PushStyleColor(idx,col);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -46,6 +46,7 @@ CIMGUI_API void igLogText(CONST char *fmt, ...);
//no appendfV //no appendfV
CIMGUI_API void ImGuiTextBuffer_appendf(struct ImGuiTextBuffer *buffer, const char *fmt, ...); CIMGUI_API void ImGuiTextBuffer_appendf(struct ImGuiTextBuffer *buffer, const char *fmt, ...);
CIMGUI_API void ImFontConfig_DefaultConstructor(ImFontConfig *config); CIMGUI_API void ImFontConfig_DefaultConstructor(ImFontConfig *config);
//for getting FLT_MAX in bindings
CIMGUI_API float igGET_FLT_MAX(); CIMGUI_API float igGET_FLT_MAX();

View File

@@ -1,21 +1,24 @@
rem this is used to rebuild imgui_structs.h :: this is used to rebuild cimgui.h and cimgui.cpp and must be executed in this directory
rem set your PATH if necessary for gcc and lua with:
:: set your PATH if necessary for gcc and lua 5.1 or luajit with:
set PATH=%PATH%;C:\mingw32\bin;C:\luaGL; set PATH=%PATH%;C:\mingw32\bin;C:\luaGL;
rem gcc -E -C -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h | luajit.exe ./generator.lua > out.txt :: gcc -E preprocesor striped comments
rem gcc -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h | luajit.exe ./generator.lua > out.txt :: gcc -E -C //comments but not /* and multiple spaces to one
rem gcc -E -CC -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > imgui_structs2.raw :: gcc -E -CC // and /* comments
:: gcc -E -C -traditional-cpp // coments and respects multiple spaces
:: gcc -E -P no #pragma location information
gcc -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_APIX="" ../../imgui/imgui.h ../../imgui/examples/imgui_impl_glfw.h ../../imgui/examples/imgui_impl_opengl3.h > 1.txt ::generate preprocessed file
gcc -E -C -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_APIX="" ../../imgui/imgui.h ../../imgui/examples/imgui_impl_glfw.h ../../imgui/examples/imgui_impl_opengl3.h > 1.txt
::process preprocessed file
type 1.txt | luajit.exe ./generator.lua true imgui imgui_impl_glfw imgui_impl_opengl3 > out.txt type 1.txt | luajit.exe ./generator.lua true imgui imgui_impl_glfw imgui_impl_opengl3 > out.txt
rem gcc -E -C -traditional-cpp -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1Ctra.txt ::copy cimgui.h and cimgui.cpp
rem type 1CTra.txt | luajit.exe ./generator.lua true > out.txt copy .\cimgui.h ..\cimgui.h
copy .\cimgui.cpp ..\cimgui.cpp
rem gcc -E -P -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1P.txt
rem type 1C.txt | luajit.exe ./generator.lua > out.txt
::leave console open
cmd /k cmd /k

View File

@@ -47,6 +47,9 @@ local cimgui_overloads = {
}, },
igSelectable = { igSelectable = {
["(const char*,bool,ImGuiSelectableFlags,const ImVec2)"] = "igSelectable" ["(const char*,bool,ImGuiSelectableFlags,const ImVec2)"] = "igSelectable"
},
igPushStyleColor = {
["(ImGuiCol,const ImVec4)"] = "igPushStyleColor"
} }
} }
-------------------------------------------------------------------------- --------------------------------------------------------------------------
@@ -442,8 +445,9 @@ local function func_parser()
defT.retref = ret:match("&") defT.retref = ret:match("&")
end end
defsT[cimguiname][signature] = defT defsT[cimguiname][signature] = defT
end end
elseif line=="" and stname~="" then -- not funcdef must be comment
table.insert(cdefs,{stname=stname,comment=comment})
end end
end end
FP.alltypes = {} FP.alltypes = {}
@@ -611,6 +615,7 @@ local function func_header_generate(FP)
end end
table.insert(outtab,"#endif //CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n") table.insert(outtab,"#endif //CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n")
for _,t in ipairs(FP.cdefs) do for _,t in ipairs(FP.cdefs) do
if t.cimguiname then
local cimf = FP.defsT[t.cimguiname] local cimf = FP.defsT[t.cimguiname]
local def = cimf[t.signature] local def = cimf[t.signature]
local manual = get_manuals(def) local manual = get_manuals(def)
@@ -626,6 +631,9 @@ local function func_header_generate(FP)
table.insert(outtab,"CIMGUI_API".." "..def.ret.." "..(def.ov_cimguiname or def.cimguiname)..args..";"..addcoment.."\n") table.insert(outtab,"CIMGUI_API".." "..def.ret.." "..(def.ov_cimguiname or def.cimguiname)..args..";"..addcoment.."\n")
end end
end end
else --not cimguiname
table.insert(outtab,t.comment:gsub("%%","%%%%").."\n")-- %% substitution for gsub
end
end end
--hfile:close() --hfile:close()
return outtab return outtab
@@ -634,6 +642,8 @@ local function func_implementation(FP)
--local cppfile = io.open("./auto_funcs2.cpp","w") --local cppfile = io.open("./auto_funcs2.cpp","w")
local outtab = {} local outtab = {}
for _,t in ipairs(FP.cdefs) do for _,t in ipairs(FP.cdefs) do
repeat -- continue simulation
if not t.cimguiname then break end
local cimf = FP.defsT[t.cimguiname] local cimf = FP.defsT[t.cimguiname]
local def = cimf[t.signature] local def = cimf[t.signature]
local manual = get_manuals(def) local manual = get_manuals(def)
@@ -685,6 +695,7 @@ local function func_implementation(FP)
end end
end end
end end
until true
end end
--cppfile:close() --cppfile:close()
return outtab return outtab
@@ -707,9 +718,9 @@ end
--output after insert --output after insert
local hfile = io.open("./outstructs.h","w") --local hfile = io.open("./outstructs.h","w")
hfile:write(table.concat(STP.lines,"\n")) --hfile:write(table.concat(STP.lines,"\n"))
hfile:close() --hfile:close()
--do return end --do return end
FP:compute_overloads() FP:compute_overloads()
@@ -722,15 +733,19 @@ local cfuncs = func_header_generate(FP)
local hfile = io.open("./cimgui_template.h","r") local hfile = io.open("./cimgui_template.h","r")
local hstrfile = hfile:read"*a" local hstrfile = hfile:read"*a"
hfile:close() hfile:close()
hstrfile = hstrfile:gsub([[#include "imgui_structs%.h"]],table.concat(cstructs)) local cstructsstr = table.concat(cstructs)
hstrfile = hstrfile:gsub([[#include "auto_funcs%.h"]],table.concat(cfuncs)) cstructsstr = cstructsstr:gsub("\n+","\n") --several empty lines to one empty line
hstrfile = hstrfile:gsub([[#include "imgui_structs%.h"]],cstructsstr)
local cfuncsstr = table.concat(cfuncs)
cfuncsstr = cfuncsstr:gsub("\n+","\n") --several empty lines to one empty line
hstrfile = hstrfile:gsub([[#include "auto_funcs%.h"]],cfuncsstr)
local outfile = io.open("./cimgui.h","w") local outfile = io.open("./cimgui.h","w")
outfile:write(hstrfile) outfile:write(hstrfile)
outfile:close() outfile:close()
local cimplem = func_implementation(FP)
--merge it in cimgui_template.cpp to cimgui.cpp --merge it in cimgui_template.cpp to cimgui.cpp
local cimplem = func_implementation(FP)
local hfile = io.open("./cimgui_template.cpp","r") local hfile = io.open("./cimgui_template.cpp","r")
local hstrfile = hfile:read"*a" local hstrfile = hfile:read"*a"
hfile:close() hfile:close()

View File

@@ -5,5 +5,9 @@ set PATH=%PATH%;C:\luaGL;
rem type ..\..\imgui\imgui.h | luajit.exe ./generator.lua false > out.txt rem type ..\..\imgui\imgui.h | luajit.exe ./generator.lua false > out.txt
type ..\..\imgui\imgui.h ..\..\imgui\examples\imgui_impl_glfw.h ..\..\imgui\examples\imgui_impl_opengl3.h | luajit.exe ./generator.lua false > out.txt type ..\..\imgui\imgui.h ..\..\imgui\examples\imgui_impl_glfw.h ..\..\imgui\examples\imgui_impl_opengl3.h | luajit.exe ./generator.lua false > out.txt
::copy cimgui.h and cimgui.cpp
copy .\cimgui.h ..\cimgui.h
copy .\cimgui.cpp ..\cimgui.cpp
cmd /k cmd /k