1 /++
2 + Machine generated D bindings for Sokol library.
3 + 
4 +     Generated on: 2025-06-01 10:38:04
5 + 
6 +     Source header: sokol_imgui.h
7 +     Module: sokol.imgui
8 + 
9 +     Do not edit manually; regenerate using gen_d.py.
10 +/
11 module sokol.imgui;
12 import sg = sokol.gfx;
13 import sapp = sokol.app;
14 
15 enum LogItem {
16     Ok,
17     Malloc_failed,
18 }
19 /++
20 + simgui_allocator_t
21 + 
22 +     Used in simgui_desc_t to provide custom memory-alloc and -free functions
23 +     to sokol_imgui.h. If memory management should be overridden, both the
24 +     alloc_fn and free_fn function must be provided (e.g. it's not valid to
25 +     override one function but not the other).
26 +/
27 extern(C) struct Allocator {
28     extern(C) void* function(size_t, void*) alloc_fn = null;
29     extern(C) void function(void*, void*) free_fn = null;
30     void* user_data = null;
31 }
32 /++
33 + simgui_logger
34 + 
35 +     Used in simgui_desc_t to provide a logging function. Please be aware
36 +     that without logging function, sokol-imgui will be completely
37 +     silent, e.g. it will not report errors, warnings and
38 +     validation layer messages. For maximum error verbosity,
39 +     compile in debug mode (e.g. NDEBUG *not* defined) and install
40 +     a logger (for instance the standard logging function from sokol_log.h).
41 +/
42 extern(C) struct Logger {
43     extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null;
44     void* user_data = null;
45 }
46 extern(C) struct Desc {
47     int max_vertices = 0;
48     sg.PixelFormat color_format = sg.PixelFormat.Default;
49     sg.PixelFormat depth_format = sg.PixelFormat.Default;
50     int sample_count = 0;
51     const(char)* ini_filename = null;
52     bool no_default_font = false;
53     bool disable_paste_override = false;
54     bool disable_set_mouse_cursor = false;
55     bool disable_windows_resize_from_edges = false;
56     bool write_alpha_channel = false;
57     Allocator allocator = {};
58     Logger logger = {};
59 }
60 extern(C) struct FrameDesc {
61     int width = 0;
62     int height = 0;
63     double delta_time = 0.0;
64     float dpi_scale = 0.0f;
65 }
66 extern(C) struct FontTexDesc {
67     sg.Filter min_filter = sg.Filter.Default;
68     sg.Filter mag_filter = sg.Filter.Default;
69 }
70 extern(C) void simgui_setup(const Desc* desc) @system @nogc nothrow pure;
71 void setup(scope ref Desc desc) @trusted @nogc nothrow pure {
72     simgui_setup(&desc);
73 }
74 extern(C) void simgui_new_frame(const FrameDesc* desc) @system @nogc nothrow pure;
75 void newFrame(scope ref FrameDesc desc) @trusted @nogc nothrow pure {
76     simgui_new_frame(&desc);
77 }
78 extern(C) void simgui_render() @system @nogc nothrow pure;
79 void render() @trusted @nogc nothrow pure {
80     simgui_render();
81 }
82 extern(C) ulong simgui_imtextureid(sg.Image img) @system @nogc nothrow pure;
83 ulong imtextureid(sg.Image img) @trusted @nogc nothrow pure {
84     return simgui_imtextureid(img);
85 }
86 extern(C) ulong simgui_imtextureid_with_sampler(sg.Image img, sg.Sampler smp) @system @nogc nothrow pure;
87 ulong imtextureidWithSampler(sg.Image img, sg.Sampler smp) @trusted @nogc nothrow pure {
88     return simgui_imtextureid_with_sampler(img, smp);
89 }
90 extern(C) sg.Image simgui_image_from_imtextureid(ulong imtex_id) @system @nogc nothrow pure;
91 sg.Image imageFromImtextureid(ulong imtex_id) @trusted @nogc nothrow pure {
92     return simgui_image_from_imtextureid(imtex_id);
93 }
94 extern(C) sg.Sampler simgui_sampler_from_imtextureid(ulong imtex_id) @system @nogc nothrow pure;
95 sg.Sampler samplerFromImtextureid(ulong imtex_id) @trusted @nogc nothrow pure {
96     return simgui_sampler_from_imtextureid(imtex_id);
97 }
98 extern(C) void simgui_add_focus_event(bool focus) @system @nogc nothrow pure;
99 void addFocusEvent(bool focus) @trusted @nogc nothrow pure {
100     simgui_add_focus_event(focus);
101 }
102 extern(C) void simgui_add_mouse_pos_event(float x, float y) @system @nogc nothrow pure;
103 void addMousePosEvent(float x, float y) @trusted @nogc nothrow pure {
104     simgui_add_mouse_pos_event(x, y);
105 }
106 extern(C) void simgui_add_touch_pos_event(float x, float y) @system @nogc nothrow pure;
107 void addTouchPosEvent(float x, float y) @trusted @nogc nothrow pure {
108     simgui_add_touch_pos_event(x, y);
109 }
110 extern(C) void simgui_add_mouse_button_event(int mouse_button, bool down) @system @nogc nothrow pure;
111 void addMouseButtonEvent(int mouse_button, bool down) @trusted @nogc nothrow pure {
112     simgui_add_mouse_button_event(mouse_button, down);
113 }
114 extern(C) void simgui_add_mouse_wheel_event(float wheel_x, float wheel_y) @system @nogc nothrow pure;
115 void addMouseWheelEvent(float wheel_x, float wheel_y) @trusted @nogc nothrow pure {
116     simgui_add_mouse_wheel_event(wheel_x, wheel_y);
117 }
118 extern(C) void simgui_add_key_event(int imgui_key, bool down) @system @nogc nothrow pure;
119 void addKeyEvent(int imgui_key, bool down) @trusted @nogc nothrow pure {
120     simgui_add_key_event(imgui_key, down);
121 }
122 extern(C) void simgui_add_input_character(uint c) @system @nogc nothrow pure;
123 void addInputCharacter(uint c) @trusted @nogc nothrow pure {
124     simgui_add_input_character(c);
125 }
126 extern(C) void simgui_add_input_characters_utf8(const(char)* c) @system @nogc nothrow pure;
127 void addInputCharactersUtf8(const(char)* c) @trusted @nogc nothrow pure {
128     simgui_add_input_characters_utf8(c);
129 }
130 extern(C) void simgui_add_touch_button_event(int mouse_button, bool down) @system @nogc nothrow pure;
131 void addTouchButtonEvent(int mouse_button, bool down) @trusted @nogc nothrow pure {
132     simgui_add_touch_button_event(mouse_button, down);
133 }
134 extern(C) bool simgui_handle_event(const sapp.Event* ev) @system @nogc nothrow pure;
135 bool handleEvent(scope ref sapp.Event ev) @trusted @nogc nothrow pure {
136     return simgui_handle_event(&ev);
137 }
138 extern(C) int simgui_map_keycode(sapp.Keycode keycode) @system @nogc nothrow pure;
139 int mapKeycode(sapp.Keycode keycode) @trusted @nogc nothrow pure {
140     return simgui_map_keycode(keycode);
141 }
142 extern(C) void simgui_shutdown() @system @nogc nothrow pure;
143 void shutdown() @trusted @nogc nothrow pure {
144     simgui_shutdown();
145 }
146 extern(C) void simgui_create_fonts_texture(const FontTexDesc* desc) @system @nogc nothrow pure;
147 void createFontsTexture(scope ref FontTexDesc desc) @trusted @nogc nothrow pure {
148     simgui_create_fonts_texture(&desc);
149 }
150 extern(C) void simgui_destroy_fonts_texture() @system @nogc nothrow pure;
151 void destroyFontsTexture() @trusted @nogc nothrow pure {
152     simgui_destroy_fonts_texture();
153 }