1
1
const gui = @import ("gui.zig" );
2
+ const options = @import ("zgui_options" );
2
3
3
4
// This call will install GLFW callbacks to handle GUI interactions.
4
5
// Those callbacks will chain-call user's previously installed callbacks, if any.
5
6
// This means that custom user's callbacks need to be installed *before* calling zgpu.gui.init().
6
7
pub fn init (
7
8
window : * const anyopaque , // zglfw.Window
8
9
) 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
+
9
15
if (! ImGui_ImplGlfw_InitForOther (window , true )) {
10
16
unreachable ;
11
17
}
@@ -14,6 +20,11 @@ pub fn init(
14
20
pub fn initOpenGL (
15
21
window : * const anyopaque , // zglfw.Window
16
22
) 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
+
17
28
if (! ImGui_ImplGlfw_InitForOpenGL (window , true )) {
18
29
unreachable ;
19
30
}
@@ -22,23 +33,28 @@ pub fn initOpenGL(
22
33
pub fn initVulkan (
23
34
window : * const anyopaque , // zglfw.Window
24
35
) 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
+
25
41
if (! ImGui_ImplGlfw_InitForVulkan (window , true )) {
26
42
unreachable ;
27
43
}
28
44
}
29
45
30
46
pub 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
+ });
31
51
ImGui_ImplGlfw_Shutdown ();
32
52
}
33
53
34
54
pub 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
+ });
35
59
ImGui_ImplGlfw_NewFrame ();
36
60
}
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