1 // machine generated, do not edit 2 3 module sokol.imgui; 4 import sg = sokol.gfx; 5 import sapp = sokol.app; 6 7 enum invalid_id = 0; 8 extern(C) 9 struct Image { 10 uint id = 0; 11 } 12 extern(C) 13 struct ImageDesc { 14 sg.Image image; 15 sg.Sampler sampler; 16 } 17 enum LogItem { 18 Ok, 19 Malloc_failed, 20 Image_pool_exhausted, 21 } 22 extern(C) 23 struct Allocator { 24 extern(C) void* function(size_t, void*) alloc_fn = null; 25 extern(C) void function(void*, void*) free_fn = null; 26 void* user_data = null; 27 } 28 extern(C) 29 struct Logger { 30 extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null; 31 void* user_data = null; 32 } 33 extern(C) 34 struct Desc { 35 int max_vertices = 0; 36 int image_pool_size = 0; 37 sg.PixelFormat color_format; 38 sg.PixelFormat depth_format; 39 int sample_count = 0; 40 const(char)* ini_filename = null; 41 bool no_default_font = false; 42 bool disable_paste_override = false; 43 bool disable_set_mouse_cursor = false; 44 bool disable_windows_resize_from_edges = false; 45 bool write_alpha_channel = false; 46 Allocator allocator; 47 Logger logger; 48 } 49 extern(C) 50 struct FrameDesc { 51 int width = 0; 52 int height = 0; 53 double delta_time = 0.0; 54 float dpi_scale = 0.0f; 55 } 56 extern(C) 57 struct FontTexDesc { 58 sg.Filter min_filter; 59 sg.Filter mag_filter; 60 } 61 extern(C) void simgui_setup(const Desc *) @system @nogc nothrow; 62 void setup(scope ref Desc desc) @trusted @nogc nothrow { 63 simgui_setup(&desc); 64 } 65 extern(C) void simgui_new_frame(const FrameDesc *) @system @nogc nothrow; 66 void newFrame(scope ref FrameDesc desc) @trusted @nogc nothrow { 67 simgui_new_frame(&desc); 68 } 69 extern(C) void simgui_render() @system @nogc nothrow; 70 void render() @trusted @nogc nothrow { 71 simgui_render(); 72 } 73 extern(C) Image simgui_make_image(const ImageDesc *) @system @nogc nothrow; 74 Image makeImage(scope ref ImageDesc desc) @trusted @nogc nothrow { 75 return simgui_make_image(&desc); 76 } 77 extern(C) void simgui_destroy_image(Image) @system @nogc nothrow; 78 void destroyImage(Image img) @trusted @nogc nothrow { 79 simgui_destroy_image(img); 80 } 81 extern(C) ImageDesc simgui_query_image_desc(Image) @system @nogc nothrow; 82 ImageDesc queryImageDesc(Image img) @trusted @nogc nothrow { 83 return simgui_query_image_desc(img); 84 } 85 extern(C) ulong simgui_imtextureid(Image) @system @nogc nothrow; 86 ulong imtextureid(Image img) @trusted @nogc nothrow { 87 return simgui_imtextureid(img); 88 } 89 extern(C) Image simgui_image_from_imtextureid(ulong) @system @nogc nothrow; 90 Image imageFromImtextureid(ulong im_texture_id) @trusted @nogc nothrow { 91 return simgui_image_from_imtextureid(im_texture_id); 92 } 93 extern(C) void simgui_add_focus_event(bool) @system @nogc nothrow; 94 void addFocusEvent(bool focus) @trusted @nogc nothrow { 95 simgui_add_focus_event(focus); 96 } 97 extern(C) void simgui_add_mouse_pos_event(float, float) @system @nogc nothrow; 98 void addMousePosEvent(float x, float y) @trusted @nogc nothrow { 99 simgui_add_mouse_pos_event(x, y); 100 } 101 extern(C) void simgui_add_touch_pos_event(float, float) @system @nogc nothrow; 102 void addTouchPosEvent(float x, float y) @trusted @nogc nothrow { 103 simgui_add_touch_pos_event(x, y); 104 } 105 extern(C) void simgui_add_mouse_button_event(int, bool) @system @nogc nothrow; 106 void addMouseButtonEvent(int mouse_button, bool down) @trusted @nogc nothrow { 107 simgui_add_mouse_button_event(mouse_button, down); 108 } 109 extern(C) void simgui_add_mouse_wheel_event(float, float) @system @nogc nothrow; 110 void addMouseWheelEvent(float wheel_x, float wheel_y) @trusted @nogc nothrow { 111 simgui_add_mouse_wheel_event(wheel_x, wheel_y); 112 } 113 extern(C) void simgui_add_key_event(int, bool) @system @nogc nothrow; 114 void addKeyEvent(int imgui_key, bool down) @trusted @nogc nothrow { 115 simgui_add_key_event(imgui_key, down); 116 } 117 extern(C) void simgui_add_input_character(uint) @system @nogc nothrow; 118 void addInputCharacter(uint c) @trusted @nogc nothrow { 119 simgui_add_input_character(c); 120 } 121 extern(C) void simgui_add_input_characters_utf8(const(char)*) @system @nogc nothrow; 122 void addInputCharactersUtf8(scope const(char)* c) @trusted @nogc nothrow { 123 simgui_add_input_characters_utf8(c); 124 } 125 extern(C) void simgui_add_touch_button_event(int, bool) @system @nogc nothrow; 126 void addTouchButtonEvent(int mouse_button, bool down) @trusted @nogc nothrow { 127 simgui_add_touch_button_event(mouse_button, down); 128 } 129 extern(C) bool simgui_handle_event(const sapp.Event *) @system @nogc nothrow; 130 bool handleEvent(scope ref sapp.Event ev) @trusted @nogc nothrow { 131 return simgui_handle_event(&ev); 132 } 133 extern(C) int simgui_map_keycode(sapp.Keycode) @system @nogc nothrow; 134 int mapKeycode(sapp.Keycode keycode) @trusted @nogc nothrow { 135 return simgui_map_keycode(keycode); 136 } 137 extern(C) void simgui_shutdown() @system @nogc nothrow; 138 void shutdown() @trusted @nogc nothrow { 139 simgui_shutdown(); 140 } 141 extern(C) void simgui_create_fonts_texture(const FontTexDesc *) @system @nogc nothrow; 142 void createFontsTexture(scope ref FontTexDesc desc) @trusted @nogc nothrow { 143 simgui_create_fonts_texture(&desc); 144 } 145 extern(C) void simgui_destroy_fonts_texture() @system @nogc nothrow; 146 void destroyFontsTexture() @trusted @nogc nothrow { 147 simgui_destroy_fonts_texture(); 148 }