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);
}
CIMGUI_API void igPushStyleColorVec4(ImGuiCol idx,const ImVec4 col)
CIMGUI_API void igPushStyleColor(ImGuiCol idx,const ImVec4 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
CIMGUI_API void ImGuiTextBuffer_appendf(struct ImGuiTextBuffer *buffer, const char *fmt, ...);
CIMGUI_API void ImFontConfig_DefaultConstructor(ImFontConfig *config);
//for getting FLT_MAX in bindings
CIMGUI_API float igGET_FLT_MAX();

View File

@@ -1,21 +1,24 @@
rem this is used to rebuild imgui_structs.h
rem set your PATH if necessary for gcc and lua with:
:: this is used to rebuild cimgui.h and cimgui.cpp and must be executed in this directory
:: set your PATH if necessary for gcc and lua 5.1 or luajit with:
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
rem gcc -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h | luajit.exe ./generator.lua > out.txt
rem gcc -E -CC -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > imgui_structs2.raw
:: gcc -E preprocesor striped comments
:: gcc -E -C //comments but not /* and multiple spaces to one
:: 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
rem gcc -E -C -traditional-cpp -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1Ctra.txt
rem type 1CTra.txt | luajit.exe ./generator.lua true > out.txt
rem gcc -E -P -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1P.txt
rem type 1C.txt | luajit.exe ./generator.lua > out.txt
::copy cimgui.h and cimgui.cpp
copy .\cimgui.h ..\cimgui.h
copy .\cimgui.cpp ..\cimgui.cpp
::leave console open
cmd /k

View File

@@ -47,6 +47,9 @@ local cimgui_overloads = {
},
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("&")
end
defsT[cimguiname][signature] = defT
end
elseif line=="" and stname~="" then -- not funcdef must be comment
table.insert(cdefs,{stname=stname,comment=comment})
end
end
FP.alltypes = {}
@@ -611,6 +615,7 @@ local function func_header_generate(FP)
end
table.insert(outtab,"#endif //CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n")
for _,t in ipairs(FP.cdefs) do
if t.cimguiname then
local cimf = FP.defsT[t.cimguiname]
local def = cimf[t.signature]
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")
end
end
else --not cimguiname
table.insert(outtab,t.comment:gsub("%%","%%%%").."\n")-- %% substitution for gsub
end
end
--hfile:close()
return outtab
@@ -634,6 +642,8 @@ local function func_implementation(FP)
--local cppfile = io.open("./auto_funcs2.cpp","w")
local outtab = {}
for _,t in ipairs(FP.cdefs) do
repeat -- continue simulation
if not t.cimguiname then break end
local cimf = FP.defsT[t.cimguiname]
local def = cimf[t.signature]
local manual = get_manuals(def)
@@ -685,6 +695,7 @@ local function func_implementation(FP)
end
end
end
until true
end
--cppfile:close()
return outtab
@@ -707,9 +718,9 @@ end
--output after insert
local hfile = io.open("./outstructs.h","w")
hfile:write(table.concat(STP.lines,"\n"))
hfile:close()
--local hfile = io.open("./outstructs.h","w")
--hfile:write(table.concat(STP.lines,"\n"))
--hfile:close()
--do return end
FP:compute_overloads()
@@ -722,15 +733,19 @@ local cfuncs = func_header_generate(FP)
local hfile = io.open("./cimgui_template.h","r")
local hstrfile = hfile:read"*a"
hfile:close()
hstrfile = hstrfile:gsub([[#include "imgui_structs%.h"]],table.concat(cstructs))
hstrfile = hstrfile:gsub([[#include "auto_funcs%.h"]],table.concat(cfuncs))
local cstructsstr = table.concat(cstructs)
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")
outfile:write(hstrfile)
outfile:close()
local cimplem = func_implementation(FP)
--merge it in cimgui_template.cpp to cimgui.cpp
local cimplem = func_implementation(FP)
local hfile = io.open("./cimgui_template.cpp","r")
local hstrfile = hfile:read"*a"
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
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