From 713f601283e3b1f3b6925f6d895d3df1a59ff9dc Mon Sep 17 00:00:00 2001 From: Patrick Dawson Date: Fri, 9 Aug 2024 05:55:18 +0200 Subject: [PATCH] Various refactoring --- .github/workflows/gdext.yml | 155 +++++++----------------------- doc/test/gdscript/main.gd | 3 + gdext/CMakeLists.txt | 5 + gdext/include/imgui-godot.h | 2 +- gdext/scripts/gds_bindings.py | 175 ++++++++++++++++++---------------- gdext/src/ImGuiAPI.cpp | 20 ++-- gdext/src/ImGuiAPI.h | 20 +--- gdext/src/ImGuiGD.cpp | 8 +- gdext/src/ImGuiGD.h | 8 +- 9 files changed, 151 insertions(+), 245 deletions(-) diff --git a/.github/workflows/gdext.yml b/.github/workflows/gdext.yml index ffc7d93..0db733f 100644 --- a/.github/workflows/gdext.yml +++ b/.github/workflows/gdext.yml @@ -10,10 +10,21 @@ env: vcpkg_tag: 1de2026f28ead93ff1773e6e680387643e914ea1 # 2024.07.12 jobs: - # TODO: refactor to matrix - windows: - name: 🪟Windows - runs-on: windows-latest + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-14, windows-latest] + include: + - os: ubuntu-latest + name: 🐧Linux + - os: macos-14 + name: 🍎macOS + - os: windows-latest + name: 🪟Windows + + name: ${{ matrix.name }} Build + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -26,17 +37,29 @@ jobs: python-version: 3.12 - name: Install tools + shell: bash run: | python -m pip install "scons<4.8" scons --version pip install ply + - name: Linux tools + shell: bash + run: | + sudo apt install clang-format + + - name: macOS tools + shell: bash + run: | + brew install clang-format ninja + - name: Setup vcpkg uses: lukka/run-vcpkg@v11 with: vcpkgGitCommitId: ${{ env.vcpkg_tag }} - - shell: bash + - name: Make cache key + shell: bash run: | echo "cache_key=godot-cpp-$(git -C gdext/godot-cpp rev-parse --short HEAD)-${{ runner.os }}-$ImageVersion" >> $GITHUB_ENV @@ -49,7 +72,7 @@ jobs: key: ${{ env.cache_key }} - name: Build - if: github.ref_type != 'tag' + if: github.ref_type != 'tag' || runner.os != 'Windows' run: | cd gdext scons godot-cpp @@ -58,7 +81,7 @@ jobs: scons target=template_release - name: Build (with debug symbols) - if: github.ref_type == 'tag' + if: github.ref_type == 'tag' && runner.os == 'Windows' run: | cd gdext scons debug_symbols=yes godot-cpp @@ -69,125 +92,13 @@ jobs: - name: Upload binaries uses: actions/upload-artifact@v4 with: - name: gdext-windows - path: addons/imgui-godot/bin - - linux: - name: 🐧Linux - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup Python 3.x - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: Install tools - run: | - python -m pip install "scons<4.8" - scons --version - pip install ply - sudo apt install clang-format - - - name: Setup vcpkg - uses: lukka/run-vcpkg@v11 - with: - vcpkgGitCommitId: ${{ env.vcpkg_tag }} - - - shell: bash - run: | - echo "cache_key=godot-cpp-$(git -C gdext/godot-cpp rev-parse --short HEAD)-${{ runner.os }}-$ImageVersion" >> $GITHUB_ENV - - - uses: actions/cache@v4 - id: cache-godot-cpp - with: - path: | - gdext/scons_cache - key: ${{ env.cache_key }} - - - name: Build debug - run: | - cd gdext - scons godot-cpp - scons - - - name: Build release - run: | - cd gdext - scons target=template_release godot-cpp - scons target=template_release - - - name: Upload binaries - uses: actions/upload-artifact@v4 - with: - name: gdext-linux - path: addons/imgui-godot/bin - - macos: - name: 🍎macOS - runs-on: macos-14 - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup Python 3.x - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: Install tools - run: | - python -m pip install "scons<4.8" - scons --version - pip install ply - brew install clang-format ninja - - - name: Setup vcpkg - uses: lukka/run-vcpkg@v11 - with: - vcpkgGitCommitId: ${{ env.vcpkg_tag }} - - - shell: bash - run: | - echo "cache_key=godot-cpp-$(git -C gdext/godot-cpp rev-parse --short HEAD)-${{ runner.os }}-$ImageVersion" >> $GITHUB_ENV - - - uses: actions/cache@v4 - id: cache-godot-cpp - with: - path: | - gdext/scons_cache - key: ${{ env.cache_key }} - - - name: Build debug - run: | - export PATH="$(brew --prefix llvm@15)/bin:$PATH" - cd gdext - scons godot-cpp - scons - - - name: Build release - run: | - export PATH="$(brew --prefix llvm@15)/bin:$PATH" - cd gdext - scons target=template_release godot-cpp - scons target=template_release - - - name: Upload binaries - uses: actions/upload-artifact@v4 - with: - name: gdext-macos + name: gdext-${{ runner.os }} path: addons/imgui-godot/bin package: name: 📦Package runs-on: ubuntu-latest - needs: [windows, linux, macos] + needs: [build] steps: - uses: actions/checkout@v4 @@ -267,7 +178,7 @@ jobs: package_cs: name: 📦Package (C# only) runs-on: ubuntu-latest - needs: [windows, linux, macos] + needs: [build] steps: - uses: actions/checkout@v4 diff --git a/doc/test/gdscript/main.gd b/doc/test/gdscript/main.gd index 2e60a8d..05081d3 100644 --- a/doc/test/gdscript/main.gd +++ b/doc/test/gdscript/main.gd @@ -11,6 +11,9 @@ func _ready() -> void: assert_equal(ImGuiGD.Scale, 2) assert_equal(ImGui.GetFontSize(), 26) + # StringName conversion + assert_equal(ImGui.GetID("test_id"), 2044763162) + # rescale call_deferred("change_scale") diff --git a/gdext/CMakeLists.txt b/gdext/CMakeLists.txt index b5710d0..9e813c5 100644 --- a/gdext/CMakeLists.txt +++ b/gdext/CMakeLists.txt @@ -31,8 +31,13 @@ target_compile_definitions(imgui-godot-native PUBLIC IMGUI_ENABLE_FREETYPE # IMGUI_ENABLE_FREETYPE_LUNASVG IGN_EXPORT + # REAL_T_IS_DOUBLE ) +# target_compile_definitions(godot-cpp PUBLIC +# REAL_T_IS_DOUBLE +# ) + if (MSVC) target_compile_options(godot-cpp PRIVATE "/MP") target_compile_options(imgui-godot-native PRIVATE "/MP") diff --git a/gdext/include/imgui-godot.h b/gdext/include/imgui-godot.h index 51a9ac2..5a9b1a5 100644 --- a/gdext/include/imgui-godot.h +++ b/gdext/include/imgui-godot.h @@ -120,7 +120,7 @@ inline void ResetFonts() detail::ImGuiGD->call(sn); } -inline void SetJoyAxisDeadZone(float deadZone) +inline void SetJoyAxisDeadZone(real_t deadZone) { ERR_FAIL_COND(!detail::GET_IMGUIGD()); static const StringName sn("JoyAxisDeadZone"); diff --git a/gdext/scripts/gds_bindings.py b/gdext/scripts/gds_bindings.py index dff4e2b..e506024 100644 --- a/gdext/scripts/gds_bindings.py +++ b/gdext/scripts/gds_bindings.py @@ -16,7 +16,7 @@ "const ImGuiWindowClass*": "Ref", "double": "double", "double*": "Array", - "float": "float", + "float": "real_t", "float*": "Array", "ImDrawList*": "Ref", "ImFont*": "int64_t", @@ -55,7 +55,6 @@ ) exclude_funcs = ( - "ImGui_GetKeyIndex", "ImGui_ColorConvertFloat4ToU32", "ImGui_ColorConvertHSVtoRGB", "ImGui_ColorConvertU32ToFloat4", @@ -69,6 +68,8 @@ "ImGui_GetColorU32ImU32Ex", "ImGui_GetColorU32ImVec4", "ImGui_GetCurrentContext", + "ImGui_GetIDStr", + "ImGui_GetKeyIndex", "ImGui_NewFrame", "ImGui_Render", "ImGui_RenderPlatformWindowsDefault", @@ -158,22 +159,22 @@ def __init__(self, j): self.vals.append((gdname, name)) def gen_def(self): - rv = f"enum {self.name} {{ \\\n" + rv = f"enum {self.name} {{ " for kv in self.vals: rv += f"{kv[0]} = {kv[1]}, " - rv += "}; \\\n" - return rv + rv += "};" + return [rv] def gen_cast(self): macro = "VARIANT_BITFIELD_CAST" if self.bitfield else "VARIANT_ENUM_CAST" - return f"{macro}(ImGui::Godot::ImGui::{self.name}); \\\n" + return [f"{macro}(ImGui::Godot::ImGui::{self.name});"] def gen_bindings(self): macro = "BIND_BITFIELD_FLAG" if self.bitfield else "BIND_ENUM_CONSTANT" rv = "" for kv in self.vals: - rv += f"{macro}({kv[0]}); \\\n" - return rv + rv += f"{macro}({kv[0]});" + return [rv] def __str__(self): return f"Enum {self.name} ({self.orig_name})" @@ -244,7 +245,7 @@ def gen_arg(self, safe_fmt=True): else: return rv elif self.gdtype == "Vector2": - return f"{{{self.name}.x, {self.name}.y}}" + return f"{{static_cast({self.name}.x), static_cast({self.name}.y)}}" elif self.gdtype == "Ref": return f"(ImTextureID){self.name}->get_rid().get_id()" elif self.gdtype == "Color": @@ -311,7 +312,9 @@ def __init__(self, j): print(f"skip function {self.orig_name}") def gen_decl(self): - return f'static {self.rt.gdtype} {self.name}({", ".join(p.gen_decl() for p in self.params)}); \\\n' + return [ + f'static {self.rt.gdtype} {self.name}({", ".join(p.gen_decl() for p in self.params)});' + ] def gen_def(self): fname = self.orig_name @@ -327,20 +330,20 @@ def gen_def(self): elif self.rt.gdtype in non_bitfield_enums: fcall = f"static_cast<{self.rt.gdtype}>({fcall})" - rv = f'{self.rt.gdtype} ImGui::{self.name}({", ".join(p.gen_def() for p in self.params)}) {{ \\\n' + rv = f'{self.rt.gdtype} ImGui::{self.name}({", ".join(p.gen_def() for p in self.params)}) {{' if self.rt.is_struct: - rv += f"{self.rt.gdtype} rv; \\\n" - rv += "rv.instantiate(); \\\n" - rv += f"rv->_SetPtr({fcall}); \\\n" + rv += f"{self.rt.gdtype} rv;" + rv += "rv.instantiate();" + rv += f"rv->_SetPtr({fcall});" rv += "return rv" else: if self.rt.gdtype != "void": rv += "return " rv += fcall - rv += "; } \\\n" - return rv + rv += "; }" + return [rv] def gen_bindings(self): rv = f'ClassDB::bind_static_method("ImGui", D_METHOD("{self.name}"' @@ -350,8 +353,8 @@ def gen_bindings(self): for p in self.params: if p.dv is not None: rv += f", DEFVAL({p.dv})" - rv += "); \\\n" - return rv + rv += ");" + return [rv] class Property: @@ -394,13 +397,13 @@ def __init__(self, j, name, struct_name): print(f"skip property {self.orig_type} {self.struct_name}::{self.name}") def gen_decl(self): - rv = f"{self.gdtype} _Get{self.name}(); \\\n" - rv += f"void _Set{self.name}({self.gdtype} x); \\\n" + rv = f"{self.gdtype} _Get{self.name}();" + rv += f"void _Set{self.name}({self.gdtype} x);" return rv def gen_def(self): # getter - rv = f"{self.gdtype} {self.struct_name}::_Get{self.name}() {{ \\\n" + rv = f"{self.gdtype} {self.struct_name}::_Get{self.name}() {{" fcall = f"ptr->{self.name}" # TODO: refactor if self.orig_type == "ImVec2": @@ -420,17 +423,17 @@ def gen_def(self): elif self.orig_type == "const ImGuiTableColumnSortSpecs*": fcall = f"SpecsToArray(ptr)" - rv += f"if (ptr) [[likely]] return {fcall}; else return {dv};\\\n" - rv += "} \\\n" + rv += f"if (ptr) [[likely]] return {fcall}; else return {dv};" + rv += "}" # setter - rv += f"void {self.struct_name}::_Set{self.name}({self.gdtype} x) {{ \\\n" + rv += f"void {self.struct_name}::_Set{self.name}({self.gdtype} x) {{" if self.is_const: rv += f'ERR_FAIL_MSG("{self.name} is const");' else: x = "x" if self.orig_type == "ImVec2": - x = "{x.x, x.y}" + x = "{static_cast(x.x), static_cast(x.y)}" elif self.orig_type in ["ImFont*"]: x = "(ImFont*)x" elif self.gdtype in non_bitfield_enums: @@ -439,20 +442,20 @@ def gen_def(self): x = "ToImVector(x)" if self.gdtype == "PackedColorArray": - rv += f"FromPackedColorArray(x, ptr->{self.name}); \\\n" + rv += f"FromPackedColorArray(x, ptr->{self.name});" else: - rv += f"ptr->{self.name} = {x}; \\\n" - rv += "} \\\n" + rv += f"ptr->{self.name} = {x};" + rv += "}" return rv def gen_bindings(self): getter = f"_Get{self.name}" setter = f"_Set{self.name}" - rv = f'ClassDB::bind_method(D_METHOD("{getter}"), &{self.struct_name}::{getter}); \\\n' - rv += f'ClassDB::bind_method(D_METHOD("{setter}", "x"), &{self.struct_name}::{setter}); \\\n' + rv = f'ClassDB::bind_method(D_METHOD("{getter}"), &{self.struct_name}::{getter});' + rv += f'ClassDB::bind_method(D_METHOD("{setter}", "x"), &{self.struct_name}::{setter});' vtype = Property.variant_types.get(self.gdtype, "INT") - rv += f'ADD_PROPERTY(PropertyInfo(Variant::{vtype}, "{self.name}"), "{setter}", "{getter}"); \\\n' + rv += f'ADD_PROPERTY(PropertyInfo(Variant::{vtype}, "{self.name}"), "{setter}", "{getter}");' return rv @@ -473,46 +476,46 @@ def __init__(self, j): self.properties.append(prop) def gen_decl(self): - rv = f"class {self.name} : public RefCounted {{ \\\n" - rv += f"GDCLASS({self.name}, RefCounted); \\\n" - rv += "protected: static void _bind_methods(); \\\n" + rv = f"class {self.name} : public RefCounted {{" + rv += f"GDCLASS({self.name}, RefCounted);" + rv += "protected: static void _bind_methods();" - rv += "public: \\\n" + rv += "public:" # needs constructor for non-zero values if self.orig_name == "ImGuiWindowClass": - rv += "ImGuiWindowClassPtr() { ptr->ParentViewportId = -1; ptr->DockingAllowUnclassed = true; } \\\n" + rv += "ImGuiWindowClassPtr() { ptr->ParentViewportId = -1; ptr->DockingAllowUnclassed = true; }" if not self.constructible: - rv += f"void _SetPtr({self.orig_name}* p) {{ ptr = p; }} \\\n" - rv += f"{self.orig_name}* _GetPtr() {{ return ptr; }} \\\n" + rv += f"void _SetPtr({self.orig_name}* p) {{ ptr = p; }}" + rv += f"{self.orig_name}* _GetPtr() {{ return ptr; }}" else: - rv += f"{self.orig_name}* _GetPtr() {{ return ptr.get(); }} \\\n" + rv += f"{self.orig_name}* _GetPtr() {{ return ptr.get(); }}" for prop in self.properties: rv += prop.gen_decl() - rv += "private: \\\n" + rv += "private:" if not self.constructible: - rv += f"{self.orig_name}* ptr = nullptr; \\\n" + rv += f"{self.orig_name}* ptr = nullptr;" else: - rv += f"std::unique_ptr<{self.orig_name}> ptr = std::make_unique<{self.orig_name}>(); \\\n" + rv += f"std::unique_ptr<{self.orig_name}> ptr = std::make_unique<{self.orig_name}>();" - rv += "}; \\\n" - return rv + rv += "};" + return [rv] def gen_def(self): - rv = f"void {self.name}::_bind_methods() {{ \\\n" + rv = f"void {self.name}::_bind_methods() {{" for prop in self.properties: rv += prop.gen_bindings() - rv += "} \\\n" + rv += "}" for prop in self.properties: rv += prop.gen_def() - return rv + return [rv] def gen_bindings(self): - return f"ClassDB::register_class<{self.name}>(); \\\n" + return [f"ClassDB::register_class<{self.name}>();"] class JsonParser: @@ -531,16 +534,17 @@ def __init__(self): self.enums = [] self.structs = [] self.funcs = [] - self.enum_defs = "#define DEFINE_IMGUI_ENUMS() \\\n" - self.enum_casts = "#define CAST_IMGUI_ENUMS() \\\n" - self.enum_binds = "#define REGISTER_IMGUI_ENUMS() \\\n" - self.func_decls = "#define DECLARE_IMGUI_FUNCS() \\\n" - self.func_binds = "#define BIND_IMGUI_FUNCS() \\\n" - self.func_defs = "#define DEFINE_IMGUI_FUNCS() \\\n" - self.struct_decls = "#define DECLARE_IMGUI_STRUCTS() \\\n" - self.struct_decls_fwd = "#define FORWARD_DECLARE_IMGUI_STRUCTS() \\\n" - self.struct_defs = "#define DEFINE_IMGUI_STRUCTS() \\\n" - self.struct_binds = "#define BIND_IMGUI_STRUCTS() \\\n" + + self.enum_defs = [] + self.enum_casts = [] + self.enum_binds = [] + self.func_decls = [] + self.func_binds = [] + self.func_defs = [] + self.struct_decls = [] + self.struct_decls_fwd = [] + self.struct_defs = [] + self.struct_binds = [] def write(self): try: @@ -549,17 +553,35 @@ def write(self): pass with open("gen/imgui_bindings.gen.h", "w") as fi: - fi.write("#include \n\n") - fi.write(self.enum_defs) - fi.write(self.enum_binds) - fi.write(self.enum_casts) - fi.write(self.struct_decls_fwd) - fi.write(self.struct_decls) - fi.write(self.struct_defs) - fi.write(self.struct_binds) - fi.write(self.func_decls) - fi.write(self.func_binds) - fi.write(self.func_defs) + out = ( + ["namespace ImGui::Godot {"] + + self.struct_decls_fwd + + [ + "class ImGui : public Object {", + " GDCLASS(ImGui, Object);", + "protected:", + " static void _bind_methods();" "public:", + ] + + self.enum_defs + + self.func_decls + + ["};"] + + self.struct_decls + + ["} // namespace ImGui::Godot"] + + self.enum_casts + ) + fi.write("\n".join(out)) + + with open("gen/imgui_bindings_impl.gen.h", "w") as fi: + out = ( + ["void ImGui::_bind_methods() {"] + + self.enum_binds + + self.struct_binds + + self.func_binds + + ["}"] + + self.struct_defs + + self.func_defs + ) + fi.write("\n".join(out)) def load(self, jdat): enums = [] @@ -574,23 +596,16 @@ def load(self, jdat): else: type_map[e.orig_name.strip("_")] = f"ImGui::{e.name}" non_bitfield_enums.append(f"ImGui::{e.name}") - self.enum_defs += "\n\n" - self.enum_binds += "\n\n" - self.enum_casts += "\n\n" for js in jdat["structs"]: s = Struct(js) if s.valid: self.structs.append(s) for s in self.structs: - self.struct_decls_fwd += f"class {s.name};" + self.struct_decls_fwd += [f"class {s.name};"] self.struct_decls += s.gen_decl() self.struct_defs += s.gen_def() self.struct_binds += s.gen_bindings() - self.struct_decls_fwd += "\n\n" - self.struct_decls += "\n\n" - self.struct_defs += "\n\n" - self.struct_binds += "\n\n" for jf in jdat["functions"]: f = Function(jf) @@ -601,10 +616,6 @@ def load(self, jdat): self.func_defs += f.gen_def() self.func_binds += f.gen_bindings() - self.func_decls += "\n\n" - self.func_defs += "\n\n" - self.func_binds += "\n\n" - def main(): os.makedirs("gen", exist_ok=True) @@ -618,7 +629,7 @@ def main(): parser.load(jdat) parser.write() - subprocess.call("clang-format -i gen/imgui_bindings.gen.h", shell=True) + subprocess.call("clang-format -i gen/imgui_bindings*", shell=True) if __name__ == "__main__": diff --git a/gdext/src/ImGuiAPI.cpp b/gdext/src/ImGuiAPI.cpp index b82fbfe..3820ead 100644 --- a/gdext/src/ImGuiAPI.cpp +++ b/gdext/src/ImGuiAPI.cpp @@ -72,12 +72,13 @@ inline Array SpecsToArray(const ImGuiTableSortSpecs* p) const char* sn_to_cstr(const StringName& sn) { - static std::unordered_map stringname_cache; - if (!stringname_cache.contains(sn)) + static std::unordered_map stringname_cache; + const int64_t hash = sn.hash(); + if (!stringname_cache.contains(hash)) { - stringname_cache[sn] = std::string(String(sn).utf8().get_data()); + stringname_cache[hash] = std::string(String(sn).utf8().get_data()); } - return stringname_cache[sn].c_str(); + return stringname_cache[hash].c_str(); } } // namespace @@ -97,15 +98,6 @@ void unregister_imgui_api() memdelete(api); } -void ImGui::_bind_methods() -{ - REGISTER_IMGUI_ENUMS(); - BIND_IMGUI_STRUCTS(); - BIND_IMGUI_FUNCS(); -} - -DEFINE_IMGUI_STRUCTS() - -DEFINE_IMGUI_FUNCS() +#include "imgui_bindings_impl.gen.h" } // namespace ImGui::Godot diff --git a/gdext/src/ImGuiAPI.h b/gdext/src/ImGuiAPI.h index 0d18137..2a889f7 100644 --- a/gdext/src/ImGuiAPI.h +++ b/gdext/src/ImGuiAPI.h @@ -8,7 +8,7 @@ #include #include -#include "imgui_bindings.gen.h" +#include using namespace godot; @@ -131,22 +131,6 @@ struct GdsZeroArray #define GDS_PTR(T, a) a.size() == 0 ? nullptr : (T*)GdsPtr(a) // #define GDS_PTR_STR(a, len, label) a.size() == 0 ? nullptr : (char*)GdsPtr(a, len, label) -FORWARD_DECLARE_IMGUI_STRUCTS() - -class ImGui : public Object -{ - GDCLASS(ImGui, Object); - -protected: - static void _bind_methods(); - -public: - DEFINE_IMGUI_ENUMS() - DECLARE_IMGUI_FUNCS() -}; - -DECLARE_IMGUI_STRUCTS() - } // namespace ImGui::Godot -CAST_IMGUI_ENUMS() +#include "imgui_bindings.gen.h" diff --git a/gdext/src/ImGuiGD.cpp b/gdext/src/ImGuiGD.cpp index 1869e53..a631c6e 100644 --- a/gdext/src/ImGuiGD.cpp +++ b/gdext/src/ImGuiGD.cpp @@ -124,14 +124,14 @@ bool ImGuiGD::_GetVisible() return false; } -void ImGuiGD::_SetJoyAxisDeadZone(float zone) +void ImGuiGD::_SetJoyAxisDeadZone(real_t zone) { Context* ctx = ImGui::Godot::GetContext(); ERR_FAIL_COND(!ctx); ctx->joyAxisDeadZone = zone; } -float ImGuiGD::_GetJoyAxisDeadZone() +real_t ImGuiGD::_GetJoyAxisDeadZone() { Context* ctx = ImGui::Godot::GetContext(); if (ctx) @@ -139,14 +139,14 @@ float ImGuiGD::_GetJoyAxisDeadZone() return 0.15f; } -void ImGuiGD::_SetScale(float scale) +void ImGuiGD::_SetScale(real_t scale) { Context* ctx = ImGui::Godot::GetContext(); ERR_FAIL_COND(!ctx); ctx->scale = scale; } -float ImGuiGD::_GetScale() +real_t ImGuiGD::_GetScale() { Context* ctx = ImGui::Godot::GetContext(); if (ctx) diff --git a/gdext/src/ImGuiGD.h b/gdext/src/ImGuiGD.h index 53c2a86..3d2790f 100644 --- a/gdext/src/ImGuiGD.h +++ b/gdext/src/ImGuiGD.h @@ -28,14 +28,14 @@ class ImGuiGD : public Object void AddFontDefault(); void RebuildFontAtlas(); - void _SetJoyAxisDeadZone(float zone); - float _GetJoyAxisDeadZone(); + void _SetJoyAxisDeadZone(real_t zone); + real_t _GetJoyAxisDeadZone(); void _SetVisible(bool visible); bool _GetVisible(); - void _SetScale(float scale); - float _GetScale(); + void _SetScale(real_t scale); + real_t _GetScale(); void SetMainViewport(Viewport* vp); void SetIniFilename(String fn);