11const gui = @import ("gui.zig" );
2+ const options = @import ("zgui_options" );
23
34// This call will install GLFW callbacks to handle GUI interactions.
45// Those callbacks will chain-call user's previously installed callbacks, if any.
56// This means that custom user's callbacks need to be installed *before* calling zgpu.gui.init().
67pub fn init (
78 window : * const anyopaque , // zglfw.Window
89) void {
10+ const ImGui_ImplGlfw_InitForOther = @extern (* const fn (window : * const anyopaque , install_callbacks : bool ) callconv (.c ) bool , .{
11+ .name = "ImGui_ImplGlfw_InitForOther" ,
12+ .is_dll_import = options .shared ,
13+ });
14+
915 if (! ImGui_ImplGlfw_InitForOther (window , true )) {
1016 unreachable ;
1117 }
@@ -14,6 +20,11 @@ pub fn init(
1420pub fn initOpenGL (
1521 window : * const anyopaque , // zglfw.Window
1622) void {
23+ const ImGui_ImplGlfw_InitForOpenGL = @extern (* const fn (window : * const anyopaque , install_callbacks : bool ) callconv (.c ) bool , .{
24+ .name = "ImGui_ImplGlfw_InitForOpenGL" ,
25+ .is_dll_import = options .shared ,
26+ });
27+
1728 if (! ImGui_ImplGlfw_InitForOpenGL (window , true )) {
1829 unreachable ;
1930 }
@@ -22,23 +33,28 @@ pub fn initOpenGL(
2233pub fn initVulkan (
2334 window : * const anyopaque , // zglfw.Window
2435) void {
36+ const ImGui_ImplGlfw_InitForVulkan = @extern (* const fn (window : * const anyopaque , install_callbacks : bool ) callconv (.c ) bool , .{
37+ .name = "ImGui_ImplGlfw_InitForVulkan" ,
38+ .is_dll_import = options .shared ,
39+ });
40+
2541 if (! ImGui_ImplGlfw_InitForVulkan (window , true )) {
2642 unreachable ;
2743 }
2844}
2945
3046pub fn deinit () void {
47+ const ImGui_ImplGlfw_Shutdown = @extern (* const fn () callconv (.c ) void , .{
48+ .name = "ImGui_ImplGlfw_Shutdown" ,
49+ .is_dll_import = options .shared ,
50+ });
3151 ImGui_ImplGlfw_Shutdown ();
3252}
3353
3454pub fn newFrame () void {
55+ const ImGui_ImplGlfw_NewFrame = @extern (* const fn () callconv (.c ) void , .{
56+ .name = "ImGui_ImplGlfw_NewFrame" ,
57+ .is_dll_import = options .shared ,
58+ });
3559 ImGui_ImplGlfw_NewFrame ();
3660}
37-
38- // Those functions are defined in `imgui_impl_glfw.cpp`
39- // (they include few custom changes).
40- extern fn ImGui_ImplGlfw_InitForOther (window : * const anyopaque , install_callbacks : bool ) bool ;
41- extern fn ImGui_ImplGlfw_InitForOpenGL (window : * const anyopaque , install_callbacks : bool ) bool ;
42- extern fn ImGui_ImplGlfw_InitForVulkan (window : * const anyopaque , install_callbacks : bool ) bool ;
43- extern fn ImGui_ImplGlfw_NewFrame () void ;
44- extern fn ImGui_ImplGlfw_Shutdown () void ;
0 commit comments