Skip to content

Commit

Permalink
update to imgui 1.89.9, add lunasvg
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Sep 20, 2023
1 parent 2b72bbe commit 87caa5f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gdext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: vcpkg install
run: |
cd gdext
${{ env.VCPKG_ROOT }}\vcpkg install --triplet x64-windows-static-md
${{ env.VCPKG_ROOT }}\vcpkg install --triplet x64-windows-static
- name: GDScript bindings
run: |
Expand Down
8 changes: 8 additions & 0 deletions gdext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@ if (NOT TARGET godot-cpp)
endif()

find_package(freetype CONFIG REQUIRED)
find_package(unofficial-lunasvg CONFIG REQUIRED)

add_library(imgui-godot-native SHARED)
target_compile_features(imgui-godot-native PRIVATE cxx_std_20)
target_compile_definitions(imgui-godot-native PUBLIC
IMGUI_USER_CONFIG="imconfig-godot.h"
IMGUI_ENABLE_FREETYPE
IMGUI_ENABLE_FREETYPE_LUNASVG
IGN_EXPORT
)

if (MSVC)
target_compile_options(godot-cpp PRIVATE "/MP")
target_compile_options(imgui-godot-native PRIVATE "/MP")
endif()

add_subdirectory(src)

target_sources(imgui-godot-native PRIVATE
Expand All @@ -52,6 +59,7 @@ target_sources(imgui-godot-native PRIVATE
target_link_libraries(imgui-godot-native PUBLIC
godot-cpp
freetype
unofficial::lunasvg::lunasvg
)

target_include_directories(imgui-godot-native PRIVATE src imgui gen PUBLIC include)
Expand Down
7 changes: 4 additions & 3 deletions gdext/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ project_name = Path(extension_path).stem

config = "release" if env["target"] == "template_release" else "debug"

libpath = env["LIBPATH"]
libpath = env.get("LIBPATH", [])
libs = [env["LIBS"]]

windows = env["platform"] == "windows"
Expand All @@ -26,19 +26,20 @@ if config == "release":
env.Append(CPPDEFINES=["NDEBUG"])

if windows:
triplet = "x64-windows-static-md"
triplet = "x64-windows-static"
elif linux:
triplet = "x64-linux"
else:
triplet = "arm64-osx"

env.Append(CPPPATH=["imgui/misc/freetype/"])
env.Append(CPPPATH=[f"vcpkg_installed/{triplet}/include"])
env.Append(CPPDEFINES=["IMGUI_ENABLE_FREETYPE"])
env.Append(CPPDEFINES=["IMGUI_ENABLE_FREETYPE", "IMGUI_ENABLE_FREETYPE_LUNASVG"])
sources += Glob("imgui/misc/freetype/*.cpp")
libpath += [f"vcpkg_installed/{triplet}/lib"]
libs += [
"freetype",
"lunasvg",
"bz2",
"libpng16" if windows else "png16",
"zlib" if windows else "z",
Expand Down
2 changes: 1 addition & 1 deletion gdext/imgui
Submodule imgui updated 61 files
+2 −2 .github/workflows/build.yml
+1 −2 .gitignore
+9 −3 backends/imgui_impl_allegro5.cpp
+5 −1 backends/imgui_impl_allegro5.h
+6 −0 backends/imgui_impl_android.cpp
+5 −0 backends/imgui_impl_android.h
+4 −0 backends/imgui_impl_dx10.cpp
+3 −0 backends/imgui_impl_dx10.h
+5 −0 backends/imgui_impl_dx11.cpp
+3 −0 backends/imgui_impl_dx11.h
+5 −0 backends/imgui_impl_dx12.cpp
+3 −0 backends/imgui_impl_dx12.h
+5 −0 backends/imgui_impl_dx9.cpp
+3 −0 backends/imgui_impl_dx9.h
+7 −10 backends/imgui_impl_glfw.cpp
+3 −0 backends/imgui_impl_glfw.h
+6 −1 backends/imgui_impl_glut.cpp
+5 −2 backends/imgui_impl_glut.h
+5 −0 backends/imgui_impl_metal.h
+5 −0 backends/imgui_impl_metal.mm
+6 −4 backends/imgui_impl_opengl2.cpp
+4 −1 backends/imgui_impl_opengl2.h
+5 −4 backends/imgui_impl_opengl3.cpp
+3 −0 backends/imgui_impl_opengl3.h
+3 −0 backends/imgui_impl_osx.h
+5 −0 backends/imgui_impl_osx.mm
+10 −0 backends/imgui_impl_sdl2.cpp
+4 −0 backends/imgui_impl_sdl2.h
+12 −2 backends/imgui_impl_sdl3.cpp
+4 −0 backends/imgui_impl_sdl3.h
+5 −4 backends/imgui_impl_sdlrenderer2.cpp
+3 −0 backends/imgui_impl_sdlrenderer2.h
+5 −4 backends/imgui_impl_sdlrenderer3.cpp
+3 −0 backends/imgui_impl_sdlrenderer3.h
+6 −0 backends/imgui_impl_vulkan.cpp
+2 −0 backends/imgui_impl_vulkan.h
+10 −2 backends/imgui_impl_wgpu.cpp
+6 −0 backends/imgui_impl_wgpu.h
+3 −0 backends/imgui_impl_win32.cpp
+3 −0 backends/imgui_impl_win32.h
+1 −1 docs/BACKENDS.md
+144 −66 docs/CHANGELOG.txt
+12 −11 docs/CONTRIBUTING.md
+6 −34 docs/FAQ.md
+120 −104 docs/FONTS.md
+7 −3 docs/README.md
+13 −10 examples/example_emscripten_wgpu/main.cpp
+4 −12 examples/example_glfw_vulkan/main.cpp
+4 −12 examples/example_sdl2_vulkan/main.cpp
+15 −8 imconfig.h
+342 −296 imgui.cpp
+51 −36 imgui.h
+293 −161 imgui_demo.cpp
+81 −27 imgui_draw.cpp
+46 −26 imgui_internal.h
+52 −16 imgui_tables.cpp
+82 −61 imgui_widgets.cpp
+10 −0 misc/cpp/imgui_stdlib.cpp
+8 −1 misc/freetype/README.md
+147 −2 misc/freetype/imgui_freetype.cpp
+3 −1 misc/freetype/imgui_freetype.h
24 changes: 15 additions & 9 deletions gdext/src/RdRendererThreadSafe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,30 @@ struct RdRendererThreadSafe::Impl
{
ClonedDrawData(ImDrawData* drawData)
{
data = (ImDrawData*)IM_ALLOC(sizeof(ImDrawData));
memcpy(data, drawData, sizeof(ImDrawData));
data->CmdLists = (ImDrawList**)IM_ALLOC(sizeof(void*) * drawData->CmdListsCount);

for (int i = 0; i < drawData->CmdListsCount; ++i)
data = IM_NEW(ImDrawData);
data->Valid = drawData->Valid;
data->CmdListsCount = drawData->CmdListsCount;
data->TotalIdxCount = drawData->TotalIdxCount;
data->TotalVtxCount = drawData->TotalVtxCount;
data->CmdLists = {};
data->DisplayPos = drawData->DisplayPos;
data->DisplaySize = drawData->DisplaySize;
data->FramebufferScale = drawData->FramebufferScale;
data->OwnerViewport = drawData->OwnerViewport;

for (int i = 0; i < drawData->CmdLists.Size; ++i)
{
data->CmdLists[i] = drawData->CmdLists[i]->CloneOutput();
data->CmdLists.push_back(drawData->CmdLists[i]->CloneOutput());
}
}

~ClonedDrawData()
{
for (int i = 0; i < data->CmdListsCount; ++i)
for (int i = 0; i < data->CmdLists.Size; ++i)
{
IM_DELETE(data->CmdLists[i]);
}
IM_FREE(data->CmdLists);
IM_FREE(data);
IM_DELETE(data);
}

ImDrawData* data;
Expand Down
3 changes: 2 additions & 1 deletion gdext/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": [
"freetype"
"freetype",
"lunasvg"
]
}

0 comments on commit 87caa5f

Please sign in to comment.