mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-10 03:48:30 +01:00
simplify generation and modify order saved
This commit is contained in:
@@ -2362,7 +2362,7 @@ CIMGUI_API ImVec2_Simple igGetMouseDragDelta_nonUDT2(int button,float lock_thres
|
||||
ImVec2_Simple ret2 = ImVec2ToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor* self,ImColor *pOut,float h,float s,float v,float a)
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor *pOut,ImColor* self,float h,float s,float v,float a)
|
||||
{
|
||||
*pOut = self->HSV(h,s,v,a);
|
||||
}
|
||||
@@ -2372,7 +2372,7 @@ CIMGUI_API ImColor_Simple ImColor_HSV_nonUDT2(ImColor* self,float h,float s,floa
|
||||
ImColor_Simple ret2 = ImColorToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImDrawList* self,ImVec2 *pOut)
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImVec2 *pOut,ImDrawList* self)
|
||||
{
|
||||
*pOut = self->GetClipRectMin();
|
||||
}
|
||||
@@ -2382,7 +2382,7 @@ CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMin_nonUDT2(ImDrawList* self)
|
||||
ImVec2_Simple ret2 = ImVec2ToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImDrawList* self,ImVec2 *pOut)
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImVec2 *pOut,ImDrawList* self)
|
||||
{
|
||||
*pOut = self->GetClipRectMax();
|
||||
}
|
||||
@@ -2392,7 +2392,7 @@ CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMax_nonUDT2(ImDrawList* self)
|
||||
ImVec2_Simple ret2 = ImVec2ToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImFont* self,ImVec2 *pOut,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining)
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining)
|
||||
{
|
||||
*pOut = self->CalcTextSizeA(size,max_width,wrap_width,text_begin,text_end,remaining);
|
||||
}
|
||||
|
8
cimgui.h
8
cimgui.h
@@ -1416,13 +1416,13 @@ CIMGUI_API void igGetMousePosOnOpeningCurrentPopup_nonUDT(ImVec2 *pOut);
|
||||
CIMGUI_API ImVec2_Simple igGetMousePosOnOpeningCurrentPopup_nonUDT2(void);
|
||||
CIMGUI_API void igGetMouseDragDelta_nonUDT(ImVec2 *pOut,int button,float lock_threshold);
|
||||
CIMGUI_API ImVec2_Simple igGetMouseDragDelta_nonUDT2(int button,float lock_threshold);
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor* self,ImColor *pOut,float h,float s,float v,float a);
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor *pOut,ImColor* self,float h,float s,float v,float a);
|
||||
CIMGUI_API ImColor_Simple ImColor_HSV_nonUDT2(ImColor* self,float h,float s,float v,float a);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImDrawList* self,ImVec2 *pOut);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImVec2 *pOut,ImDrawList* self);
|
||||
CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMin_nonUDT2(ImDrawList* self);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImDrawList* self,ImVec2 *pOut);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImVec2 *pOut,ImDrawList* self);
|
||||
CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMax_nonUDT2(ImDrawList* self);
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImFont* self,ImVec2 *pOut,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining);
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining);
|
||||
CIMGUI_API ImVec2_Simple ImFont_CalcTextSizeA_nonUDT2(ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining);
|
||||
|
||||
|
||||
|
@@ -301,15 +301,28 @@ local function serializeTable(name, value, saved)
|
||||
table.insert(string_table,saved[value].."\n")
|
||||
else
|
||||
saved[value] = name -- save name for next time
|
||||
table.insert(string_table, "{}\n")
|
||||
table.insert(string_table, "{}\n")
|
||||
---[[
|
||||
local ordered_keys = {}
|
||||
for k,v in pairs(value) do
|
||||
table.insert(ordered_keys,k)
|
||||
end
|
||||
table.sort(ordered_keys,function(a,b) return tostring(a)<tostring(b) end)
|
||||
--for k,v in pairs(value) do -- save its fields
|
||||
for _,k in ipairs(ordered_keys) do
|
||||
local function sorter(a,b)
|
||||
if type(a)==type(b) then
|
||||
return a<b
|
||||
elseif type(a)=="number" then
|
||||
return true
|
||||
else
|
||||
assert(type(b)=="number")
|
||||
return false
|
||||
end
|
||||
end
|
||||
table.sort(ordered_keys,sorter)
|
||||
for _,k in ipairs(ordered_keys) do
|
||||
local v = value[k]
|
||||
--]]
|
||||
-- for k,v in pairs(value) do -- save its fields
|
||||
|
||||
local fieldname = string.format("%s[%s]", name,basicSerialize(k))
|
||||
table.insert(string_table, serializeTable(fieldname, v, saved))
|
||||
end
|
||||
@@ -1238,8 +1251,8 @@ local function func_header_generate(FP)
|
||||
else
|
||||
--local imgui_stname = embeded_structs[def.stname] or def.stname
|
||||
local imgui_stname = def.stname
|
||||
local args = def.args:gsub("^%(","("..imgui_stname.."* self"..(empty and "" or ","))
|
||||
table.insert(outtab,"CIMGUI_API "..def.ret.." "..(def.ov_cimguiname or def.cimguiname)..args..";"..addcoment.."\n")
|
||||
--local args = def.args:gsub("^%(","("..imgui_stname.."* self"..(empty and "" or ","))
|
||||
table.insert(outtab,"CIMGUI_API "..def.ret.." "..(def.ov_cimguiname or def.cimguiname)..def.args..";"..addcoment.."\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1287,8 +1300,8 @@ local function struct_f_implementation(outtab,def)
|
||||
local ptret = def.retref and "&" or ""
|
||||
--local imgui_stname = embeded_structs[def.stname] or def.stname
|
||||
local imgui_stname = def.stname
|
||||
local args = def.args:gsub("^%(","("..imgui_stname.."* self"..(empty and "" or ","))
|
||||
table.insert(outtab,"CIMGUI_API".." "..def.ret.." "..(def.ov_cimguiname or def.cimguiname)..args.."\n")
|
||||
--local args = def.args:gsub("^%(","("..imgui_stname.."* self"..(empty and "" or ","))
|
||||
table.insert(outtab,"CIMGUI_API".." "..def.ret.." "..(def.ov_cimguiname or def.cimguiname)..def.args.."\n")
|
||||
table.insert(outtab,"{\n")
|
||||
if def.isvararg then
|
||||
local call_args = def.call_args:gsub("%.%.%.","args")
|
||||
@@ -1435,6 +1448,20 @@ local function DefsByStruct(FP)
|
||||
end
|
||||
FP.defsBystruct = struct
|
||||
end
|
||||
local function AdjustArguments(FP)
|
||||
for fun,defs in pairs(FP.defsT) do
|
||||
--struct function but no constructors
|
||||
if defs[1].stname~="ImGui" and defs[1].stname~="" and defs[1].ret then
|
||||
--print("adjusting",fun)
|
||||
for i,def in ipairs(defs) do
|
||||
local empty = def.args:match("^%(%)") --no args
|
||||
--local ptret = def.retref and "&" or ""
|
||||
def.args = def.args:gsub("^%(","("..def.stname.."* self"..(empty and "" or ","))
|
||||
table.insert(def.argsT,1,{type=def.stname.."*",name="self"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--generate cimgui.cpp cimgui.h and auto versions depending on postfix
|
||||
local function cimgui_generation(postfix,STP,FP)
|
||||
--get all ImVector templates
|
||||
@@ -1517,6 +1544,7 @@ end
|
||||
pipe:close()
|
||||
|
||||
local ovstr = pFP:compute_overloads()
|
||||
AdjustArguments(pFP)
|
||||
ADDnonUDT(pFP)
|
||||
ADDdestructors(pFP)
|
||||
--DefsByStruct(pFP)
|
||||
|
@@ -2362,7 +2362,7 @@ CIMGUI_API ImVec2_Simple igGetMouseDragDelta_nonUDT2(int button,float lock_thres
|
||||
ImVec2_Simple ret2 = ImVec2ToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor* self,ImColor *pOut,float h,float s,float v,float a)
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor *pOut,ImColor* self,float h,float s,float v,float a)
|
||||
{
|
||||
*pOut = self->HSV(h,s,v,a);
|
||||
}
|
||||
@@ -2372,7 +2372,7 @@ CIMGUI_API ImColor_Simple ImColor_HSV_nonUDT2(ImColor* self,float h,float s,floa
|
||||
ImColor_Simple ret2 = ImColorToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImDrawList* self,ImVec2 *pOut)
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImVec2 *pOut,ImDrawList* self)
|
||||
{
|
||||
*pOut = self->GetClipRectMin();
|
||||
}
|
||||
@@ -2382,7 +2382,7 @@ CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMin_nonUDT2(ImDrawList* self)
|
||||
ImVec2_Simple ret2 = ImVec2ToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImDrawList* self,ImVec2 *pOut)
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImVec2 *pOut,ImDrawList* self)
|
||||
{
|
||||
*pOut = self->GetClipRectMax();
|
||||
}
|
||||
@@ -2392,7 +2392,7 @@ CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMax_nonUDT2(ImDrawList* self)
|
||||
ImVec2_Simple ret2 = ImVec2ToSimple(ret);
|
||||
return ret2;
|
||||
}
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImFont* self,ImVec2 *pOut,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining)
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining)
|
||||
{
|
||||
*pOut = self->CalcTextSizeA(size,max_width,wrap_width,text_begin,text_end,remaining);
|
||||
}
|
||||
|
@@ -1416,13 +1416,13 @@ CIMGUI_API void igGetMousePosOnOpeningCurrentPopup_nonUDT(ImVec2 *pOut);
|
||||
CIMGUI_API ImVec2_Simple igGetMousePosOnOpeningCurrentPopup_nonUDT2(void);
|
||||
CIMGUI_API void igGetMouseDragDelta_nonUDT(ImVec2 *pOut,int button,float lock_threshold);
|
||||
CIMGUI_API ImVec2_Simple igGetMouseDragDelta_nonUDT2(int button,float lock_threshold);
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor* self,ImColor *pOut,float h,float s,float v,float a);
|
||||
CIMGUI_API void ImColor_HSV_nonUDT(ImColor *pOut,ImColor* self,float h,float s,float v,float a);
|
||||
CIMGUI_API ImColor_Simple ImColor_HSV_nonUDT2(ImColor* self,float h,float s,float v,float a);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImDrawList* self,ImVec2 *pOut);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMin_nonUDT(ImVec2 *pOut,ImDrawList* self);
|
||||
CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMin_nonUDT2(ImDrawList* self);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImDrawList* self,ImVec2 *pOut);
|
||||
CIMGUI_API void ImDrawList_GetClipRectMax_nonUDT(ImVec2 *pOut,ImDrawList* self);
|
||||
CIMGUI_API ImVec2_Simple ImDrawList_GetClipRectMax_nonUDT2(ImDrawList* self);
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImFont* self,ImVec2 *pOut,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining);
|
||||
CIMGUI_API void ImFont_CalcTextSizeA_nonUDT(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining);
|
||||
CIMGUI_API ImVec2_Simple ImFont_CalcTextSizeA_nonUDT2(ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining);
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user