11const gui = @import ("gui.zig" );
2- const options = @import ("zgui_options" );
32
43// This call will install GLFW callbacks to handle GUI interactions.
54// Those callbacks will chain-call user's previously installed callbacks, if any.
65// This means that custom user's callbacks need to be installed *before* calling zgpu.gui.init().
76pub fn init (
87 window : * const anyopaque , // zglfw.Window
98) 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-
159 if (! ImGui_ImplGlfw_InitForOther (window , true )) {
1610 unreachable ;
1711 }
@@ -20,11 +14,6 @@ pub fn init(
2014pub fn initOpenGL (
2115 window : * const anyopaque , // zglfw.Window
2216) 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-
2817 if (! ImGui_ImplGlfw_InitForOpenGL (window , true )) {
2918 unreachable ;
3019 }
@@ -33,28 +22,23 @@ pub fn initOpenGL(
3322pub fn initVulkan (
3423 window : * const anyopaque , // zglfw.Window
3524) 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-
4125 if (! ImGui_ImplGlfw_InitForVulkan (window , true )) {
4226 unreachable ;
4327 }
4428}
4529
4630pub 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- });
5131 ImGui_ImplGlfw_Shutdown ();
5232}
5333
5434pub 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- });
5935 ImGui_ImplGlfw_NewFrame ();
6036}
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