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