mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-12 20:58:30 +01:00
cimgui with glfw and opengl3 implementations
This commit is contained in:
@@ -20,6 +20,10 @@ CIMGUI_API void igSetCurrentContext(ImGuiContext* ctx)
|
||||
{
|
||||
return ImGui::SetCurrentContext(ctx);
|
||||
}
|
||||
CIMGUI_API bool igDebugCheckVersionAndDataLayout(const char* version_str,size_t sz_io,size_t sz_style,size_t sz_vec2,size_t sz_vec4,size_t sz_drawvert)
|
||||
{
|
||||
return ImGui::DebugCheckVersionAndDataLayout(version_str,sz_io,sz_style,sz_vec2,sz_vec4,sz_drawvert);
|
||||
}
|
||||
CIMGUI_API ImGuiIO* igGetIO()
|
||||
{
|
||||
return &ImGui::GetIO();
|
||||
@@ -558,14 +562,14 @@ CIMGUI_API bool igSmallButton(const char* label)
|
||||
{
|
||||
return ImGui::SmallButton(label);
|
||||
}
|
||||
CIMGUI_API bool igArrowButton(const char* str_id,ImGuiDir dir)
|
||||
{
|
||||
return ImGui::ArrowButton(str_id,dir);
|
||||
}
|
||||
CIMGUI_API bool igInvisibleButton(const char* str_id,const ImVec2 size)
|
||||
{
|
||||
return ImGui::InvisibleButton(str_id,size);
|
||||
}
|
||||
CIMGUI_API bool igArrowButton(const char* str_id,ImGuiDir dir)
|
||||
{
|
||||
return ImGui::ArrowButton(str_id,dir);
|
||||
}
|
||||
CIMGUI_API void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col)
|
||||
{
|
||||
return ImGui::Image(user_texture_id,size,uv0,uv1,tint_col,border_col);
|
||||
@@ -634,45 +638,53 @@ CIMGUI_API bool igComboFnPtr(const char* label,int* current_item,bool(
|
||||
{
|
||||
return ImGui::Combo(label,current_item,items_getter,data,items_count,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)
|
||||
CIMGUI_API bool igDragFloat(const char* label,float* v,float v_speed,float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::DragFloat(label,v,v_speed,v_min,v_max,display_format,power);
|
||||
return ImGui::DragFloat(label,v,v_speed,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igDragFloat2(const char* label,float v[2],float v_speed,float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igDragFloat2(const char* label,float v[2],float v_speed,float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::DragFloat2(label,v,v_speed,v_min,v_max,display_format,power);
|
||||
return ImGui::DragFloat2(label,v,v_speed,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igDragFloat3(const char* label,float v[3],float v_speed,float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igDragFloat3(const char* label,float v[3],float v_speed,float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::DragFloat3(label,v,v_speed,v_min,v_max,display_format,power);
|
||||
return ImGui::DragFloat3(label,v,v_speed,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igDragFloat4(const char* label,float v[4],float v_speed,float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igDragFloat4(const char* label,float v[4],float v_speed,float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::DragFloat4(label,v,v_speed,v_min,v_max,display_format,power);
|
||||
return ImGui::DragFloat4(label,v,v_speed,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igDragFloatRange2(const char* label,float* v_current_min,float* v_current_max,float v_speed,float v_min,float v_max,const char* display_format,const char* display_format_max,float power)
|
||||
CIMGUI_API bool igDragFloatRange2(const char* label,float* v_current_min,float* v_current_max,float v_speed,float v_min,float v_max,const char* format,const char* format_max,float power)
|
||||
{
|
||||
return ImGui::DragFloatRange2(label,v_current_min,v_current_max,v_speed,v_min,v_max,display_format,display_format_max,power);
|
||||
return ImGui::DragFloatRange2(label,v_current_min,v_current_max,v_speed,v_min,v_max,format,format_max,power);
|
||||
}
|
||||
CIMGUI_API bool igDragInt(const char* label,int* v,float v_speed,int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igDragInt(const char* label,int* v,float v_speed,int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::DragInt(label,v,v_speed,v_min,v_max,display_format);
|
||||
return ImGui::DragInt(label,v,v_speed,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igDragInt2(const char* label,int v[2],float v_speed,int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igDragInt2(const char* label,int v[2],float v_speed,int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::DragInt2(label,v,v_speed,v_min,v_max,display_format);
|
||||
return ImGui::DragInt2(label,v,v_speed,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igDragInt3(const char* label,int v[3],float v_speed,int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igDragInt3(const char* label,int v[3],float v_speed,int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::DragInt3(label,v,v_speed,v_min,v_max,display_format);
|
||||
return ImGui::DragInt3(label,v,v_speed,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igDragInt4(const char* label,int v[4],float v_speed,int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igDragInt4(const char* label,int v[4],float v_speed,int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::DragInt4(label,v,v_speed,v_min,v_max,display_format);
|
||||
return ImGui::DragInt4(label,v,v_speed,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igDragIntRange2(const char* label,int* v_current_min,int* v_current_max,float v_speed,int v_min,int v_max,const char* display_format,const char* display_format_max)
|
||||
CIMGUI_API bool igDragIntRange2(const char* label,int* v_current_min,int* v_current_max,float v_speed,int v_min,int v_max,const char* format,const char* format_max)
|
||||
{
|
||||
return ImGui::DragIntRange2(label,v_current_min,v_current_max,v_speed,v_min,v_max,display_format,display_format_max);
|
||||
return ImGui::DragIntRange2(label,v_current_min,v_current_max,v_speed,v_min,v_max,format,format_max);
|
||||
}
|
||||
CIMGUI_API bool igDragScalar(const char* label,ImGuiDataType data_type,void* v,float v_speed,const void* v_min,const void* v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::DragScalar(label,data_type,v,v_speed,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igDragScalarN(const char* label,ImGuiDataType data_type,void* v,int components,float v_speed,const void* v_min,const void* v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::DragScalarN(label,data_type,v,components,v_speed,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igInputText(const char* label,char* buf,size_t buf_size,ImGuiInputTextFlags flags,ImGuiTextEditCallback callback,void* user_data)
|
||||
{
|
||||
@@ -682,21 +694,21 @@ CIMGUI_API bool igInputTextMultiline(const char* label,char* buf,size_
|
||||
{
|
||||
return ImGui::InputTextMultiline(label,buf,buf_size,size,flags,callback,user_data);
|
||||
}
|
||||
CIMGUI_API bool igInputFloat(const char* label,float* v,float step,float step_fast,int decimal_precision,ImGuiInputTextFlags extra_flags)
|
||||
CIMGUI_API bool igInputFloat(const char* label,float* v,float step,float step_fast,const char* format,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
return ImGui::InputFloat(label,v,step,step_fast,decimal_precision,extra_flags);
|
||||
return ImGui::InputFloat(label,v,step,step_fast,format,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igInputFloat2(const char* label,float v[2],int decimal_precision,ImGuiInputTextFlags extra_flags)
|
||||
CIMGUI_API bool igInputFloat2(const char* label,float v[2],const char* format,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
return ImGui::InputFloat2(label,v,decimal_precision,extra_flags);
|
||||
return ImGui::InputFloat2(label,v,format,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igInputFloat3(const char* label,float v[3],int decimal_precision,ImGuiInputTextFlags extra_flags)
|
||||
CIMGUI_API bool igInputFloat3(const char* label,float v[3],const char* format,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
return ImGui::InputFloat3(label,v,decimal_precision,extra_flags);
|
||||
return ImGui::InputFloat3(label,v,format,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igInputFloat4(const char* label,float v[4],int decimal_precision,ImGuiInputTextFlags extra_flags)
|
||||
CIMGUI_API bool igInputFloat4(const char* label,float v[4],const char* format,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
return ImGui::InputFloat4(label,v,decimal_precision,extra_flags);
|
||||
return ImGui::InputFloat4(label,v,format,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igInputInt(const char* label,int* v,int step,int step_fast,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
@@ -714,53 +726,73 @@ CIMGUI_API bool igInputInt4(const char* label,int v[4],ImGuiInputTextF
|
||||
{
|
||||
return ImGui::InputInt4(label,v,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igInputDouble(const char* label,double* v,double step,double step_fast,const char* display_format,ImGuiInputTextFlags extra_flags)
|
||||
CIMGUI_API bool igInputDouble(const char* label,double* v,double step,double step_fast,const char* format,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
return ImGui::InputDouble(label,v,step,step_fast,display_format,extra_flags);
|
||||
return ImGui::InputDouble(label,v,step,step_fast,format,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igSliderFloat(const char* label,float* v,float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igInputScalar(const char* label,ImGuiDataType data_type,void* v,const void* step,const void* step_fast,const char* format,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
return ImGui::SliderFloat(label,v,v_min,v_max,display_format,power);
|
||||
return ImGui::InputScalar(label,data_type,v,step,step_fast,format,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igSliderFloat2(const char* label,float v[2],float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igInputScalarN(const char* label,ImGuiDataType data_type,void* v,int components,const void* step,const void* step_fast,const char* format,ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
return ImGui::SliderFloat2(label,v,v_min,v_max,display_format,power);
|
||||
return ImGui::InputScalarN(label,data_type,v,components,step,step_fast,format,extra_flags);
|
||||
}
|
||||
CIMGUI_API bool igSliderFloat3(const char* label,float v[3],float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igSliderFloat(const char* label,float* v,float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::SliderFloat3(label,v,v_min,v_max,display_format,power);
|
||||
return ImGui::SliderFloat(label,v,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igSliderFloat4(const char* label,float v[4],float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igSliderFloat2(const char* label,float v[2],float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::SliderFloat4(label,v,v_min,v_max,display_format,power);
|
||||
return ImGui::SliderFloat2(label,v,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igSliderFloat3(const char* label,float v[3],float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::SliderFloat3(label,v,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igSliderFloat4(const char* label,float v[4],float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::SliderFloat4(label,v,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igSliderAngle(const char* label,float* v_rad,float v_degrees_min,float v_degrees_max)
|
||||
{
|
||||
return ImGui::SliderAngle(label,v_rad,v_degrees_min,v_degrees_max);
|
||||
}
|
||||
CIMGUI_API bool igSliderInt(const char* label,int* v,int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igSliderInt(const char* label,int* v,int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::SliderInt(label,v,v_min,v_max,display_format);
|
||||
return ImGui::SliderInt(label,v,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igSliderInt2(const char* label,int v[2],int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igSliderInt2(const char* label,int v[2],int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::SliderInt2(label,v,v_min,v_max,display_format);
|
||||
return ImGui::SliderInt2(label,v,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igSliderInt3(const char* label,int v[3],int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igSliderInt3(const char* label,int v[3],int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::SliderInt3(label,v,v_min,v_max,display_format);
|
||||
return ImGui::SliderInt3(label,v,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igSliderInt4(const char* label,int v[4],int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igSliderInt4(const char* label,int v[4],int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::SliderInt4(label,v,v_min,v_max,display_format);
|
||||
return ImGui::SliderInt4(label,v,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igVSliderFloat(const char* label,const ImVec2 size,float* v,float v_min,float v_max,const char* display_format,float power)
|
||||
CIMGUI_API bool igSliderScalar(const char* label,ImGuiDataType data_type,void* v,const void* v_min,const void* v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::VSliderFloat(label,size,v,v_min,v_max,display_format,power);
|
||||
return ImGui::SliderScalar(label,data_type,v,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igVSliderInt(const char* label,const ImVec2 size,int* v,int v_min,int v_max,const char* display_format)
|
||||
CIMGUI_API bool igSliderScalarN(const char* label,ImGuiDataType data_type,void* v,int components,const void* v_min,const void* v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::VSliderInt(label,size,v,v_min,v_max,display_format);
|
||||
return ImGui::SliderScalarN(label,data_type,v,components,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igVSliderFloat(const char* label,const ImVec2 size,float* v,float v_min,float v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::VSliderFloat(label,size,v,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igVSliderInt(const char* label,const ImVec2 size,int* v,int v_min,int v_max,const char* format)
|
||||
{
|
||||
return ImGui::VSliderInt(label,size,v,v_min,v_max,format);
|
||||
}
|
||||
CIMGUI_API bool igVSliderScalar(const char* label,const ImVec2 size,ImGuiDataType data_type,void* v,const void* v_min,const void* v_max,const char* format,float power)
|
||||
{
|
||||
return ImGui::VSliderScalar(label,size,data_type,v,v_min,v_max,format,power);
|
||||
}
|
||||
CIMGUI_API bool igColorEdit3(const char* label,float col[3],ImGuiColorEditFlags flags)
|
||||
{
|
||||
@@ -914,6 +946,14 @@ CIMGUI_API void igValueFloat(const char* prefix,float v,const char* fl
|
||||
{
|
||||
return ImGui::Value(prefix,v,float_format);
|
||||
}
|
||||
CIMGUI_API void igBeginTooltip()
|
||||
{
|
||||
return ImGui::BeginTooltip();
|
||||
}
|
||||
CIMGUI_API void igEndTooltip()
|
||||
{
|
||||
return ImGui::EndTooltip();
|
||||
}
|
||||
CIMGUI_API void igSetTooltip(const char* fmt,...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -925,14 +965,6 @@ CIMGUI_API void igSetTooltipV(const char* fmt,va_list args)
|
||||
{
|
||||
return ImGui::SetTooltipV(fmt,args);
|
||||
}
|
||||
CIMGUI_API void igBeginTooltip()
|
||||
{
|
||||
return ImGui::BeginTooltip();
|
||||
}
|
||||
CIMGUI_API void igEndTooltip()
|
||||
{
|
||||
return ImGui::EndTooltip();
|
||||
}
|
||||
CIMGUI_API bool igBeginMainMenuBar()
|
||||
{
|
||||
return ImGui::BeginMainMenuBar();
|
||||
@@ -1117,6 +1149,14 @@ CIMGUI_API bool igIsItemVisible()
|
||||
{
|
||||
return ImGui::IsItemVisible();
|
||||
}
|
||||
CIMGUI_API bool igIsItemDeactivated()
|
||||
{
|
||||
return ImGui::IsItemDeactivated();
|
||||
}
|
||||
CIMGUI_API bool igIsItemDeactivatedAfterChange()
|
||||
{
|
||||
return ImGui::IsItemDeactivatedAfterChange();
|
||||
}
|
||||
CIMGUI_API bool igIsAnyItemHovered()
|
||||
{
|
||||
return ImGui::IsAnyItemHovered();
|
||||
@@ -1305,6 +1345,22 @@ CIMGUI_API void igSetClipboardText(const char* text)
|
||||
{
|
||||
return ImGui::SetClipboardText(text);
|
||||
}
|
||||
CIMGUI_API void igLoadIniSettingsFromDisk(const char* ini_filename)
|
||||
{
|
||||
return ImGui::LoadIniSettingsFromDisk(ini_filename);
|
||||
}
|
||||
CIMGUI_API void igLoadIniSettingsFromMemory(const char* ini_data,size_t ini_size)
|
||||
{
|
||||
return ImGui::LoadIniSettingsFromMemory(ini_data,ini_size);
|
||||
}
|
||||
CIMGUI_API void igSaveIniSettingsToDisk(const char* ini_filename)
|
||||
{
|
||||
return ImGui::SaveIniSettingsToDisk(ini_filename);
|
||||
}
|
||||
CIMGUI_API const char* igSaveIniSettingsToMemory(size_t* out_ini_size)
|
||||
{
|
||||
return ImGui::SaveIniSettingsToMemory(out_ini_size);
|
||||
}
|
||||
CIMGUI_API void igSetAllocatorFunctions(void*(*alloc_func)(size_t sz,void* user_data),void(*free_func)(void* ptr,void* user_data),void* user_data)
|
||||
{
|
||||
return ImGui::SetAllocatorFunctions(alloc_func,free_func,user_data);
|
||||
@@ -1781,6 +1837,10 @@ CIMGUI_API bool ImFontAtlas_Build(ImFontAtlas* self)
|
||||
{
|
||||
return self->Build();
|
||||
}
|
||||
CIMGUI_API bool ImFontAtlas_IsBuilt(ImFontAtlas* self)
|
||||
{
|
||||
return self->IsBuilt();
|
||||
}
|
||||
CIMGUI_API void ImFontAtlas_GetTexDataAsAlpha8(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height,int* out_bytes_per_pixel)
|
||||
{
|
||||
return self->GetTexDataAsAlpha8(out_pixels,out_width,out_height,out_bytes_per_pixel);
|
||||
@@ -1805,9 +1865,13 @@ CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesJapanese(ImFontAtlas* se
|
||||
{
|
||||
return self->GetGlyphRangesJapanese();
|
||||
}
|
||||
CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesChinese(ImFontAtlas* self)
|
||||
CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesChineseFull(ImFontAtlas* self)
|
||||
{
|
||||
return self->GetGlyphRangesChinese();
|
||||
return self->GetGlyphRangesChineseFull();
|
||||
}
|
||||
CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(ImFontAtlas* self)
|
||||
{
|
||||
return self->GetGlyphRangesChineseSimplifiedCommon();
|
||||
}
|
||||
CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesCyrillic(ImFontAtlas* self)
|
||||
{
|
||||
|
1927
cimgui/cimgui.h
1927
cimgui/cimgui.h
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,8 @@ typedef unsigned __int64 ImU64;
|
||||
typedef unsigned long long ImU64;
|
||||
#endif
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
#include "imgui_structs.h"
|
||||
#endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
|
@@ -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
|
||||
|
||||
gcc -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ../../imgui/imgui.h > 1.txt
|
||||
type 1.txt | luajit.exe ./generator.lua true > out.txt
|
||||
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
|
||||
|
||||
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
|
||||
|
@@ -2,8 +2,11 @@
|
||||
--script for auto_funcs.h and auto_funcs.cpp generation
|
||||
--expects Lua 5.1 or luajit
|
||||
--------------------------------------------------------------------------
|
||||
local script_args = {...}
|
||||
local locations = {}
|
||||
for i=2,#script_args do table.insert(locations,script_args[i]) end
|
||||
-- first script argument to use gcc or not
|
||||
local USEGCC = ({...})[1] == "true"
|
||||
local USEGCC = script_args[1] == "true"
|
||||
print("USEGCC",USEGCC)
|
||||
--------------------------------------------------------------------------
|
||||
--this table has the functions to be skipped in generation
|
||||
@@ -64,6 +67,8 @@ local function imguilines(file)
|
||||
end
|
||||
-- skip
|
||||
elseif #iflevels == 0 then
|
||||
-- drop IMGUI_APIX
|
||||
line = line:gsub("IMGUI_APIX","")
|
||||
-- drop IMGUI_API
|
||||
line = line:gsub("IMGUI_API","")
|
||||
return line
|
||||
@@ -73,9 +78,12 @@ local function imguilines(file)
|
||||
return location_it
|
||||
end
|
||||
--iterates lines from a gcc -E in a specific location
|
||||
local function location(file,locpath)
|
||||
local function location(file,locpathT)
|
||||
local location_re = '^# %d+ "([^"]*)"'
|
||||
local path_re = '^(.*[\\/])('..locpath..')%.h$'
|
||||
local path_reT = {}
|
||||
for i,locpath in ipairs(locpathT) do
|
||||
table.insert(path_reT,'^(.*[\\/])('..locpath..')%.h$')
|
||||
end
|
||||
local in_location = false
|
||||
local function location_it()
|
||||
repeat
|
||||
@@ -85,9 +93,10 @@ local function location(file,locpath)
|
||||
-- Is this a location pragma?
|
||||
local location_match = line:match(location_re)
|
||||
if location_match then
|
||||
-- If we are transitioning to a header we need to parse, set the flag
|
||||
local path_match,aaa = location_match:match(path_re)
|
||||
in_location = (path_match ~= nil)
|
||||
in_location = false
|
||||
for i,path_re in ipairs(path_reT) do
|
||||
if location_match:match(path_re) then in_location = true; break end
|
||||
end
|
||||
end
|
||||
elseif in_location then
|
||||
return line
|
||||
@@ -156,6 +165,7 @@ local function get_manuals(def)
|
||||
end
|
||||
|
||||
local function getcimguiname(stname,funcname)
|
||||
if #stname == 0 then return funcname end --top level
|
||||
local pre = (stname == "ImGui") and "ig" or stname.."_"
|
||||
return pre..funcname
|
||||
end
|
||||
@@ -414,7 +424,8 @@ 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
|
||||
for k,def in args:gmatch('([%w_]+)=([%w_%(%)%s,%*%.%-%%"]+)[,%)]') do
|
||||
defT.defaults[k]=def
|
||||
end
|
||||
defT.cimguiname = cimguiname
|
||||
@@ -605,7 +616,7 @@ local function func_header_generate(FP)
|
||||
local manual = get_manuals(def)
|
||||
if not manual and def.ret then --not constructor
|
||||
local addcoment = def.comment or ""
|
||||
if def.stname == "ImGui" then
|
||||
if def.stname == "ImGui" or def.stname == "" then --ImGui namespace or top level
|
||||
table.insert(outtab,"CIMGUI_API".." "..def.ret.." "..(def.ov_cimguiname or def.cimguiname)..def.args..";"..addcoment.."\n")
|
||||
else
|
||||
local empty = def.args:match("^%(%)") --no args
|
||||
@@ -626,7 +637,7 @@ local function func_implementation(FP)
|
||||
local cimf = FP.defsT[t.cimguiname]
|
||||
local def = cimf[t.signature]
|
||||
local manual = get_manuals(def)
|
||||
if not manual and def.ret then --not constructor
|
||||
if not manual and def.ret and def.stname~="" then --not constructor or manual or top level
|
||||
local ptret = def.retref and "&" or ""
|
||||
-- local castret = def.ret:gsub("[^%s]+",function(x)
|
||||
-- local y = x:gsub("%*","")
|
||||
@@ -688,7 +699,7 @@ local iterator = (USEGCC and location) or imguilines
|
||||
print("iterator",iterator)
|
||||
print(location, imguilines)
|
||||
|
||||
for line in iterator(io.input(),"imgui") do
|
||||
for line in iterator(io.input(),locations) do
|
||||
local line, comment = split_comment(line)
|
||||
STP.insert(line,comment)
|
||||
FP.insert(line,comment)
|
||||
|
@@ -2,7 +2,8 @@ rem this is used to rebuild imgui_structs.h
|
||||
rem set your PATH if necessary for gcc and lua with:
|
||||
set PATH=%PATH%;C:\luaGL;
|
||||
|
||||
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
|
||||
|
||||
cmd /k
|
||||
|
||||
|
Reference in New Issue
Block a user