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