some more additions

This commit is contained in:
sonoro1234
2018-06-16 17:49:16 +02:00
parent edafa5eea8
commit 567261806c
7 changed files with 34 additions and 11 deletions

View File

@@ -590,7 +590,7 @@ CIMGUI_API bool igRadioButtonIntPtr(const char* label,int* v,int v_but
{
return ImGui::RadioButton(label,v,v_button);
}
CIMGUI_API void igPlotLinesFloatPtr(const char* label,const float* values,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride)
CIMGUI_API void igPlotLines(const char* label,const float* values,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride)
{
return ImGui::PlotLines(label,values,values_count,values_offset,overlay_text,scale_min,scale_max,graph_size,stride);
}
@@ -622,7 +622,7 @@ CIMGUI_API void igEndCombo()
{
return ImGui::EndCombo();
}
CIMGUI_API bool igComboStr_arr(const char* label,int* current_item,const char* const items[],int items_count,int popup_max_height_in_items)
CIMGUI_API bool igCombo(const char* label,int* current_item,const char* const items[],int items_count,int popup_max_height_in_items)
{
return ImGui::Combo(label,current_item,items,items_count,popup_max_height_in_items);
}
@@ -1949,3 +1949,7 @@ CIMGUI_API void ImFontConfig_DefaultConstructor(ImFontConfig *config)
{
*config = ImFontConfig();
}
CIMGUI_API float igGET_FLT_MAX()
{
return FLT_MAX;
}

View File

@@ -1279,7 +1279,7 @@ CIMGUI_API bool igCheckbox(const char* label,bool* v);
CIMGUI_API bool igCheckboxFlags(const char* label,unsigned int* flags,unsigned int flags_value);
CIMGUI_API bool igRadioButtonBool(const char* label,bool active);
CIMGUI_API bool igRadioButtonIntPtr(const char* label,int* v,int v_button);
CIMGUI_API void igPlotLinesFloatPtr(const char* label,const float* values,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride);
CIMGUI_API void igPlotLines(const char* label,const float* values,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride);
CIMGUI_API void igPlotLinesFnPtr(const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size);
CIMGUI_API void igPlotHistogramFloatPtr(const char* label,const float* values,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride);
CIMGUI_API void igPlotHistogramFnPtr(const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size);
@@ -1287,7 +1287,7 @@ CIMGUI_API void igProgressBar(float fraction,const ImVec2 size_arg,con
CIMGUI_API void igBullet(); // draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
CIMGUI_API bool igBeginCombo(const char* label,const char* preview_value,ImGuiComboFlags flags);
CIMGUI_API void igEndCombo(); // only call EndCombo() if BeginCombo() returns true!
CIMGUI_API bool igComboStr_arr(const char* label,int* current_item,const char* const items[],int items_count,int popup_max_height_in_items);
CIMGUI_API bool igCombo(const char* label,int* current_item,const char* const items[],int items_count,int popup_max_height_in_items);
CIMGUI_API bool igComboStr(const char* label,int* current_item,const char* items_separated_by_zeros,int popup_max_height_in_items); // Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0"
CIMGUI_API bool igComboFnPtr(const char* label,int* current_item,bool(*items_getter)(void* data,int idx,const char** out_text),void* data,int items_count,int popup_max_height_in_items);
CIMGUI_API bool igDragFloat(const char* label,float* v,float v_speed,float v_min,float v_max,const char* display_format,float power); // If v_min >= v_max we have no bound
@@ -1617,4 +1617,6 @@ 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);
CIMGUI_API float igGET_FLT_MAX();

View File

@@ -28,3 +28,7 @@ CIMGUI_API void ImFontConfig_DefaultConstructor(ImFontConfig *config)
{
*config = ImFontConfig();
}
CIMGUI_API float igGET_FLT_MAX()
{
return FLT_MAX;
}

View File

@@ -44,4 +44,6 @@ 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);
CIMGUI_API float igGET_FLT_MAX();

View File

@@ -6,8 +6,9 @@ rem gcc -E -C -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h | luajit.e
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
rem gcc -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1.txt
rem gcc -E -CC -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1CC.txt
rem gcc -E -C -traditional-cpp -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1Ctra.txt
rem gcc -E -P -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1P.txt
type 1.txt | luajit.exe ./generator.lua > out.txt
rem type 1C.txt | luajit.exe ./generator.lua > out.txt
type 1CTra.txt | luajit.exe ./generator.lua > out.txt
cmd /k

View File

@@ -480,7 +480,7 @@ local function gen_structs_and_enums(cdefs)
local line, comment = split_comment(line)
local linelen = #line
local desired_linelen = (linelen==0) and 0 or math.max(math.ceil(linelen/10)*10,40)
local spaces_to_add = desired_linelen - linelen
local spaces_to_add = 0 --desired_linelen - linelen
local linecom = line..string.rep(" ",spaces_to_add)..comment
if line:match(namespace_re) then

View File

@@ -1,5 +1,6 @@
--------------------------------------------------------------------------
--script for auto_funcs.h and auto_funcs.cpp generation
--expects Lua 5.1 or luajit
--------------------------------------------------------------------------
--------------------------------------------------------------------------
@@ -28,8 +29,14 @@ local cimgui_overloads = {
["(ImGuiCol,float)"] = "igGetColorU32",
},
igCollapsingHeader = {
["(const char*,ImGuiTreeNodeFlags)"] = "igCollapsingHeader"
}
["(const char*,ImGuiTreeNodeFlags)"] = "igCollapsingHeader",
},
igCombo = {
["(const char*,int*,const char* const[],int,int)"] = "igCombo",
},
igPlotLines = {
["(const char*,const float*,int,int,const char*,float,float,ImVec2,int)"] = "igPlotLines",
},
}
--------------------------------------------------------------------------
--helper functions
@@ -405,12 +412,13 @@ local function func_parser()
local defT = defsT[cimguiname][#defsT[cimguiname]]
defT.defaults = {}
--for k,def in args:gmatch("([%w%s%*_]+)=([%w_%(%)%s,%*]+)[,%)]") do
for k,def in args:gmatch("([%w_]+)=([%w_%(%)%s,%*]+)[,%)]") do
for k,def in args:gmatch("([%w_]+)=([%w_%(%)%s,%*%.%-]+)[,%)]") do
defT.defaults[k]=def
end
defT.cimguiname = cimguiname
defT.stname = stname
defT.funcname = funcname
defT.argsoriginal = args
defT.args=argscsinpars
defT.signature = signature
defT.call_args = call_args
@@ -692,6 +700,7 @@ FP:compute_overloads()
local cstructs = gen_structs_and_enums(STP.lines)
local cfuncs = func_header_generate(FP)
--merge it in cimgui_template.h to cimgui.h
local hfile = io.open("./cimgui_template.h","r")
local hstrfile = hfile:read"*a"
@@ -713,13 +722,14 @@ local outfile = io.open("./cimgui.cpp","w")
outfile:write(hstrfile)
outfile:close()
----------save defs
----------save fundefs in definitions.lua for using in bindings
local hfile = io.open("./definitions.lua","w")
local ser = serializeTable("defs",FP.defsT)
hfile:write(ser.."\nreturn defs")
hfile:close()
---dump infos-----------------------------------------------------------------------
------------------------------------------------------------------------------------
print"//-------alltypes--------------------------------------------------------------------"