├── imgui_gamemaker_example ├── objects │ └── obj_imgui_demo │ │ ├── Draw_0.gml │ │ ├── CleanUp_0.gml │ │ ├── Create_0.gml │ │ ├── Step_0.gml │ │ └── obj_imgui_demo.yy ├── extensions │ └── ext_imgui │ │ └── imgui_gamemaker.dll ├── options │ ├── extensions │ │ ├── Ext_ImGui.json │ │ └── Extension1.json │ ├── operagx │ │ └── options_operagx.yy │ ├── main │ │ └── options_main.yy │ ├── linux │ │ └── options_linux.yy │ ├── mac │ │ └── options_mac.yy │ └── windows │ │ └── options_windows.yy ├── scripts │ ├── scr_imgui │ │ └── scr_imgui.yy │ ├── scr_imgui_demo │ │ ├── scr_imgui_demo.yy │ │ └── scr_imgui_demo.gml │ └── scr_imgui_macrosandenums │ │ └── scr_imgui_macrosandenums.yy ├── imgui_gamemaker_example.yyp └── rooms │ └── room1 │ └── room1.yy ├── old stuff ├── usage_example │ ├── objects │ │ ├── Obj_IMGUI_demo │ │ │ ├── CleanUp_0.gml │ │ │ ├── Draw_64.gml │ │ │ ├── Step_0.gml │ │ │ ├── Create_0.gml │ │ │ └── obj_imgui_demo.yy │ │ ├── Obj_ImGuiExample │ │ │ ├── CleanUp_0.gml │ │ │ ├── Draw_64.gml │ │ │ ├── Create_0.gml │ │ │ ├── Obj_ImGuiExample.yy │ │ │ └── Step_0.gml │ │ └── Obj_ImGuiTesting │ │ │ ├── Draw_64.gml │ │ │ ├── CleanUp_0.gml │ │ │ ├── Create_0.gml │ │ │ ├── Obj_ImGuiTesting.yy │ │ │ ├── Obj_ImGuiExample.yy │ │ │ └── Step_0.gml │ ├── extensions │ │ └── Ext_imgui │ │ │ └── imgui_gamemaker.dll │ ├── sprites │ │ ├── Spr_Test │ │ │ ├── 3d495b27-92a2-4e66-aa92-17005f19873e.png │ │ │ ├── layers │ │ │ │ └── 3d495b27-92a2-4e66-aa92-17005f19873e │ │ │ │ │ └── e2307e29-7526-4c21-9ac7-03d614ebc8a5.png │ │ │ └── spr_test.yy │ │ └── Spr_Test2 │ │ │ ├── 3d495b27-92a2-4e66-aa92-17005f19873e.png │ │ │ ├── layers │ │ │ └── 3d495b27-92a2-4e66-aa92-17005f19873e │ │ │ │ └── e2307e29-7526-4c21-9ac7-03d614ebc8a5.png │ │ │ └── Spr_Test2.yy │ ├── notes │ │ └── TODO │ │ │ ├── TODO.txt │ │ │ └── TODO.yy │ ├── options │ │ ├── extensions │ │ │ └── Ext_imgui.json │ │ ├── operagx │ │ │ └── options_operagx.yy │ │ ├── main │ │ │ └── options_main.yy │ │ ├── linux │ │ │ └── options_linux.yy │ │ ├── mac │ │ │ └── options_mac.yy │ │ └── windows │ │ │ └── options_windows.yy │ ├── scripts │ │ ├── TestStruct │ │ │ ├── TestStruct.gml │ │ │ └── TestStruct.yy │ │ ├── IMGUI │ │ │ └── imgui.yy │ │ ├── IMGUI_demo │ │ │ └── imgui_demo.yy │ │ └── IMGUI_EnumsAndMacros │ │ │ └── imgui_enumsandmacros.yy │ ├── usage_example.yyp │ └── rooms │ │ ├── Room1 │ │ └── Room1.yy │ │ └── Rm_IMGUI_demo │ │ └── Rm_IMGUI_demo.yy └── imgui_gamemaker_x64 │ ├── src │ ├── Buffer.h │ └── Buffer.cpp │ ├── imgui │ ├── LICENSE.txt │ ├── imgui_stdlib.h │ ├── imgui_impl_dx11.h │ ├── imgui_impl_win32.h │ ├── imgui_stdlib.cpp │ ├── imconfig.h │ └── imstb_rectpack.h │ ├── imgui_gamemaker_x64.sln │ ├── imgui_gamemaker_x64.vcxproj.filters │ └── imgui_gamemaker_x64.vcxproj ├── README.md ├── imgui_gamemaker ├── src │ ├── Buffer.h │ └── Buffer.cpp ├── imgui │ ├── LICENSE.txt │ ├── imgui_stdlib.h │ ├── imgui_impl_dx11.h │ ├── imgui_impl_win32.h │ ├── imgui_stdlib.cpp │ ├── imconfig.h │ └── imstb_rectpack.h ├── imgui_gamemaker.sln ├── imgui_gamemaker.vcxproj.filters └── imgui_gamemaker.vcxproj ├── LICENSE └── .gitignore /imgui_gamemaker_example/objects/obj_imgui_demo/Draw_0.gml: -------------------------------------------------------------------------------- 1 | imgui_render(); -------------------------------------------------------------------------------- /imgui_gamemaker_example/objects/obj_imgui_demo/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | imgui_cleanup(); -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_IMGUI_demo/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | imgui_cleanup(); -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiExample/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | imgui_cleanup(); -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiExample/Draw_64.gml: -------------------------------------------------------------------------------- 1 | imgui_render(); -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiTesting/Draw_64.gml: -------------------------------------------------------------------------------- 1 | imgui_render(); -------------------------------------------------------------------------------- /imgui_gamemaker_example/objects/obj_imgui_demo/Create_0.gml: -------------------------------------------------------------------------------- 1 | imgui_setup(); 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # imgui-gamemaker 2 | A Dear ImGui dll extension for GameMaker Studio 2 3 | -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_IMGUI_demo/Draw_64.gml: -------------------------------------------------------------------------------- 1 | imgui_render(); 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiTesting/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | imgui_save_ini_settings_to_disk(@"C:/Users/brand/Downloads/imgui.ini") 2 | imgui_cleanup(); -------------------------------------------------------------------------------- /imgui_gamemaker_example/extensions/ext_imgui/imgui_gamemaker.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noiamhippyman/imgui-gamemaker/HEAD/imgui_gamemaker_example/extensions/ext_imgui/imgui_gamemaker.dll -------------------------------------------------------------------------------- /old stuff/usage_example/extensions/Ext_imgui/imgui_gamemaker.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noiamhippyman/imgui-gamemaker/HEAD/old stuff/usage_example/extensions/Ext_imgui/imgui_gamemaker.dll -------------------------------------------------------------------------------- /imgui_gamemaker_example/options/extensions/Ext_ImGui.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionId": null, 3 | "resourceVersion": "1.0", 4 | "resourceType": "GMExtensionConfigSet", 5 | "configurables": null 6 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/options/extensions/Extension1.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionId": null, 3 | "resourceVersion": "1.0", 4 | "resourceType": "GMExtensionConfigSet", 5 | "configurables": null 6 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/objects/obj_imgui_demo/Step_0.gml: -------------------------------------------------------------------------------- 1 | imgui_newframe(); 2 | 3 | 4 | 5 | imgui_show_demo_window(true); 6 | 7 | 8 | 9 | imgui_demo_show_demo_window_widgets(); 10 | 11 | 12 | -------------------------------------------------------------------------------- /old stuff/usage_example/sprites/Spr_Test/3d495b27-92a2-4e66-aa92-17005f19873e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noiamhippyman/imgui-gamemaker/HEAD/old stuff/usage_example/sprites/Spr_Test/3d495b27-92a2-4e66-aa92-17005f19873e.png -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiExample/Create_0.gml: -------------------------------------------------------------------------------- 1 | show_demo_window = false; 2 | show_about_window = false; 3 | show_metrics_window = false; 4 | show_style_editor = false; 5 | show_user_guide = false; 6 | imgui_setup(); -------------------------------------------------------------------------------- /old stuff/usage_example/sprites/Spr_Test2/3d495b27-92a2-4e66-aa92-17005f19873e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noiamhippyman/imgui-gamemaker/HEAD/old stuff/usage_example/sprites/Spr_Test2/3d495b27-92a2-4e66-aa92-17005f19873e.png -------------------------------------------------------------------------------- /old stuff/usage_example/notes/TODO/TODO.txt: -------------------------------------------------------------------------------- 1 | GetFont()/PushFont()/PopFont() - figure out way to load and store fonts to use these 2 | 3 | give access to ImGui::GetIO 4 | 5 | figure out ImTextureID for anything related to Images/Textures/Sprites -------------------------------------------------------------------------------- /old stuff/usage_example/notes/TODO/TODO.yy: -------------------------------------------------------------------------------- 1 | { 2 | "parent": { 3 | "name": "Testing", 4 | "path": "folders/Testing.yy", 5 | }, 6 | "resourceVersion": "1.1", 7 | "name": "TODO", 8 | "tags": [], 9 | "resourceType": "GMNotes", 10 | } -------------------------------------------------------------------------------- /old stuff/usage_example/options/extensions/Ext_imgui.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionId": { 3 | "name": "Ext_imgui", 4 | "path": "extensions/Ext_imgui/Ext_imgui.yy" 5 | }, 6 | "resourceVersion": "1.0", 7 | "resourceType": "GMExtensionConfigSet", 8 | "configurables": null 9 | } -------------------------------------------------------------------------------- /old stuff/usage_example/scripts/TestStruct/TestStruct.gml: -------------------------------------------------------------------------------- 1 | // Script assets have changed for v2.3.0 see 2 | // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information 3 | function TestStruct(_str,_real) constructor { 4 | str_var = _str; 5 | num_var = _real; 6 | } -------------------------------------------------------------------------------- /old stuff/usage_example/scripts/IMGUI/imgui.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "IMGUI", 6 | "path": "folders/IMGUI.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "IMGUI", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /old stuff/usage_example/sprites/Spr_Test/layers/3d495b27-92a2-4e66-aa92-17005f19873e/e2307e29-7526-4c21-9ac7-03d614ebc8a5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noiamhippyman/imgui-gamemaker/HEAD/old stuff/usage_example/sprites/Spr_Test/layers/3d495b27-92a2-4e66-aa92-17005f19873e/e2307e29-7526-4c21-9ac7-03d614ebc8a5.png -------------------------------------------------------------------------------- /old stuff/usage_example/sprites/Spr_Test2/layers/3d495b27-92a2-4e66-aa92-17005f19873e/e2307e29-7526-4c21-9ac7-03d614ebc8a5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noiamhippyman/imgui-gamemaker/HEAD/old stuff/usage_example/sprites/Spr_Test2/layers/3d495b27-92a2-4e66-aa92-17005f19873e/e2307e29-7526-4c21-9ac7-03d614ebc8a5.png -------------------------------------------------------------------------------- /old stuff/usage_example/scripts/IMGUI_demo/imgui_demo.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "IMGUI", 6 | "path": "folders/IMGUI.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "IMGUI_demo", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /old stuff/usage_example/scripts/TestStruct/TestStruct.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Testing", 6 | "path": "folders/Testing.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "TestStruct", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/scripts/scr_imgui/scr_imgui.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "imgui_gamemaker_example", 6 | "path": "imgui_gamemaker_example.yyp", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "Scr_ImGui", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /old stuff/usage_example/scripts/IMGUI_EnumsAndMacros/imgui_enumsandmacros.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "IMGUI", 6 | "path": "folders/IMGUI.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "IMGUI_EnumsAndMacros", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/scripts/scr_imgui_demo/scr_imgui_demo.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "imgui_gamemaker_example", 6 | "path": "imgui_gamemaker_example.yyp", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "Scr_ImGui_Demo", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/scripts/scr_imgui_macrosandenums/scr_imgui_macrosandenums.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "imgui_gamemaker_example", 6 | "path": "imgui_gamemaker_example.yyp", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "Scr_ImGui_MacrosAndEnums", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_IMGUI_demo/Step_0.gml: -------------------------------------------------------------------------------- 1 | //if (keyboard_check(ord("1"))) { imgui_set_font(font0); } 2 | //if (keyboard_check(ord("2"))) { imgui_set_font(font1); } 3 | //if (keyboard_check(ord("3"))) { imgui_set_font(font2); } 4 | //if (keyboard_check(ord("4"))) { imgui_set_font(font3); } 5 | 6 | imgui_newframe(); 7 | 8 | //imgui_show_user_guide_gml(); 9 | 10 | imgui_set_next_window_size(550,400,0); 11 | imgui_begin("Test",noone,0); 12 | 13 | imgui_show_demo_window_widgets_gml(); 14 | 15 | 16 | imgui_end(); 17 | 18 | imgui_show_demo_window(noone); -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_IMGUI_demo/Create_0.gml: -------------------------------------------------------------------------------- 1 | imgui_setup(); 2 | 3 | //var filename = @"C:\Users\brand\Downloads\Source_Code_Pro\SourceCodePro-Regular.ttf"; 4 | //font_1 = imgui_fonts_add_font_from_file_ttf(filename,24,0,0); 5 | font0 = imgui_fonts_add_font_default(); 6 | //font1 = imgui_fonts_add_font_from_file_ttf(@"C:\Users\brand\Downloads\TestFonts\OpenSans-Regular.ttf",12,0,0); 7 | font3 = imgui_fonts_add_font_from_file_ttf(@"C:\Users\brand\Downloads\TestFonts\NotoSansJP-Regular.otf",20,0,imgui_fonts_get_glyph_range_japanese()); 8 | imgui_fonts_build(); 9 | 10 | imgui_load_image(Spr_Test); -------------------------------------------------------------------------------- /old stuff/usage_example/options/operagx/options_operagx.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_operagx_version": "1.0.0.0", 3 | "option_operagx_next_version": "1.0.0.0", 4 | "option_operagx_game_name": "${project_name}", 5 | "option_operagx_interpolate_pixels": true, 6 | "option_operagx_scale": 0, 7 | "option_operagx_texture_page": "2048x2048", 8 | "option_operagx_display_cursor": true, 9 | "option_operagx_guid": "", 10 | "option_operagx_team_name": "", 11 | "option_operagx_editUrl": "", 12 | "option_operagx_internalShareUrl": "", 13 | "option_operagx_publicShareUrl": "", 14 | "resourceVersion": "1.0", 15 | "name": "operagx", 16 | "tags": [], 17 | "resourceType": "GMOperaGXOptions", 18 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/options/operagx/options_operagx.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_operagx_version": "1.0.0.0", 3 | "option_operagx_next_version": "1.0.0.0", 4 | "option_operagx_game_name": "${project_name}", 5 | "option_operagx_interpolate_pixels": true, 6 | "option_operagx_scale": 0, 7 | "option_operagx_texture_page": "2048x2048", 8 | "option_operagx_display_cursor": true, 9 | "option_operagx_guid": "", 10 | "option_operagx_team_name": "", 11 | "option_operagx_team_id": "", 12 | "option_operagx_editUrl": "", 13 | "option_operagx_internalShareUrl": "", 14 | "option_operagx_publicShareUrl": "", 15 | "resourceVersion": "1.0", 16 | "name": "operagx", 17 | "tags": [], 18 | "resourceType": "GMOperaGXOptions", 19 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/options/main/options_main.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_gameguid": "c40570c0-5190-4152-9778-83d7de90ef9c", 3 | "option_gameid": "0", 4 | "option_game_speed": 60, 5 | "option_mips_for_3d_textures": false, 6 | "option_draw_colour": 4294967295, 7 | "option_window_colour": 255, 8 | "option_steam_app_id": "0", 9 | "option_sci_usesci": false, 10 | "option_author": "", 11 | "option_collision_compatibility": false, 12 | "option_copy_on_write_enabled": false, 13 | "option_spine_licence": false, 14 | "option_template_image": "${base_options_dir}/main/template_image.png", 15 | "option_template_icon": "${base_options_dir}/main/template_icon.png", 16 | "option_template_description": null, 17 | "resourceVersion": "1.4", 18 | "name": "Main", 19 | "tags": [], 20 | "resourceType": "GMMainOptions", 21 | } -------------------------------------------------------------------------------- /old stuff/usage_example/options/main/options_main.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_gameguid": "896ff582-9330-4993-bd0a-c776d20016be", 3 | "option_gameid": "0", 4 | "option_game_speed": 60, 5 | "option_mips_for_3d_textures": false, 6 | "option_draw_colour": 4294967295, 7 | "option_window_colour": 255, 8 | "option_steam_app_id": "0", 9 | "option_sci_usesci": false, 10 | "option_author": "", 11 | "option_collision_compatibility": true, 12 | "option_copy_on_write_enabled": true, 13 | "option_lastchanged": "", 14 | "option_spine_licence": false, 15 | "option_template_image": "${base_options_dir}/main/template_image.png", 16 | "option_template_icon": "${base_options_dir}/main/template_icon.png", 17 | "option_template_description": null, 18 | "resourceVersion": "1.4", 19 | "name": "Main", 20 | "tags": [], 21 | "resourceType": "GMMainOptions", 22 | } -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiTesting/Create_0.gml: -------------------------------------------------------------------------------- 1 | imgui_setup(); 2 | imgui_load_ini_settings_from_disk(@"C:/Users/brand/Downloads/imgui.ini"); 3 | 4 | open = true; 5 | 6 | items = ["AAA","BBB","CCC","DDD","EEE"]; 7 | current_item = items[0]; 8 | current_index = 0; 9 | 10 | float_v_current_min = 0; 11 | float_v_current_max = 0; 12 | 13 | int_v_current_min = 0; 14 | int_v_current_max = 0; 15 | 16 | int_v = [1,2,3,4]; 17 | float_v = [0,0.25,0.5,0.75]; 18 | color = [1.0,0.5,0.2,1.0]; 19 | 20 | slider_angle = 0; 21 | 22 | input_text = "Hello there!"; 23 | multiline_input_text = "Hello there multi-lines!"; 24 | input_text_with_hint = "Hello there with hints!"; 25 | 26 | collapsing_header_open = true; 27 | 28 | menu_enabled = false; 29 | submenu_enabled = false; 30 | 31 | modal_open = true; 32 | 33 | avocado_open = true; 34 | broccoli_open = true; 35 | cucumber_open = true; -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/src/Buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | 5 | typedef int BufferDataType; 6 | enum BufferDataType_ { 7 | BufferDataType_Float, 8 | BufferDataType_String 9 | }; 10 | 11 | union charfloat { 12 | unsigned char c[4]; 13 | float f; 14 | }; 15 | 16 | class Buffer 17 | { 18 | public: 19 | Buffer(void* data, unsigned int data_size); 20 | void* get_data(); 21 | void set_data(void* data, unsigned int data_size); 22 | 23 | void seek(unsigned int index); 24 | 25 | void write(float value); 26 | void write(std::string value); 27 | float read_float(); 28 | std::string read_string(); 29 | 30 | void poke(unsigned int offset, float value); 31 | void poke(unsigned int offset, std::string value); 32 | float peek_float(unsigned int offset); 33 | std::string peek_string(unsigned int offset); 34 | 35 | private: 36 | unsigned char* data; 37 | unsigned int data_size; 38 | unsigned int data_index; 39 | }; 40 | 41 | -------------------------------------------------------------------------------- /imgui_gamemaker_example/options/linux/options_linux.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_linux_display_name": "Created with GameMaker", 3 | "option_linux_version": "1.0.0.0", 4 | "option_linux_maintainer_email": "", 5 | "option_linux_homepage": "http://www.yoyogames.com", 6 | "option_linux_short_desc": "", 7 | "option_linux_long_desc": "", 8 | "option_linux_splash_screen": "${base_options_dir}/linux/splash/splash.png", 9 | "option_linux_display_splash": false, 10 | "option_linux_icon": "${base_options_dir}/linux/icons/64.png", 11 | "option_linux_start_fullscreen": false, 12 | "option_linux_allow_fullscreen": false, 13 | "option_linux_interpolate_pixels": true, 14 | "option_linux_display_cursor": true, 15 | "option_linux_sync": false, 16 | "option_linux_resize_window": false, 17 | "option_linux_scale": 0, 18 | "option_linux_texture_page": "2048x2048", 19 | "option_linux_enable_steam": false, 20 | "option_linux_disable_sandbox": false, 21 | "resourceVersion": "1.0", 22 | "name": "Linux", 23 | "tags": [], 24 | "resourceType": "GMLinuxOptions", 25 | } -------------------------------------------------------------------------------- /old stuff/usage_example/options/linux/options_linux.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_linux_display_name": "Created with GameMaker Studio 2", 3 | "option_linux_version": "1.0.0.0", 4 | "option_linux_maintainer_email": "", 5 | "option_linux_homepage": "http://www.yoyogames.com", 6 | "option_linux_short_desc": "", 7 | "option_linux_long_desc": "", 8 | "option_linux_splash_screen": "${base_options_dir}/linux/splash/splash.png", 9 | "option_linux_display_splash": false, 10 | "option_linux_icon": "${base_options_dir}/linux/icons/64.png", 11 | "option_linux_start_fullscreen": false, 12 | "option_linux_allow_fullscreen": false, 13 | "option_linux_interpolate_pixels": true, 14 | "option_linux_display_cursor": true, 15 | "option_linux_sync": false, 16 | "option_linux_resize_window": false, 17 | "option_linux_scale": 0, 18 | "option_linux_texture_page": "2048x2048", 19 | "option_linux_enable_steam": false, 20 | "option_linux_disable_sandbox": true, 21 | "resourceVersion": "1.0", 22 | "name": "Linux", 23 | "tags": [], 24 | "resourceType": "GMLinuxOptions", 25 | } -------------------------------------------------------------------------------- /imgui_gamemaker/src/Buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | 5 | typedef int BufferDataType; 6 | enum BufferDataType_ { 7 | BufferDataType_Float, 8 | BufferDataType_String 9 | }; 10 | 11 | union charfloat { 12 | unsigned char c[4]; 13 | float f; 14 | }; 15 | 16 | union chardub { 17 | unsigned char c[8]; 18 | double d; 19 | }; 20 | 21 | class Buffer 22 | { 23 | public: 24 | Buffer(void* data, unsigned int data_size); 25 | void* get_data(); 26 | void set_data(void* data, unsigned int data_size); 27 | 28 | void seek(unsigned int index); 29 | 30 | void write(int value); 31 | void write(bool value); 32 | void write(float value); 33 | void write(double value); 34 | void write(std::string value); 35 | float read_float(); 36 | double read_double(); 37 | std::string read_string(); 38 | 39 | void poke(unsigned int offset, float value); 40 | void poke(unsigned int offset, std::string value); 41 | float peek_float(unsigned int offset); 42 | std::string peek_string(unsigned int offset); 43 | 44 | private: 45 | unsigned char* data; 46 | unsigned int data_size; 47 | unsigned int data_index; 48 | }; 49 | 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Brandon Schmeidler 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /imgui_gamemaker/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2022 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /imgui_gamemaker/imgui_gamemaker.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.2.32602.215 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imgui_gamemaker", "imgui_gamemaker.vcxproj", "{55F044CE-5AC2-4B9C-A626-CD15618E5823}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {55F044CE-5AC2-4B9C-A626-CD15618E5823}.Debug|x64.ActiveCfg = Debug|x64 15 | {55F044CE-5AC2-4B9C-A626-CD15618E5823}.Debug|x64.Build.0 = Debug|x64 16 | {55F044CE-5AC2-4B9C-A626-CD15618E5823}.Release|x64.ActiveCfg = Release|x64 17 | {55F044CE-5AC2-4B9C-A626-CD15618E5823}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {1F29389A-A09F-40C3-8A3E-F987FB8148A9} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2022 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui_gamemaker_x64.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32407.343 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imgui_gamemaker_x64", "imgui_gamemaker_x64.vcxproj", "{AC810538-43A6-4050-AC8C-71B015560589}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {AC810538-43A6-4050-AC8C-71B015560589}.Debug|x64.ActiveCfg = Debug|x64 15 | {AC810538-43A6-4050-AC8C-71B015560589}.Debug|x64.Build.0 = Debug|x64 16 | {AC810538-43A6-4050-AC8C-71B015560589}.Release|x64.ActiveCfg = Release|x64 17 | {AC810538-43A6-4050-AC8C-71B015560589}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {6A018419-AF58-49A7-B526-B874736533F7} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /imgui_gamemaker/imgui/imgui_stdlib.h: -------------------------------------------------------------------------------- 1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) 2 | // This is also an example of how you may wrap your own similar types. 3 | 4 | // Changelog: 5 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | 12 | namespace ImGui 13 | { 14 | // ImGui::InputText() with std::string 15 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity 16 | IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 17 | IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 18 | IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 19 | 20 | IMGUI_API bool Combo(const char* label, int* current_item, std::vector& items, int popup_max_height_in_items = -1); 21 | IMGUI_API bool ListBox(const char* label, int* current_item, std::vector& items, int height_in_items = -1); 22 | } 23 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui/imgui_stdlib.h: -------------------------------------------------------------------------------- 1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) 2 | // This is also an example of how you may wrap your own similar types. 3 | 4 | // Changelog: 5 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | 12 | namespace ImGui 13 | { 14 | // ImGui::InputText() with std::string 15 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity 16 | IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 17 | IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 18 | IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 19 | 20 | IMGUI_API bool Combo(const char* label, int* current_item, std::vector& items, int popup_max_height_in_items = -1); 21 | IMGUI_API bool ListBox(const char* label, int* current_item, std::vector& items, int height_in_items = -1); 22 | } 23 | -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_IMGUI_demo/obj_imgui_demo.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "managed": true, 6 | "spriteMaskId": null, 7 | "persistent": false, 8 | "parentObjectId": null, 9 | "physicsObject": false, 10 | "physicsSensor": false, 11 | "physicsShape": 1, 12 | "physicsGroup": 1, 13 | "physicsDensity": 0.5, 14 | "physicsRestitution": 0.1, 15 | "physicsLinearDamping": 0.1, 16 | "physicsAngularDamping": 0.1, 17 | "physicsFriction": 0.2, 18 | "physicsStartAwake": true, 19 | "physicsKinematic": false, 20 | "physicsShapePoints": [], 21 | "eventList": [ 22 | {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 23 | {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 24 | {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 25 | {"isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 26 | ], 27 | "properties": [], 28 | "overriddenProperties": [], 29 | "parent": { 30 | "name": "IMGUI", 31 | "path": "folders/IMGUI.yy", 32 | }, 33 | "resourceVersion": "1.0", 34 | "name": "Obj_IMGUI_demo", 35 | "tags": [], 36 | "resourceType": "GMObject", 37 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/options/mac/options_mac.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_mac_display_name": "Created with GameMaker", 3 | "option_mac_app_id": "com.company.game", 4 | "option_mac_version": "1.0.0.0", 5 | "option_mac_output_dir": "~/gamemakerstudio2", 6 | "option_mac_team_id": "", 7 | "option_mac_signing_identity": "Developer ID Application:", 8 | "option_mac_copyright": "", 9 | "option_mac_splash_png": "${base_options_dir}/mac/splash/splash.png", 10 | "option_mac_icon_png": "${base_options_dir}/mac/icons/1024.png", 11 | "option_mac_installer_background_png": "${base_options_dir}/mac/splash/installer_background.png", 12 | "option_mac_menu_dock": false, 13 | "option_mac_display_cursor": true, 14 | "option_mac_start_fullscreen": false, 15 | "option_mac_allow_fullscreen": false, 16 | "option_mac_interpolate_pixels": true, 17 | "option_mac_vsync": false, 18 | "option_mac_resize_window": false, 19 | "option_mac_enable_retina": false, 20 | "option_mac_scale": 0, 21 | "option_mac_texture_page": "2048x2048", 22 | "option_mac_build_app_store": false, 23 | "option_mac_allow_incoming_network": false, 24 | "option_mac_allow_outgoing_network": false, 25 | "option_mac_app_category": "Games", 26 | "option_mac_enable_steam": false, 27 | "option_mac_disable_sandbox": false, 28 | "option_mac_x86_64": true, 29 | "option_mac_arm64": true, 30 | "option_mac_apple_sign_in": false, 31 | "resourceVersion": "1.0", 32 | "name": "macOS", 33 | "tags": [], 34 | "resourceType": "GMMacOptions", 35 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/objects/obj_imgui_demo/obj_imgui_demo.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "managed": true, 6 | "spriteMaskId": null, 7 | "persistent": false, 8 | "parentObjectId": null, 9 | "physicsObject": false, 10 | "physicsSensor": false, 11 | "physicsShape": 1, 12 | "physicsGroup": 1, 13 | "physicsDensity": 0.5, 14 | "physicsRestitution": 0.1, 15 | "physicsLinearDamping": 0.1, 16 | "physicsAngularDamping": 0.1, 17 | "physicsFriction": 0.2, 18 | "physicsStartAwake": true, 19 | "physicsKinematic": false, 20 | "physicsShapePoints": [], 21 | "eventList": [ 22 | {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 23 | {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 24 | {"isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 25 | {"isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 26 | ], 27 | "properties": [], 28 | "overriddenProperties": [], 29 | "parent": { 30 | "name": "imgui_gamemaker_example", 31 | "path": "imgui_gamemaker_example.yyp", 32 | }, 33 | "resourceVersion": "1.0", 34 | "name": "Obj_ImGui_Demo", 35 | "tags": [], 36 | "resourceType": "GMObject", 37 | } -------------------------------------------------------------------------------- /old stuff/usage_example/options/mac/options_mac.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_mac_display_name": "Created with GameMaker Studio 2", 3 | "option_mac_app_id": "com.company.game", 4 | "option_mac_version": "1.0.0.0", 5 | "option_mac_output_dir": "~/gamemakerstudio2", 6 | "option_mac_team_id": "", 7 | "option_mac_signing_identity": "Developer ID Application:", 8 | "option_mac_copyright": "", 9 | "option_mac_splash_png": "${base_options_dir}/mac/splash/splash.png", 10 | "option_mac_icon_png": "${base_options_dir}/mac/icons/1024.png", 11 | "option_mac_installer_background_png": "${base_options_dir}/mac/splash/installer_background.png", 12 | "option_mac_menu_dock": false, 13 | "option_mac_display_cursor": true, 14 | "option_mac_start_fullscreen": false, 15 | "option_mac_allow_fullscreen": false, 16 | "option_mac_interpolate_pixels": true, 17 | "option_mac_vsync": false, 18 | "option_mac_resize_window": false, 19 | "option_mac_enable_retina": false, 20 | "option_mac_scale": 0, 21 | "option_mac_texture_page": "2048x2048", 22 | "option_mac_build_app_store": false, 23 | "option_mac_allow_incoming_network": false, 24 | "option_mac_allow_outgoing_network": false, 25 | "option_mac_app_category": "Games", 26 | "option_mac_enable_steam": false, 27 | "option_mac_disable_sandbox": true, 28 | "option_mac_x86_64": true, 29 | "option_mac_arm64": true, 30 | "option_mac_apple_sign_in": false, 31 | "resourceVersion": "1.0", 32 | "name": "macOS", 33 | "tags": [], 34 | "resourceType": "GMMacOptions", 35 | } -------------------------------------------------------------------------------- /imgui_gamemaker/imgui/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX11 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices. 8 | 9 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 11 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 12 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 13 | 14 | #pragma once 15 | #include "imgui.h" // IMGUI_IMPL_API 16 | 17 | struct ID3D11Device; 18 | struct ID3D11DeviceContext; 19 | 20 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 22 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 23 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 24 | 25 | // Use if you want to reset your rendering device without losing Dear ImGui state. 26 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 27 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 28 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX11 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices. 8 | 9 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 11 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 12 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 13 | 14 | #pragma once 15 | #include "imgui.h" // IMGUI_IMPL_API 16 | 17 | struct ID3D11Device; 18 | struct ID3D11DeviceContext; 19 | 20 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 22 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 23 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 24 | 25 | // Use if you want to reset your rendering device without losing Dear ImGui state. 26 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 27 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 28 | -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiExample/Obj_ImGuiExample.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "spriteMaskId": null, 6 | "persistent": false, 7 | "parentObjectId": null, 8 | "physicsObject": false, 9 | "physicsSensor": false, 10 | "physicsShape": 1, 11 | "physicsGroup": 1, 12 | "physicsDensity": 0.5, 13 | "physicsRestitution": 0.1, 14 | "physicsLinearDamping": 0.1, 15 | "physicsAngularDamping": 0.1, 16 | "physicsFriction": 0.2, 17 | "physicsStartAwake": true, 18 | "physicsKinematic": false, 19 | "physicsShapePoints": [], 20 | "eventList": [ 21 | {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 22 | {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 23 | {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 24 | {"isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 25 | ], 26 | "properties": [], 27 | "overriddenProperties": [], 28 | "parent": { 29 | "name": "Testing", 30 | "path": "folders/Testing.yy", 31 | }, 32 | "resourceVersion": "1.0", 33 | "name": "Obj_ImGuiExample", 34 | "tags": [], 35 | "resourceType": "GMObject", 36 | } -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiTesting/Obj_ImGuiTesting.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "spriteMaskId": null, 6 | "persistent": false, 7 | "parentObjectId": null, 8 | "physicsObject": false, 9 | "physicsSensor": false, 10 | "physicsShape": 1, 11 | "physicsGroup": 1, 12 | "physicsDensity": 0.5, 13 | "physicsRestitution": 0.1, 14 | "physicsLinearDamping": 0.1, 15 | "physicsAngularDamping": 0.1, 16 | "physicsFriction": 0.2, 17 | "physicsStartAwake": true, 18 | "physicsKinematic": false, 19 | "physicsShapePoints": [], 20 | "eventList": [ 21 | {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiTesting","path":"objects/Obj_ImGuiTesting/Obj_ImGuiTesting.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 22 | {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiTesting","path":"objects/Obj_ImGuiTesting/Obj_ImGuiTesting.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 23 | {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiTesting","path":"objects/Obj_ImGuiTesting/Obj_ImGuiTesting.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 24 | {"isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiTesting","path":"objects/Obj_ImGuiTesting/Obj_ImGuiTesting.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 25 | ], 26 | "properties": [], 27 | "overriddenProperties": [], 28 | "parent": { 29 | "name": "Testing", 30 | "path": "folders/Testing.yy", 31 | }, 32 | "resourceVersion": "1.0", 33 | "name": "Obj_ImGuiTesting", 34 | "tags": [], 35 | "resourceType": "GMObject", 36 | } -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiTesting/Obj_ImGuiExample.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "spriteMaskId": null, 6 | "persistent": false, 7 | "parentObjectId": null, 8 | "physicsObject": false, 9 | "physicsSensor": false, 10 | "physicsShape": 1, 11 | "physicsGroup": 1, 12 | "physicsDensity": 0.5, 13 | "physicsRestitution": 0.1, 14 | "physicsLinearDamping": 0.1, 15 | "physicsAngularDamping": 0.1, 16 | "physicsFriction": 0.2, 17 | "physicsStartAwake": true, 18 | "physicsKinematic": false, 19 | "physicsShapePoints": [], 20 | "eventList": [ 21 | {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 22 | {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 23 | {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 24 | {"isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,"parent":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 25 | ], 26 | "properties": [], 27 | "overriddenProperties": [], 28 | "parent": { 29 | "name": "usage_example", 30 | "path": "usage_example.yyp", 31 | }, 32 | "resourceVersion": "1.0", 33 | "name": "Obj_ImGuiExample", 34 | "tags": [], 35 | "resourceType": "GMObject", 36 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/options/windows/options_windows.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_windows_display_name": "Created with GameMaker", 3 | "option_windows_executable_name": "${project_name}.exe", 4 | "option_windows_version": "1.0.0.0", 5 | "option_windows_company_info": "YoYo Games Ltd", 6 | "option_windows_product_info": "Created with GameMaker", 7 | "option_windows_copyright_info": "", 8 | "option_windows_description_info": "A GameMaker Game", 9 | "option_windows_display_cursor": true, 10 | "option_windows_icon": "${base_options_dir}/windows/icons/icon.ico", 11 | "option_windows_save_location": 0, 12 | "option_windows_splash_screen": "${base_options_dir}/windows/splash/splash.png", 13 | "option_windows_use_splash": false, 14 | "option_windows_start_fullscreen": false, 15 | "option_windows_allow_fullscreen_switching": false, 16 | "option_windows_interpolate_pixels": false, 17 | "option_windows_vsync": false, 18 | "option_windows_resize_window": false, 19 | "option_windows_borderless": false, 20 | "option_windows_scale": 0, 21 | "option_windows_copy_exe_to_dest": false, 22 | "option_windows_sleep_margin": 10, 23 | "option_windows_texture_page": "2048x2048", 24 | "option_windows_installer_finished": "${base_options_dir}/windows/installer/finished.bmp", 25 | "option_windows_installer_header": "${base_options_dir}/windows/installer/header.bmp", 26 | "option_windows_license": "${base_options_dir}/windows/installer/license.txt", 27 | "option_windows_nsis_file": "${base_options_dir}/windows/installer/nsis_script.nsi", 28 | "option_windows_enable_steam": false, 29 | "option_windows_disable_sandbox": false, 30 | "option_windows_steam_use_alternative_launcher": false, 31 | "option_windows_use_x64": true, 32 | "resourceVersion": "1.1", 33 | "name": "Windows", 34 | "tags": [], 35 | "resourceType": "GMWindowsOptions", 36 | } -------------------------------------------------------------------------------- /old stuff/usage_example/options/windows/options_windows.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_windows_display_name": "Created with GameMaker Studio 2", 3 | "option_windows_executable_name": "${project_name}.exe", 4 | "option_windows_version": "1.0.0.0", 5 | "option_windows_company_info": "YoYo Games Ltd", 6 | "option_windows_product_info": "Created with GameMaker Studio 2", 7 | "option_windows_copyright_info": "", 8 | "option_windows_description_info": "A GameMaker Studio 2 Game", 9 | "option_windows_display_cursor": true, 10 | "option_windows_icon": "${base_options_dir}/windows/icons/icon.ico", 11 | "option_windows_save_location": 0, 12 | "option_windows_splash_screen": "${base_options_dir}/windows/splash/splash.png", 13 | "option_windows_use_splash": false, 14 | "option_windows_start_fullscreen": false, 15 | "option_windows_allow_fullscreen_switching": false, 16 | "option_windows_interpolate_pixels": false, 17 | "option_windows_vsync": false, 18 | "option_windows_resize_window": false, 19 | "option_windows_borderless": false, 20 | "option_windows_scale": 0, 21 | "option_windows_copy_exe_to_dest": true, 22 | "option_windows_sleep_margin": 10, 23 | "option_windows_texture_page": "2048x2048", 24 | "option_windows_installer_finished": "${base_options_dir}/windows/installer/finished.bmp", 25 | "option_windows_installer_header": "${base_options_dir}/windows/installer/header.bmp", 26 | "option_windows_license": "${base_options_dir}/windows/installer/license.txt", 27 | "option_windows_nsis_file": "${base_options_dir}/windows/installer/nsis_script.nsi", 28 | "option_windows_enable_steam": false, 29 | "option_windows_disable_sandbox": true, 30 | "option_windows_steam_use_alternative_launcher": false, 31 | "option_windows_use_x64": true, 32 | "resourceVersion": "1.1", 33 | "name": "Windows", 34 | "tags": [], 35 | "resourceType": "GMWindowsOptions", 36 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/imgui_gamemaker_example.yyp: -------------------------------------------------------------------------------- 1 | { 2 | "resources": [ 3 | {"id":{"name":"Scr_ImGui","path":"scripts/Scr_ImGui/Scr_ImGui.yy",},"order":3,}, 4 | {"id":{"name":"Scr_ImGui_Demo","path":"scripts/Scr_ImGui_Demo/Scr_ImGui_Demo.yy",},"order":6,}, 5 | {"id":{"name":"Ext_ImGui","path":"extensions/Ext_ImGui/Ext_ImGui.yy",},"order":2,}, 6 | {"id":{"name":"Obj_ImGui_Demo","path":"objects/Obj_ImGui_Demo/Obj_ImGui_Demo.yy",},"order":4,}, 7 | {"id":{"name":"Scr_ImGui_MacrosAndEnums","path":"scripts/Scr_ImGui_MacrosAndEnums/Scr_ImGui_MacrosAndEnums.yy",},"order":5,}, 8 | {"id":{"name":"Room1","path":"rooms/Room1/Room1.yy",},"order":1,}, 9 | ], 10 | "Options": [ 11 | {"name":"Linux","path":"options/linux/options_linux.yy",}, 12 | {"name":"macOS","path":"options/mac/options_mac.yy",}, 13 | {"name":"Main","path":"options/main/options_main.yy",}, 14 | {"name":"Windows","path":"options/windows/options_windows.yy",}, 15 | {"name":"operagx","path":"options/operagx/options_operagx.yy",}, 16 | ], 17 | "defaultScriptType": 1, 18 | "isEcma": false, 19 | "configs": { 20 | "name": "Default", 21 | "children": [], 22 | }, 23 | "RoomOrderNodes": [ 24 | {"roomId":{"name":"Room1","path":"rooms/Room1/Room1.yy",},}, 25 | ], 26 | "Folders": [], 27 | "AudioGroups": [ 28 | {"targets":-1,"resourceVersion":"1.3","name":"audiogroup_default","resourceType":"GMAudioGroup",}, 29 | ], 30 | "TextureGroups": [ 31 | {"isScaled":true,"compressFormat":"bz2","autocrop":true,"border":2,"mipsToGenerate":0,"groupParent":null,"targets":-1,"resourceVersion":"1.3","name":"Default","resourceType":"GMTextureGroup",}, 32 | ], 33 | "IncludedFiles": [], 34 | "MetaData": { 35 | "IDEVersion": "2022.6.0.23", 36 | }, 37 | "resourceVersion": "1.5", 38 | "name": "imgui_gamemaker_example", 39 | "tags": [], 40 | "resourceType": "GMProject", 41 | } -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/src/Buffer.cpp: -------------------------------------------------------------------------------- 1 | #include "Buffer.h" 2 | 3 | Buffer::Buffer(void* data, unsigned int data_size) 4 | { 5 | set_data(data, data_size); 6 | } 7 | 8 | void Buffer::set_data(void* data, unsigned int data_size) 9 | { 10 | this->data = (unsigned char*)data; 11 | this->data_size = data_size; 12 | this->data_index = 0; 13 | } 14 | 15 | void* Buffer::get_data() { 16 | return this->data; 17 | } 18 | 19 | void Buffer::seek(unsigned int index) 20 | { 21 | this->data_index = index; 22 | } 23 | 24 | 25 | void Buffer::write(float value) 26 | { 27 | charfloat cf; cf.f = value; 28 | for (int i = 0; i < 4; ++i) { 29 | data[data_index + i] = cf.c[i]; 30 | } 31 | data_index += 4; 32 | } 33 | 34 | void Buffer::write(std::string value) 35 | { 36 | const char* c_str = value.c_str(); 37 | int size = value.capacity() + 1; 38 | for (int i = 0; i < size; ++i) { 39 | data[data_index + i] = c_str[i]; 40 | } 41 | 42 | data_index += size; 43 | } 44 | 45 | float Buffer::read_float() 46 | { 47 | charfloat val; 48 | for (int i = 0; i < 4; ++i) { 49 | val.c[i] = data[data_index + i]; 50 | } 51 | data_index += 4; 52 | return val.f; 53 | } 54 | 55 | #include 56 | std::string Buffer::read_string() 57 | { 58 | std::string str; 59 | while (data[data_index] != (unsigned char)0) { 60 | str.push_back(data[data_index]); 61 | data_index++; 62 | } 63 | data_index++; 64 | return str; 65 | } 66 | 67 | 68 | 69 | void Buffer::poke(unsigned int offset, float value) 70 | { 71 | charfloat cf; cf.f = value; 72 | for (int i = 0; i < 4; ++i) { 73 | data[offset + i] = cf.c[i]; 74 | } 75 | } 76 | 77 | void Buffer::poke(unsigned int offset, std::string value) 78 | { 79 | const char* c_str = value.c_str(); 80 | int size = value.capacity() + 1; 81 | for (int i = 0; i < size; ++i) { 82 | data[offset + i] = c_str[i]; 83 | } 84 | } 85 | 86 | float Buffer::peek_float(unsigned int offset) 87 | { 88 | charfloat val; 89 | for (int i = 0; i < 4; ++i) { 90 | val.c[i] = data[offset + i]; 91 | } 92 | return val.f; 93 | } 94 | 95 | std::string Buffer::peek_string(unsigned int offset) 96 | { 97 | return std::string((char*)&data[offset]); 98 | } 99 | -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiExample/Step_0.gml: -------------------------------------------------------------------------------- 1 | imgui_newframe(); 2 | 3 | imgui_begin("IMGUI " + imgui_get_version(),true,ImGuiWindowFlags.NoCollapse); 4 | var f = (current_time / 1000) mod 2; 5 | imgui_progress_bar(f/2,0,0,0); 6 | if (imgui_button("Demo Window",0,0)) show_demo_window = !show_demo_window; 7 | if (imgui_button("About Window",0,0)) show_about_window = !show_about_window; 8 | if (imgui_button("Metrics Window",0,0)) show_metrics_window = !show_metrics_window; 9 | if (imgui_button("Style Editor",0,0)) show_style_editor = !show_style_editor; 10 | if (imgui_button("User Guide",0,0)) show_user_guide = !show_user_guide; 11 | imgui_end(); 12 | 13 | if (show_demo_window) 14 | show_demo_window = imgui_show_demo_window(show_demo_window); 15 | 16 | if (show_about_window) 17 | show_about_window = imgui_show_about_window(show_about_window); 18 | 19 | if (show_metrics_window) 20 | show_metrics_window = imgui_show_metrics_window(show_metrics_window); 21 | 22 | if (show_user_guide) { 23 | var ret = imgui_begin("User Guide",true,0); 24 | if (ret[0]) imgui_show_user_guide(); 25 | show_user_guide = ret[1]; 26 | imgui_end(); 27 | } 28 | 29 | if (show_style_editor) { 30 | var ret = imgui_begin("Style Editor",true,0); 31 | if (ret[0]) { 32 | imgui_show_style_editor(); 33 | imgui_show_style_selector("Style Selector"); 34 | imgui_show_font_selector("Font Selector"); 35 | } 36 | show_style_editor = ret[1]; 37 | imgui_end(); 38 | } 39 | 40 | //imgui_begin("Test",true,0); 41 | //var winappear = imgui_is_window_appearing(); 42 | //var wincollapse = imgui_is_window_collapsed(); 43 | //var winfocus = imgui_is_window_focused(0); 44 | //var winhover = imgui_is_window_hovered(0); 45 | //var windpiscale = imgui_get_window_dpi_scale(); 46 | //var winpos = imgui_get_window_pos(); 47 | //var winsize = imgui_get_window_size(); 48 | //var winwidth = imgui_get_window_width(); 49 | //var winheight = imgui_get_window_height(); 50 | 51 | //imgui_end(); 52 | 53 | //imgui_begin("Monitor",true,0); 54 | 55 | //imgui_text("imgui_is_window_appearing: " + string(winappear)); 56 | //imgui_text("imgui_is_window_collapsed: " + string(wincollapse)); 57 | //imgui_text("imgui_is_window_focused: " + string(winfocus)); 58 | //imgui_text("imgui_is_window_hovered: " + string(winhover)); 59 | //imgui_text("imgui_get_window_dpi_scale: " + string(windpiscale)); 60 | //imgui_text("imgui_get_window_pos: " + string(winpos)); 61 | //imgui_text("imgui_get_window_size: " + string(winsize)); 62 | //imgui_text("imgui_get_window_width: " + string(winwidth)); 63 | //imgui_text("imgui_get_window_height: " + string(winheight)); 64 | 65 | //imgui_end(); -------------------------------------------------------------------------------- /imgui_gamemaker/src/Buffer.cpp: -------------------------------------------------------------------------------- 1 | #include "Buffer.h" 2 | 3 | Buffer::Buffer(void* data, unsigned int data_size) 4 | { 5 | set_data(data, data_size); 6 | } 7 | 8 | void Buffer::set_data(void* data, unsigned int data_size) 9 | { 10 | this->data = (unsigned char*)data; 11 | this->data_size = data_size; 12 | this->data_index = 0; 13 | } 14 | 15 | void* Buffer::get_data() { 16 | return this->data; 17 | } 18 | 19 | void Buffer::seek(unsigned int index) 20 | { 21 | this->data_index = index; 22 | } 23 | 24 | 25 | void Buffer::write(int value) 26 | { 27 | write((float)value); 28 | } 29 | 30 | void Buffer::write(bool value) 31 | { 32 | write((float)value); 33 | } 34 | 35 | void Buffer::write(float value) 36 | { 37 | charfloat cf; cf.f = value; 38 | for (int i = 0; i < 4; ++i) { 39 | data[data_index + i] = cf.c[i]; 40 | } 41 | data_index += 4; 42 | } 43 | 44 | void Buffer::write(double value) 45 | { 46 | chardub val; val.d = value; 47 | for (int i = 0; i < 8; ++i) { 48 | data[data_index + i] = val.c[i]; 49 | } 50 | data_index += 8; 51 | } 52 | 53 | void Buffer::write(std::string value) 54 | { 55 | const char* c_str = value.c_str(); 56 | int size = value.capacity() + 1; 57 | for (int i = 0; i < size; ++i) { 58 | data[data_index + i] = c_str[i]; 59 | } 60 | 61 | data_index += size; 62 | } 63 | 64 | float Buffer::read_float() 65 | { 66 | charfloat val; 67 | for (int i = 0; i < 4; ++i) { 68 | val.c[i] = data[data_index + i]; 69 | } 70 | data_index += 4; 71 | return val.f; 72 | } 73 | 74 | double Buffer::read_double() 75 | { 76 | chardub val; 77 | for (int i = 0; i < 8; ++i) { 78 | val.c[i] = data[data_index + i]; 79 | } 80 | data_index += 8; 81 | return val.d; 82 | } 83 | 84 | #include 85 | std::string Buffer::read_string() 86 | { 87 | std::string str; 88 | while (data[data_index] != (unsigned char)0) { 89 | str.push_back(data[data_index]); 90 | data_index++; 91 | } 92 | data_index++; 93 | return str; 94 | } 95 | 96 | 97 | 98 | void Buffer::poke(unsigned int offset, float value) 99 | { 100 | charfloat cf; cf.f = value; 101 | for (int i = 0; i < 4; ++i) { 102 | data[offset + i] = cf.c[i]; 103 | } 104 | } 105 | 106 | void Buffer::poke(unsigned int offset, std::string value) 107 | { 108 | const char* c_str = value.c_str(); 109 | int size = value.capacity() + 1; 110 | for (int i = 0; i < size; ++i) { 111 | data[offset + i] = c_str[i]; 112 | } 113 | } 114 | 115 | float Buffer::peek_float(unsigned int offset) 116 | { 117 | charfloat val; 118 | for (int i = 0; i < 4; ++i) { 119 | val.c[i] = data[offset + i]; 120 | } 121 | return val.f; 122 | } 123 | 124 | std::string Buffer::peek_string(unsigned int offset) 125 | { 126 | return std::string((char*)&data[offset]); 127 | } 128 | -------------------------------------------------------------------------------- /old stuff/usage_example/usage_example.yyp: -------------------------------------------------------------------------------- 1 | { 2 | "resources": [ 3 | {"id":{"name":"IMGUI_demo","path":"scripts/IMGUI_demo/IMGUI_demo.yy",},"order":3,}, 4 | {"id":{"name":"TestStruct","path":"scripts/TestStruct/TestStruct.yy",},"order":3,}, 5 | {"id":{"name":"Obj_IMGUI_demo","path":"objects/Obj_IMGUI_demo/Obj_IMGUI_demo.yy",},"order":4,}, 6 | {"id":{"name":"IMGUI_EnumsAndMacros","path":"scripts/IMGUI_EnumsAndMacros/IMGUI_EnumsAndMacros.yy",},"order":2,}, 7 | {"id":{"name":"Spr_Test","path":"sprites/Spr_Test/Spr_Test.yy",},"order":5,}, 8 | {"id":{"name":"TODO","path":"notes/TODO/TODO.yy",},"order":4,}, 9 | {"id":{"name":"Spr_Test2","path":"sprites/Spr_Test2/Spr_Test2.yy",},"order":6,}, 10 | {"id":{"name":"Obj_ImGuiTesting","path":"objects/Obj_ImGuiTesting/Obj_ImGuiTesting.yy",},"order":1,}, 11 | {"id":{"name":"Obj_ImGuiExample","path":"objects/Obj_ImGuiExample/Obj_ImGuiExample.yy",},"order":0,}, 12 | {"id":{"name":"IMGUI","path":"scripts/IMGUI/IMGUI.yy",},"order":1,}, 13 | {"id":{"name":"Rm_IMGUI_demo","path":"rooms/Rm_IMGUI_demo/Rm_IMGUI_demo.yy",},"order":5,}, 14 | {"id":{"name":"Ext_imgui","path":"extensions/Ext_imgui/Ext_imgui.yy",},"order":0,}, 15 | {"id":{"name":"Room1","path":"rooms/Room1/Room1.yy",},"order":2,}, 16 | ], 17 | "Options": [ 18 | {"name":"Linux","path":"options/linux/options_linux.yy",}, 19 | {"name":"macOS","path":"options/mac/options_mac.yy",}, 20 | {"name":"Main","path":"options/main/options_main.yy",}, 21 | {"name":"Windows","path":"options/windows/options_windows.yy",}, 22 | {"name":"operagx","path":"options/operagx/options_operagx.yy",}, 23 | ], 24 | "defaultScriptType": 1, 25 | "isEcma": false, 26 | "configs": { 27 | "name": "Default", 28 | "children": [], 29 | }, 30 | "RoomOrderNodes": [ 31 | {"roomId":{"name":"Rm_IMGUI_demo","path":"rooms/Rm_IMGUI_demo/Rm_IMGUI_demo.yy",},}, 32 | {"roomId":{"name":"Room1","path":"rooms/Room1/Room1.yy",},}, 33 | ], 34 | "Folders": [ 35 | {"folderPath":"folders/IMGUI.yy","order":5,"resourceVersion":"1.0","name":"IMGUI","tags":[],"resourceType":"GMFolder",}, 36 | {"folderPath":"folders/Testing.yy","order":8,"resourceVersion":"1.0","name":"Testing","tags":[],"resourceType":"GMFolder",}, 37 | ], 38 | "AudioGroups": [ 39 | {"targets":-1,"resourceVersion":"1.3","name":"audiogroup_default","resourceType":"GMAudioGroup",}, 40 | ], 41 | "TextureGroups": [ 42 | {"isScaled":true,"compressFormat":"bz2","autocrop":true,"border":2,"mipsToGenerate":0,"groupParent":null,"targets":-1,"resourceVersion":"1.3","name":"Default","resourceType":"GMTextureGroup",}, 43 | ], 44 | "IncludedFiles": [], 45 | "MetaData": { 46 | "IDEVersion": "2022.6.0.23", 47 | }, 48 | "resourceVersion": "1.5", 49 | "name": "usage_example", 50 | "tags": [], 51 | "resourceType": "GMProject", 52 | } -------------------------------------------------------------------------------- /imgui_gamemaker/imgui_gamemaker.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui_gamemaker_x64.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | Source Files 79 | 80 | 81 | -------------------------------------------------------------------------------- /imgui_gamemaker/imgui/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy VK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] 7 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 9 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 10 | 11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 13 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 14 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 15 | 16 | #pragma once 17 | #include "imgui.h" // IMGUI_IMPL_API 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 20 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 22 | 23 | // Win32 message handler your application need to call. 24 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 25 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 26 | // - Call from your application's message handler. Keep calling your message handler unless this function returns TRUE. 27 | 28 | #if 0 29 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 30 | #endif 31 | 32 | // DPI-related helpers (optional) 33 | // - Use to enable DPI awareness without having to create an application manifest. 34 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 35 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 36 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 37 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 38 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 39 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 40 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 41 | 42 | // Transparency related helpers (optional) [experimental] 43 | // - Use to enable alpha compositing transparency with the desktop. 44 | // - Use together with e.g. clearing your framebuffer with zero-alpha. 45 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd 46 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy VK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] 7 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 9 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 10 | 11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 13 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 14 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 15 | 16 | #pragma once 17 | #include "imgui.h" // IMGUI_IMPL_API 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 20 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 22 | 23 | // Win32 message handler your application need to call. 24 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 25 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 26 | // - Call from your application's message handler. Keep calling your message handler unless this function returns TRUE. 27 | 28 | #if 0 29 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 30 | #endif 31 | 32 | // DPI-related helpers (optional) 33 | // - Use to enable DPI awareness without having to create an application manifest. 34 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 35 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 36 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 37 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 38 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 39 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 40 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 41 | 42 | // Transparency related helpers (optional) [experimental] 43 | // - Use to enable alpha compositing transparency with the desktop. 44 | // - Use together with e.g. clearing your framebuffer with zero-alpha. 45 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd 46 | -------------------------------------------------------------------------------- /old stuff/usage_example/sprites/Spr_Test2/Spr_Test2.yy: -------------------------------------------------------------------------------- 1 | { 2 | "bboxMode": 0, 3 | "collisionKind": 1, 4 | "type": 0, 5 | "origin": 0, 6 | "preMultiplyAlpha": false, 7 | "edgeFiltering": false, 8 | "collisionTolerance": 0, 9 | "swfPrecision": 2.525, 10 | "bbox_left": 0, 11 | "bbox_right": 63, 12 | "bbox_top": 0, 13 | "bbox_bottom": 63, 14 | "HTile": false, 15 | "VTile": false, 16 | "For3D": false, 17 | "width": 64, 18 | "height": 64, 19 | "textureGroupId": { 20 | "name": "Default", 21 | "path": "texturegroups/Default", 22 | }, 23 | "swatchColours": null, 24 | "gridX": 0, 25 | "gridY": 0, 26 | "frames": [ 27 | {"compositeImage":{"FrameId":{"name":"3d495b27-92a2-4e66-aa92-17005f19873e","path":"sprites/Spr_Test2/Spr_Test2.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[ 28 | {"FrameId":{"name":"3d495b27-92a2-4e66-aa92-17005f19873e","path":"sprites/Spr_Test2/Spr_Test2.yy",},"LayerId":{"name":"e2307e29-7526-4c21-9ac7-03d614ebc8a5","path":"sprites/Spr_Test2/Spr_Test2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",}, 29 | ],"parent":{"name":"Spr_Test2","path":"sprites/Spr_Test2/Spr_Test2.yy",},"resourceVersion":"1.0","name":"3d495b27-92a2-4e66-aa92-17005f19873e","tags":[],"resourceType":"GMSpriteFrame",}, 30 | ], 31 | "sequence": { 32 | "spriteId": {"name":"Spr_Test2","path":"sprites/Spr_Test2/Spr_Test2.yy",}, 33 | "timeUnits": 1, 34 | "playback": 1, 35 | "playbackSpeed": 30.0, 36 | "playbackSpeedType": 0, 37 | "autoRecord": true, 38 | "volume": 1.0, 39 | "length": 1.0, 40 | "events": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore",}, 41 | "moments": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore",}, 42 | "tracks": [ 43 | {"name":"frames","spriteId":null,"keyframes":{"Keyframes":[ 44 | {"id":"7328af16-7c7c-4380-839a-075d70e94e57","Key":0.0,"Length":1.0,"Stretch":false,"Disabled":false,"IsCreationKey":false,"Channels":{"0":{"Id":{"name":"3d495b27-92a2-4e66-aa92-17005f19873e","path":"sprites/Spr_Test2/Spr_Test2.yy",},"resourceVersion":"1.0","resourceType":"SpriteFrameKeyframe",},},"resourceVersion":"1.0","resourceType":"Keyframe",}, 45 | ],"resourceVersion":"1.0","resourceType":"KeyframeStore",},"trackColour":0,"inheritsTrackColour":true,"builtinName":0,"traits":0,"interpolation":1,"tracks":[],"events":[],"isCreationTrack":false,"resourceVersion":"1.0","tags":[],"resourceType":"GMSpriteFramesTrack","modifiers":[],}, 46 | ], 47 | "visibleRange": null, 48 | "lockOrigin": false, 49 | "showBackdrop": true, 50 | "showBackdropImage": false, 51 | "backdropImagePath": "", 52 | "backdropImageOpacity": 0.5, 53 | "backdropWidth": 1366, 54 | "backdropHeight": 768, 55 | "backdropXOffset": 0.0, 56 | "backdropYOffset": 0.0, 57 | "xorigin": 0, 58 | "yorigin": 0, 59 | "eventToFunction": {}, 60 | "eventStubScript": null, 61 | "parent": {"name":"Spr_Test2","path":"sprites/Spr_Test2/Spr_Test2.yy",}, 62 | "resourceVersion": "1.4", 63 | "name": "Spr_Test", 64 | "tags": [], 65 | "resourceType": "GMSequence", 66 | }, 67 | "layers": [ 68 | {"visible":true,"isLocked":false,"blendMode":0,"opacity":100.0,"displayName":"default","resourceVersion":"1.0","name":"e2307e29-7526-4c21-9ac7-03d614ebc8a5","tags":[],"resourceType":"GMImageLayer",}, 69 | ], 70 | "nineSlice": null, 71 | "parent": { 72 | "name": "Testing", 73 | "path": "folders/Testing.yy", 74 | }, 75 | "resourceVersion": "1.0", 76 | "name": "Spr_Test2", 77 | "tags": [], 78 | "resourceType": "GMSprite", 79 | } -------------------------------------------------------------------------------- /old stuff/usage_example/sprites/Spr_Test/spr_test.yy: -------------------------------------------------------------------------------- 1 | { 2 | "bboxMode": 0, 3 | "collisionKind": 1, 4 | "type": 0, 5 | "origin": 0, 6 | "preMultiplyAlpha": false, 7 | "edgeFiltering": false, 8 | "collisionTolerance": 0, 9 | "swfPrecision": 2.525, 10 | "bbox_left": 0, 11 | "bbox_right": 511, 12 | "bbox_top": 0, 13 | "bbox_bottom": 63, 14 | "HTile": false, 15 | "VTile": false, 16 | "For3D": false, 17 | "width": 512, 18 | "height": 64, 19 | "textureGroupId": { 20 | "name": "Default", 21 | "path": "texturegroups/Default", 22 | }, 23 | "swatchColours": null, 24 | "gridX": 0, 25 | "gridY": 0, 26 | "frames": [ 27 | {"compositeImage":{"FrameId":{"name":"3d495b27-92a2-4e66-aa92-17005f19873e","path":"sprites/Spr_Test/Spr_Test.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[ 28 | {"FrameId":{"name":"3d495b27-92a2-4e66-aa92-17005f19873e","path":"sprites/Spr_Test/Spr_Test.yy",},"LayerId":{"name":"e2307e29-7526-4c21-9ac7-03d614ebc8a5","path":"sprites/Spr_Test/Spr_Test.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",}, 29 | ],"parent":{"name":"Spr_Test","path":"sprites/Spr_Test/Spr_Test.yy",},"resourceVersion":"1.0","name":"3d495b27-92a2-4e66-aa92-17005f19873e","tags":[],"resourceType":"GMSpriteFrame",}, 30 | ], 31 | "sequence": { 32 | "spriteId": {"name":"Spr_Test","path":"sprites/Spr_Test/Spr_Test.yy",}, 33 | "timeUnits": 1, 34 | "playback": 1, 35 | "playbackSpeed": 30.0, 36 | "playbackSpeedType": 0, 37 | "autoRecord": true, 38 | "volume": 1.0, 39 | "length": 1.0, 40 | "events": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore`1","elementType":"MessageEventKeyframe",}, 41 | "moments": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore`1","elementType":"MomentsEventKeyframe",}, 42 | "tracks": [ 43 | {"name":"frames","spriteId":null,"keyframes":{"Keyframes":[ 44 | {"id":"659d15ac-e9d0-4bab-b6ec-d759522f3c7a","Key":0.0,"Length":1.0,"Stretch":false,"Disabled":false,"IsCreationKey":false,"Channels":{"0":{"Id":{"name":"3d495b27-92a2-4e66-aa92-17005f19873e","path":"sprites/Spr_Test/Spr_Test.yy",},"resourceVersion":"1.0","resourceType":"SpriteFrameKeyframe",},},"resourceVersion":"1.0","resourceType":"Keyframe`1","elementType":"SpriteFrameKeyframe",}, 45 | ],"resourceVersion":"1.0","resourceType":"KeyframeStore`1","elementType":"SpriteFrameKeyframe",},"trackColour":0,"inheritsTrackColour":true,"builtinName":0,"traits":0,"interpolation":1,"tracks":[],"events":[],"isCreationTrack":false,"resourceVersion":"1.0","tags":[],"resourceType":"GMSpriteFramesTrack","modifiers":[],}, 46 | ], 47 | "visibleRange": null, 48 | "lockOrigin": false, 49 | "showBackdrop": true, 50 | "showBackdropImage": false, 51 | "backdropImagePath": "", 52 | "backdropImageOpacity": 0.5, 53 | "backdropWidth": 1366, 54 | "backdropHeight": 768, 55 | "backdropXOffset": 0.0, 56 | "backdropYOffset": 0.0, 57 | "xorigin": 0, 58 | "yorigin": 0, 59 | "eventToFunction": {}, 60 | "eventStubScript": null, 61 | "parent": {"name":"Spr_Test","path":"sprites/Spr_Test/Spr_Test.yy",}, 62 | "resourceVersion": "1.4", 63 | "name": "Spr_Test", 64 | "tags": [], 65 | "resourceType": "GMSequence", 66 | }, 67 | "layers": [ 68 | {"visible":true,"isLocked":false,"blendMode":0,"opacity":100.0,"displayName":"default","resourceVersion":"1.0","name":"e2307e29-7526-4c21-9ac7-03d614ebc8a5","tags":[],"resourceType":"GMImageLayer",}, 69 | ], 70 | "nineSlice": null, 71 | "parent": { 72 | "name": "Testing", 73 | "path": "folders/Testing.yy", 74 | }, 75 | "resourceVersion": "1.0", 76 | "name": "Spr_Test", 77 | "tags": [], 78 | "resourceType": "GMSprite", 79 | } -------------------------------------------------------------------------------- /old stuff/usage_example/rooms/Room1/Room1.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnd": false, 3 | "volume": 1.0, 4 | "parentRoom": null, 5 | "views": [ 6 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 7 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 8 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 9 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 10 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 11 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 12 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 13 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 14 | ], 15 | "layers": [ 16 | {"instances":[ 17 | {"properties":[],"isDnd":false,"objectId":{"name":"Obj_ImGuiTesting","path":"objects/Obj_ImGuiTesting/Obj_ImGuiTesting.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":0.0,"y":32.0,"resourceVersion":"1.0","name":"inst_5C03EAF6","tags":[],"resourceType":"GMRInstance",}, 18 | ],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Instances","tags":[],"resourceType":"GMRInstanceLayer",}, 19 | {"spriteId":null,"colour":4278190080,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Background","tags":[],"resourceType":"GMRBackgroundLayer",}, 20 | ], 21 | "inheritLayers": false, 22 | "creationCodeFile": "", 23 | "inheritCode": false, 24 | "instanceCreationOrder": [ 25 | {"name":"inst_5C03EAF6","path":"rooms/Room1/Room1.yy",}, 26 | ], 27 | "inheritCreationOrder": false, 28 | "sequenceId": null, 29 | "roomSettings": { 30 | "inheritRoomSettings": false, 31 | "Width": 1366, 32 | "Height": 768, 33 | "persistent": false, 34 | }, 35 | "viewSettings": { 36 | "inheritViewSettings": false, 37 | "enableViews": false, 38 | "clearViewBackground": false, 39 | "clearDisplayBuffer": true, 40 | }, 41 | "physicsSettings": { 42 | "inheritPhysicsSettings": false, 43 | "PhysicsWorld": false, 44 | "PhysicsWorldGravityX": 0.0, 45 | "PhysicsWorldGravityY": 10.0, 46 | "PhysicsWorldPixToMetres": 0.1, 47 | }, 48 | "parent": { 49 | "name": "Testing", 50 | "path": "folders/Testing.yy", 51 | }, 52 | "resourceVersion": "1.0", 53 | "name": "Room1", 54 | "tags": [], 55 | "resourceType": "GMRoom", 56 | } -------------------------------------------------------------------------------- /imgui_gamemaker_example/rooms/room1/room1.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnd": false, 3 | "volume": 1.0, 4 | "parentRoom": null, 5 | "views": [ 6 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 7 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 8 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 9 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 10 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 11 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 12 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 13 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 14 | ], 15 | "layers": [ 16 | {"instances":[ 17 | {"properties":[],"isDnd":false,"objectId":{"name":"Obj_ImGui_Demo","path":"objects/Obj_ImGui_Demo/Obj_ImGui_Demo.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":0.0,"y":0.0,"resourceVersion":"1.0","name":"inst_2DF8F7BD","tags":[],"resourceType":"GMRInstance",}, 18 | ],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],"resourceVersion":"1.0","name":"Instances","tags":[],"resourceType":"GMRInstanceLayer",}, 19 | {"spriteId":null,"colour":4278190080,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],"resourceVersion":"1.0","name":"Background","tags":[],"resourceType":"GMRBackgroundLayer",}, 20 | ], 21 | "inheritLayers": false, 22 | "creationCodeFile": "", 23 | "inheritCode": false, 24 | "instanceCreationOrder": [ 25 | {"name":"inst_2DF8F7BD","path":"rooms/Room1/Room1.yy",}, 26 | ], 27 | "inheritCreationOrder": false, 28 | "sequenceId": null, 29 | "roomSettings": { 30 | "inheritRoomSettings": false, 31 | "Width": 1366, 32 | "Height": 768, 33 | "persistent": false, 34 | }, 35 | "viewSettings": { 36 | "inheritViewSettings": false, 37 | "enableViews": false, 38 | "clearViewBackground": false, 39 | "clearDisplayBuffer": true, 40 | }, 41 | "physicsSettings": { 42 | "inheritPhysicsSettings": false, 43 | "PhysicsWorld": false, 44 | "PhysicsWorldGravityX": 0.0, 45 | "PhysicsWorldGravityY": 10.0, 46 | "PhysicsWorldPixToMetres": 0.1, 47 | }, 48 | "parent": { 49 | "name": "imgui_gamemaker_example", 50 | "path": "imgui_gamemaker_example.yyp", 51 | }, 52 | "resourceVersion": "1.0", 53 | "name": "Room1", 54 | "tags": [], 55 | "resourceType": "GMRoom", 56 | } -------------------------------------------------------------------------------- /old stuff/usage_example/rooms/Rm_IMGUI_demo/Rm_IMGUI_demo.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnd": false, 3 | "volume": 1.0, 4 | "parentRoom": null, 5 | "views": [ 6 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 7 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 8 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 9 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 10 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 11 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 12 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 13 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 14 | ], 15 | "layers": [ 16 | {"instances":[ 17 | {"properties":[],"isDnd":false,"objectId":{"name":"Obj_IMGUI_demo","path":"objects/Obj_IMGUI_demo/Obj_IMGUI_demo.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":0.0,"y":0.0,"resourceVersion":"1.0","name":"inst_6FD054C8","tags":[],"resourceType":"GMRInstance",}, 18 | ],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],"resourceVersion":"1.0","name":"Instances","tags":[],"resourceType":"GMRInstanceLayer",}, 19 | {"spriteId":null,"colour":4278190080,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],"resourceVersion":"1.0","name":"Background","tags":[],"resourceType":"GMRBackgroundLayer",}, 20 | ], 21 | "inheritLayers": false, 22 | "creationCodeFile": "", 23 | "inheritCode": false, 24 | "instanceCreationOrder": [ 25 | {"name":"inst_6FD054C8","path":"rooms/Rm_IMGUI_demo/Rm_IMGUI_demo.yy",}, 26 | ], 27 | "inheritCreationOrder": false, 28 | "sequenceId": null, 29 | "roomSettings": { 30 | "inheritRoomSettings": false, 31 | "Width": 1366, 32 | "Height": 768, 33 | "persistent": false, 34 | }, 35 | "viewSettings": { 36 | "inheritViewSettings": false, 37 | "enableViews": false, 38 | "clearViewBackground": false, 39 | "clearDisplayBuffer": true, 40 | }, 41 | "physicsSettings": { 42 | "inheritPhysicsSettings": false, 43 | "PhysicsWorld": false, 44 | "PhysicsWorldGravityX": 0.0, 45 | "PhysicsWorldGravityY": 10.0, 46 | "PhysicsWorldPixToMetres": 0.1, 47 | }, 48 | "parent": { 49 | "name": "IMGUI", 50 | "path": "folders/IMGUI.yy", 51 | }, 52 | "resourceVersion": "1.0", 53 | "name": "Rm_IMGUI_demo", 54 | "tags": [], 55 | "resourceType": "GMRoom", 56 | } -------------------------------------------------------------------------------- /imgui_gamemaker/imgui/imgui_stdlib.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) 2 | // This is also an example of how you may wrap your own similar types. 3 | 4 | // Changelog: 5 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 6 | 7 | #include "imgui.h" 8 | #include "imgui_stdlib.h" 9 | 10 | struct InputTextCallback_UserData 11 | { 12 | std::string* Str; 13 | ImGuiInputTextCallback ChainCallback; 14 | void* ChainCallbackUserData; 15 | }; 16 | 17 | static int InputTextCallback(ImGuiInputTextCallbackData* data) 18 | { 19 | InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData; 20 | if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) 21 | { 22 | // Resize string callback 23 | // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want. 24 | std::string* str = user_data->Str; 25 | IM_ASSERT(data->Buf == str->c_str()); 26 | str->resize(data->BufTextLen); 27 | data->Buf = (char*)str->c_str(); 28 | } 29 | else if (user_data->ChainCallback) 30 | { 31 | // Forward to user callback, if any 32 | data->UserData = user_data->ChainCallbackUserData; 33 | return user_data->ChainCallback(data); 34 | } 35 | return 0; 36 | } 37 | 38 | bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 39 | { 40 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 41 | flags |= ImGuiInputTextFlags_CallbackResize; 42 | 43 | InputTextCallback_UserData cb_user_data; 44 | cb_user_data.Str = str; 45 | cb_user_data.ChainCallback = callback; 46 | cb_user_data.ChainCallbackUserData = user_data; 47 | return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 48 | } 49 | 50 | bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 51 | { 52 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 53 | flags |= ImGuiInputTextFlags_CallbackResize; 54 | 55 | InputTextCallback_UserData cb_user_data; 56 | cb_user_data.Str = str; 57 | cb_user_data.ChainCallback = callback; 58 | cb_user_data.ChainCallbackUserData = user_data; 59 | return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data); 60 | } 61 | 62 | bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 63 | { 64 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 65 | flags |= ImGuiInputTextFlags_CallbackResize; 66 | 67 | InputTextCallback_UserData cb_user_data; 68 | cb_user_data.Str = str; 69 | cb_user_data.ChainCallback = callback; 70 | cb_user_data.ChainCallbackUserData = user_data; 71 | return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 72 | } 73 | 74 | 75 | static auto vector_getter = [](void* vec, int idx, const char** out_text) 76 | { 77 | auto& vector = *static_cast*>(vec); 78 | if (idx < 0 || idx >= static_cast(vector.size())) { return false; } 79 | *out_text = vector.at(idx).c_str(); 80 | return true; 81 | }; 82 | 83 | bool ImGui::Combo(const char* label, int* current_item, std::vector& items, int popup_max_height_in_items) 84 | { 85 | if (items.empty()) { return false; } 86 | return Combo(label, current_item, vector_getter, (void*)&items, items.size(), popup_max_height_in_items); 87 | } 88 | 89 | bool ImGui::ListBox(const char* label, int* current_item, std::vector& items, int height_in_items) 90 | { 91 | if (items.empty()) { return false; } 92 | return ListBox(label, current_item, vector_getter, (void*)&items, items.size(), height_in_items); 93 | } -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui/imgui_stdlib.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) 2 | // This is also an example of how you may wrap your own similar types. 3 | 4 | // Changelog: 5 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 6 | 7 | #include "imgui.h" 8 | #include "imgui_stdlib.h" 9 | 10 | struct InputTextCallback_UserData 11 | { 12 | std::string* Str; 13 | ImGuiInputTextCallback ChainCallback; 14 | void* ChainCallbackUserData; 15 | }; 16 | 17 | static int InputTextCallback(ImGuiInputTextCallbackData* data) 18 | { 19 | InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData; 20 | if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) 21 | { 22 | // Resize string callback 23 | // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want. 24 | std::string* str = user_data->Str; 25 | IM_ASSERT(data->Buf == str->c_str()); 26 | str->resize(data->BufTextLen); 27 | data->Buf = (char*)str->c_str(); 28 | } 29 | else if (user_data->ChainCallback) 30 | { 31 | // Forward to user callback, if any 32 | data->UserData = user_data->ChainCallbackUserData; 33 | return user_data->ChainCallback(data); 34 | } 35 | return 0; 36 | } 37 | 38 | bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 39 | { 40 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 41 | flags |= ImGuiInputTextFlags_CallbackResize; 42 | 43 | InputTextCallback_UserData cb_user_data; 44 | cb_user_data.Str = str; 45 | cb_user_data.ChainCallback = callback; 46 | cb_user_data.ChainCallbackUserData = user_data; 47 | return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 48 | } 49 | 50 | bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 51 | { 52 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 53 | flags |= ImGuiInputTextFlags_CallbackResize; 54 | 55 | InputTextCallback_UserData cb_user_data; 56 | cb_user_data.Str = str; 57 | cb_user_data.ChainCallback = callback; 58 | cb_user_data.ChainCallbackUserData = user_data; 59 | return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data); 60 | } 61 | 62 | bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 63 | { 64 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 65 | flags |= ImGuiInputTextFlags_CallbackResize; 66 | 67 | InputTextCallback_UserData cb_user_data; 68 | cb_user_data.Str = str; 69 | cb_user_data.ChainCallback = callback; 70 | cb_user_data.ChainCallbackUserData = user_data; 71 | return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 72 | } 73 | 74 | static auto vector_getter = [](void* vec, int idx, const char** out_text) 75 | { 76 | auto& vector = *static_cast*>(vec); 77 | if (idx < 0 || idx >= static_cast(vector.size())) { return false; } 78 | *out_text = vector.at(idx).c_str(); 79 | return true; 80 | }; 81 | 82 | bool ImGui::Combo(const char* label, int* current_item, std::vector& items, int popup_max_height_in_items) 83 | { 84 | if (items.empty()) { return false; } 85 | return Combo(label, current_item, vector_getter, (void*)&items, items.size(), popup_max_height_in_items); 86 | } 87 | 88 | bool ImGui::ListBox(const char* label, int* current_item, std::vector& items, int height_in_items) 89 | { 90 | if (items.empty()) { return false; } 91 | return ListBox(label, current_item, vector_getter, (void*)&items, items.size(), height_in_items); 92 | } -------------------------------------------------------------------------------- /imgui_gamemaker/imgui_gamemaker.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | 16.0 15 | Win32Proj 16 | {55f044ce-5ac2-4b9c-a626-cd15618e5823} 17 | imguigamemaker 18 | 10.0 19 | 20 | 21 | 22 | DynamicLibrary 23 | true 24 | v143 25 | Unicode 26 | 27 | 28 | DynamicLibrary 29 | false 30 | v143 31 | true 32 | Unicode 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | $(SolutionDir)\bin\$(ProjectName)\$(Configuration)\ 48 | $(SolutionDir)\bin-int\$(ProjectName)\$(Configuration)\ 49 | imgui_gamemaker 50 | 51 | 52 | $(SolutionDir)\bin\$(ProjectName)\$(Configuration)\ 53 | $(SolutionDir)\bin-int\$(ProjectName)\$(Configuration)\ 54 | imgui_gamemaker 55 | 56 | 57 | 58 | Level3 59 | true 60 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 61 | true 62 | 63 | 64 | Console 65 | true 66 | 67 | 68 | 69 | 70 | Level3 71 | true 72 | true 73 | true 74 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 75 | true 76 | 77 | 78 | Console 79 | true 80 | true 81 | true 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui_gamemaker_x64.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | 16.0 15 | Win32Proj 16 | {ac810538-43a6-4050-ac8c-71b015560589} 17 | imguigamemakerx64 18 | 10.0 19 | 20 | 21 | 22 | DynamicLibrary 23 | true 24 | v143 25 | Unicode 26 | false 27 | 28 | 29 | DynamicLibrary 30 | false 31 | v143 32 | true 33 | Unicode 34 | false 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | true 50 | $(SolutionDir)\bin\$(ProjectName)\$(Configuration)\ 51 | $(SolutionDir)\bin-int\$(ProjectName)\$(Configuration)\ 52 | imgui_gamemaker 53 | 54 | 55 | false 56 | $(SolutionDir)\bin\$(ProjectName)\$(Configuration)\ 57 | $(SolutionDir)\bin-int\$(ProjectName)\$(Configuration)\ 58 | imgui_gamemaker 59 | 60 | 61 | 62 | Level3 63 | true 64 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 65 | true 66 | false 67 | 68 | 69 | Console 70 | true 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | true 78 | true 79 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 80 | true 81 | false 82 | 83 | 84 | Console 85 | true 86 | true 87 | true 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Bb]in-int/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # StyleCop 66 | StyleCopReport.xml 67 | 68 | # Files built by Visual Studio 69 | *_i.c 70 | *_p.c 71 | *_h.h 72 | *.ilk 73 | *.meta 74 | *.obj 75 | *.iobj 76 | *.pch 77 | *.pdb 78 | *.ipdb 79 | *.pgc 80 | *.pgd 81 | *.rsp 82 | *.sbr 83 | *.tlb 84 | *.tli 85 | *.tlh 86 | *.tmp 87 | *.tmp_proj 88 | *_wpftmp.csproj 89 | *.log 90 | *.vspscc 91 | *.vssscc 92 | .builds 93 | *.pidb 94 | *.svclog 95 | *.scc 96 | 97 | # Chutzpah Test files 98 | _Chutzpah* 99 | 100 | # Visual C++ cache files 101 | ipch/ 102 | *.aps 103 | *.ncb 104 | *.opendb 105 | *.opensdf 106 | *.sdf 107 | *.cachefile 108 | *.VC.db 109 | *.VC.VC.opendb 110 | 111 | # Visual Studio profiler 112 | *.psess 113 | *.vsp 114 | *.vspx 115 | *.sap 116 | 117 | # Visual Studio Trace Files 118 | *.e2e 119 | 120 | # TFS 2012 Local Workspace 121 | $tf/ 122 | 123 | # Guidance Automation Toolkit 124 | *.gpState 125 | 126 | # ReSharper is a .NET coding add-in 127 | _ReSharper*/ 128 | *.[Rr]e[Ss]harper 129 | *.DotSettings.user 130 | 131 | # TeamCity is a build add-in 132 | _TeamCity* 133 | 134 | # DotCover is a Code Coverage Tool 135 | *.dotCover 136 | 137 | # AxoCover is a Code Coverage Tool 138 | .axoCover/* 139 | !.axoCover/settings.json 140 | 141 | # Visual Studio code coverage results 142 | *.coverage 143 | *.coveragexml 144 | 145 | # NCrunch 146 | _NCrunch_* 147 | .*crunch*.local.xml 148 | nCrunchTemp_* 149 | 150 | # MightyMoose 151 | *.mm.* 152 | AutoTest.Net/ 153 | 154 | # Web workbench (sass) 155 | .sass-cache/ 156 | 157 | # Installshield output folder 158 | [Ee]xpress/ 159 | 160 | # DocProject is a documentation generator add-in 161 | DocProject/buildhelp/ 162 | DocProject/Help/*.HxT 163 | DocProject/Help/*.HxC 164 | DocProject/Help/*.hhc 165 | DocProject/Help/*.hhk 166 | DocProject/Help/*.hhp 167 | DocProject/Help/Html2 168 | DocProject/Help/html 169 | 170 | # Click-Once directory 171 | publish/ 172 | 173 | # Publish Web Output 174 | *.[Pp]ublish.xml 175 | *.azurePubxml 176 | # Note: Comment the next line if you want to checkin your web deploy settings, 177 | # but database connection strings (with potential passwords) will be unencrypted 178 | *.pubxml 179 | *.publishproj 180 | 181 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 182 | # checkin your Azure Web App publish settings, but sensitive information contained 183 | # in these scripts will be unencrypted 184 | PublishScripts/ 185 | 186 | # NuGet Packages 187 | *.nupkg 188 | # NuGet Symbol Packages 189 | *.snupkg 190 | # The packages folder can be ignored because of Package Restore 191 | **/[Pp]ackages/* 192 | # except build/, which is used as an MSBuild target. 193 | !**/[Pp]ackages/build/ 194 | # Uncomment if necessary however generally it will be regenerated when needed 195 | #!**/[Pp]ackages/repositories.config 196 | # NuGet v3's project.json files produces more ignorable files 197 | *.nuget.props 198 | *.nuget.targets 199 | 200 | # Microsoft Azure Build Output 201 | csx/ 202 | *.build.csdef 203 | 204 | # Microsoft Azure Emulator 205 | ecf/ 206 | rcf/ 207 | 208 | # Windows Store app package directories and files 209 | AppPackages/ 210 | BundleArtifacts/ 211 | Package.StoreAssociation.xml 212 | _pkginfo.txt 213 | *.appx 214 | *.appxbundle 215 | *.appxupload 216 | 217 | # Visual Studio cache files 218 | # files ending in .cache can be ignored 219 | *.[Cc]ache 220 | # but keep track of directories ending in .cache 221 | !?*.[Cc]ache/ 222 | 223 | # Others 224 | ClientBin/ 225 | ~$* 226 | *~ 227 | *.dbmdl 228 | *.dbproj.schemaview 229 | *.jfm 230 | *.pfx 231 | *.publishsettings 232 | orleans.codegen.cs 233 | 234 | # Including strong name files can present a security risk 235 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 236 | #*.snk 237 | 238 | # Since there are multiple workflows, uncomment next line to ignore bower_components 239 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 240 | #bower_components/ 241 | 242 | # RIA/Silverlight projects 243 | Generated_Code/ 244 | 245 | # Backup & report files from converting an old project file 246 | # to a newer Visual Studio version. Backup files are not needed, 247 | # because we have git ;-) 248 | _UpgradeReport_Files/ 249 | Backup*/ 250 | UpgradeLog*.XML 251 | UpgradeLog*.htm 252 | ServiceFabricBackup/ 253 | *.rptproj.bak 254 | 255 | # SQL Server files 256 | *.mdf 257 | *.ldf 258 | *.ndf 259 | 260 | # Business Intelligence projects 261 | *.rdl.data 262 | *.bim.layout 263 | *.bim_*.settings 264 | *.rptproj.rsuser 265 | *- [Bb]ackup.rdl 266 | *- [Bb]ackup ([0-9]).rdl 267 | *- [Bb]ackup ([0-9][0-9]).rdl 268 | 269 | # Microsoft Fakes 270 | FakesAssemblies/ 271 | 272 | # GhostDoc plugin setting file 273 | *.GhostDoc.xml 274 | 275 | # Node.js Tools for Visual Studio 276 | .ntvs_analysis.dat 277 | node_modules/ 278 | 279 | # Visual Studio 6 build log 280 | *.plg 281 | 282 | # Visual Studio 6 workspace options file 283 | *.opt 284 | 285 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 286 | *.vbw 287 | 288 | # Visual Studio LightSwitch build output 289 | **/*.HTMLClient/GeneratedArtifacts 290 | **/*.DesktopClient/GeneratedArtifacts 291 | **/*.DesktopClient/ModelManifest.xml 292 | **/*.Server/GeneratedArtifacts 293 | **/*.Server/ModelManifest.xml 294 | _Pvt_Extensions 295 | 296 | # Paket dependency manager 297 | .paket/paket.exe 298 | paket-files/ 299 | 300 | # FAKE - F# Make 301 | .fake/ 302 | 303 | # CodeRush personal settings 304 | .cr/personal 305 | 306 | # Python Tools for Visual Studio (PTVS) 307 | __pycache__/ 308 | *.pyc 309 | 310 | # Cake - Uncomment if you are using it 311 | # tools/** 312 | # !tools/packages.config 313 | 314 | # Tabs Studio 315 | *.tss 316 | 317 | # Telerik's JustMock configuration file 318 | *.jmconfig 319 | 320 | # BizTalk build output 321 | *.btp.cs 322 | *.btm.cs 323 | *.odx.cs 324 | *.xsd.cs 325 | 326 | # OpenCover UI analysis results 327 | OpenCover/ 328 | 329 | # Azure Stream Analytics local run output 330 | ASALocalRun/ 331 | 332 | # MSBuild Binary and Structured Log 333 | *.binlog 334 | 335 | # NVidia Nsight GPU debugger configuration file 336 | *.nvuser 337 | 338 | # MFractors (Xamarin productivity tool) working folder 339 | .mfractor/ 340 | 341 | # Local History for Visual Studio 342 | .localhistory/ 343 | 344 | # BeatPulse healthcheck temp database 345 | healthchecksdb 346 | 347 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 348 | MigrationBackup/ 349 | 350 | # Ionide (cross platform F# VS Code tools) working folder 351 | .ionide/ 352 | -------------------------------------------------------------------------------- /imgui_gamemaker/imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | #define IMGUI_USE_WCHAR32 17 | #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 18 | 19 | //---- Define assertion handler. Defaults to calling assert(). 20 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 21 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 22 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 23 | 24 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 25 | // Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 26 | // DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 27 | // for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 28 | //#define IMGUI_API __declspec( dllexport ) 29 | //#define IMGUI_API __declspec( dllimport ) 30 | 31 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 32 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 33 | //#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions. 34 | 35 | //---- Disable all of Dear ImGui or don't implement standard windows/tools. 36 | // It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. 37 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 38 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. 39 | //#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88). 40 | 41 | //---- Don't implement some functions to reduce linkage requirements. 42 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) 43 | //#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW) 44 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a) 45 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 46 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 47 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 48 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 49 | //#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies) 50 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 51 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 52 | //#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available 53 | 54 | //---- Include imgui_user.h at the end of imgui.h as a convenience 55 | //#define IMGUI_INCLUDE_IMGUI_USER_H 56 | 57 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 58 | //#define IMGUI_USE_BGRA_PACKED_COLOR 59 | 60 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 61 | //#define IMGUI_USE_WCHAR32 62 | 63 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 64 | // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. 65 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 66 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 67 | //#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled 68 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 69 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 70 | 71 | //---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) 72 | // Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h. 73 | //#define IMGUI_USE_STB_SPRINTF 74 | 75 | //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) 76 | // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). 77 | // On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'. 78 | //#define IMGUI_ENABLE_FREETYPE 79 | 80 | //---- Use stb_truetype to build and rasterize the font atlas (default) 81 | // The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend. 82 | //#define IMGUI_ENABLE_STB_TRUETYPE 83 | 84 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 85 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 86 | /* 87 | #define IM_VEC2_CLASS_EXTRA \ 88 | constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \ 89 | operator MyVec2() const { return MyVec2(x,y); } 90 | 91 | #define IM_VEC4_CLASS_EXTRA \ 92 | constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \ 93 | operator MyVec4() const { return MyVec4(x,y,z,w); } 94 | */ 95 | 96 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 97 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 98 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 99 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 100 | //#define ImDrawIdx unsigned int 101 | 102 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 103 | //struct ImDrawList; 104 | //struct ImDrawCmd; 105 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 106 | //#define ImDrawCallback MyImDrawCallback 107 | 108 | //---- Debug Tools: Macro to break in Debugger 109 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 110 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 111 | //#define IM_DEBUG_BREAK __debugbreak() 112 | 113 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), 114 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) 115 | // This adds a small runtime cost which is why it is not enabled by default. 116 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 117 | 118 | //---- Debug Tools: Enable slower asserts 119 | //#define IMGUI_DEBUG_PARANOID 120 | 121 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 122 | /* 123 | namespace ImGui 124 | { 125 | void MyFunction(const char* name, const MyMatrix44& v); 126 | } 127 | */ 128 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | #define IMGUI_USE_WCHAR32 17 | #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 18 | 19 | //---- Define assertion handler. Defaults to calling assert(). 20 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 21 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 22 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 23 | 24 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 25 | // Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 26 | // DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 27 | // for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 28 | //#define IMGUI_API __declspec( dllexport ) 29 | //#define IMGUI_API __declspec( dllimport ) 30 | 31 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 32 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 33 | //#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions. 34 | 35 | //---- Disable all of Dear ImGui or don't implement standard windows/tools. 36 | // It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. 37 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 38 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. 39 | //#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88). 40 | 41 | //---- Don't implement some functions to reduce linkage requirements. 42 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) 43 | //#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW) 44 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a) 45 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 46 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 47 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 48 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 49 | //#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies) 50 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 51 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 52 | //#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available 53 | 54 | //---- Include imgui_user.h at the end of imgui.h as a convenience 55 | //#define IMGUI_INCLUDE_IMGUI_USER_H 56 | 57 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 58 | //#define IMGUI_USE_BGRA_PACKED_COLOR 59 | 60 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 61 | //#define IMGUI_USE_WCHAR32 62 | 63 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 64 | // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. 65 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 66 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 67 | //#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled 68 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 69 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 70 | 71 | //---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) 72 | // Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h. 73 | //#define IMGUI_USE_STB_SPRINTF 74 | 75 | //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) 76 | // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). 77 | // On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'. 78 | //#define IMGUI_ENABLE_FREETYPE 79 | 80 | //---- Use stb_truetype to build and rasterize the font atlas (default) 81 | // The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend. 82 | //#define IMGUI_ENABLE_STB_TRUETYPE 83 | 84 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 85 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 86 | /* 87 | #define IM_VEC2_CLASS_EXTRA \ 88 | constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \ 89 | operator MyVec2() const { return MyVec2(x,y); } 90 | 91 | #define IM_VEC4_CLASS_EXTRA \ 92 | constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \ 93 | operator MyVec4() const { return MyVec4(x,y,z,w); } 94 | */ 95 | 96 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 97 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 98 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 99 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 100 | //#define ImDrawIdx unsigned int 101 | 102 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 103 | //struct ImDrawList; 104 | //struct ImDrawCmd; 105 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 106 | //#define ImDrawCallback MyImDrawCallback 107 | 108 | //---- Debug Tools: Macro to break in Debugger 109 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 110 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 111 | //#define IM_DEBUG_BREAK __debugbreak() 112 | 113 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), 114 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) 115 | // This adds a small runtime cost which is why it is not enabled by default. 116 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 117 | 118 | //---- Debug Tools: Enable slower asserts 119 | //#define IMGUI_DEBUG_PARANOID 120 | 121 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 122 | /* 123 | namespace ImGui 124 | { 125 | void MyFunction(const char* name, const MyMatrix44& v); 126 | } 127 | */ 128 | -------------------------------------------------------------------------------- /old stuff/usage_example/objects/Obj_ImGuiTesting/Step_0.gml: -------------------------------------------------------------------------------- 1 | imgui_newframe(); 2 | 3 | if (keyboard_check_pressed(vk_space)) { 4 | open = !open; 5 | } 6 | 7 | if (open) { 8 | 9 | var ret = imgui_begin("Test",open,ImGuiWindowFlags.MenuBar); 10 | if (ret[0]) { 11 | open = ret[1]; 12 | #region Combo/Selectable Functions 13 | if (imgui_begin_combo("Selectables##Combo",current_item,0)) { 14 | for (var i = 0; i < array_length(items); ++i) { 15 | 16 | var is_selected = imgui_selectable(items[i],current_item == items[i],0,0,0); 17 | if (is_selected) current_item = items[i]; 18 | } 19 | imgui_end_combo(); 20 | } 21 | 22 | ret = imgui_combo("Combo",current_index,items,array_length(items),-1); 23 | if (ret[0]) current_index = ret[1]; 24 | 25 | #endregion 26 | 27 | #region Drag Functions 28 | ret = imgui_collapsing_header("Drag Functions",noone,0); 29 | if (ret[0]) { 30 | ret = imgui_drag_float("Drag Float",float_v[0],0.1,0,0,"%.3f",0); 31 | if (ret[0]) float_v[0] = ret[1]; 32 | 33 | ret = imgui_drag_float2("Drag Float2",[float_v[0],float_v[1]],0.1,0,0,"%.3f",0); 34 | if (ret[0]) { 35 | float_v[0] = ret[1]; 36 | float_v[1] = ret[2]; 37 | } 38 | 39 | ret = imgui_drag_float3("Drag Float3",[float_v[0],float_v[1],float_v[2]],0.1,0,0,"%.3f",0); 40 | if (ret[0]) { 41 | float_v[0] = ret[1]; 42 | float_v[1] = ret[2]; 43 | float_v[2] = ret[3]; 44 | } 45 | 46 | ret = imgui_drag_float4("Drag Float4",[float_v[0],float_v[1],float_v[2],float_v[3]],0.1,0,0,"%.3f",0); 47 | if (ret[0]) { 48 | float_v[0] = ret[1]; 49 | float_v[1] = ret[2]; 50 | float_v[2] = ret[3]; 51 | float_v[3] = ret[4]; 52 | } 53 | 54 | ret = imgui_drag_float_range2("Drag Float Range2",float_v_current_min,float_v_current_max,0.1,0,0,"%.3f",0,0); 55 | if (ret[0]) { 56 | float_v_current_min = ret[1]; 57 | float_v_current_max = ret[2]; 58 | } 59 | 60 | ret = imgui_drag_int("Drag Int",int_v[0],2,0,0,"%d",0); 61 | if (ret[0]) int_v[0] = ret[1]; 62 | 63 | ret = imgui_drag_int2("Drag Int2",[int_v[0],int_v[1]],2,0,0,"%d",0); 64 | if (ret[0]) { 65 | int_v[0] = ret[1]; 66 | int_v[1] = ret[2]; 67 | } 68 | 69 | ret = imgui_drag_int3("Drag Int3",[int_v[0],int_v[1],int_v[2]],2,0,0,"%d",0); 70 | if (ret[0]) { 71 | int_v[0] = ret[1]; 72 | int_v[1] = ret[2]; 73 | int_v[2] = ret[3]; 74 | } 75 | 76 | ret = imgui_drag_int4("Drag Int4",[int_v[0],int_v[1],int_v[2],int_v[3]],2,0,0,"%d",0); 77 | if (ret[0]) { 78 | int_v[0] = ret[1]; 79 | int_v[1] = ret[2]; 80 | int_v[2] = ret[3]; 81 | int_v[3] = ret[4]; 82 | } 83 | 84 | ret = imgui_drag_int_range2("Drag Int Range2",int_v_current_min,int_v_current_max,2,0,0,"%d",0,0); 85 | if (ret[0]) { 86 | int_v_current_min = ret[1]; 87 | int_v_current_max = ret[2]; 88 | } 89 | } 90 | imgui_separator(); 91 | #endregion 92 | 93 | #region Slider Functions 94 | ret = imgui_collapsing_header("Slider Functions",noone,0); 95 | if (ret[0]) { 96 | ret = imgui_slider_float("Slider Float",float_v[0],-1,1,"%.3f",0); 97 | if (ret[0]) { 98 | float_v[0] = ret[1]; 99 | } 100 | 101 | ret = imgui_slider_float2("Slider Float2",float_v,-1,1,"%.3f",0); 102 | if (ret[0]) { 103 | float_v[0] = ret[1]; 104 | float_v[1] = ret[2]; 105 | } 106 | 107 | ret = imgui_slider_float3("Slider Float3",float_v,-1,1,"%.3f",0); 108 | if (ret[0]) { 109 | float_v[0] = ret[1]; 110 | float_v[1] = ret[2]; 111 | float_v[2] = ret[3]; 112 | } 113 | 114 | ret = imgui_slider_float4("Slider Float4",float_v,-1,1,"%.3f",0); 115 | if (ret[0]) { 116 | float_v[0] = ret[1]; 117 | float_v[1] = ret[2]; 118 | float_v[2] = ret[3]; 119 | float_v[3] = ret[4]; 120 | } 121 | 122 | ret = imgui_slider_angle("Slider Angle",slider_angle,-360,360,"%.0f deg",0); 123 | if (ret[0]) { 124 | slider_angle = ret[1]; 125 | } 126 | 127 | ret = imgui_slider_int("Slider Int",int_v[0],-1,1,"%d",0); 128 | if (ret[0]) { 129 | int_v[0] = ret[1]; 130 | } 131 | 132 | ret = imgui_slider_int2("Slider Int2",int_v,-1,1,"%d",0); 133 | if (ret[0]) { 134 | int_v[0] = ret[1]; 135 | int_v[1] = ret[2]; 136 | } 137 | 138 | ret = imgui_slider_int3("Slider Int3",int_v,-1,1,"%d",0); 139 | if (ret[0]) { 140 | int_v[0] = ret[1]; 141 | int_v[1] = ret[2]; 142 | int_v[2] = ret[3]; 143 | } 144 | 145 | ret = imgui_slider_int4("Slider Int4",int_v,-1,1,"%d",0); 146 | if (ret[0]) { 147 | int_v[0] = ret[1]; 148 | int_v[1] = ret[2]; 149 | int_v[2] = ret[3]; 150 | int_v[3] = ret[4]; 151 | } 152 | 153 | ret = imgui_vslider_float("##vf",24,64,float_v[0],-1,1,"%.3f",0); 154 | if (ret[0]) { 155 | float_v[0] = ret[1]; 156 | } 157 | 158 | imgui_same_line(0,0); 159 | 160 | ret = imgui_vslider_int("##vi",24,64,int_v[0],-1,1,"%d",0); 161 | if (ret[0]) { 162 | int_v[0] = ret[1]; 163 | } 164 | } 165 | imgui_separator(); 166 | #endregion 167 | 168 | #region Keyboard Input Functions 169 | ret = imgui_collapsing_header("Keyboard Input Functions",noone,0); 170 | if (ret[0]) { 171 | ret = imgui_input_text("Input Text",input_text,0) 172 | if (ret[0]) { 173 | input_text = ret[1]; 174 | } 175 | 176 | ret = imgui_input_text_multiline("Multiline Input Text",multiline_input_text,400,200,0); 177 | if (ret[0]) { 178 | multiline_input_text = ret[1]; 179 | } 180 | 181 | ret = imgui_input_text_with_hint("Hint Input Text","Hinty Hint",input_text_with_hint,0); 182 | if (ret[0]) { 183 | input_text_with_hint = ret[1]; 184 | } 185 | 186 | ret = imgui_input_float("Input Float",float_v[0],0.1,0.5,"%.3f",0); 187 | if (ret[0]) float_v[0] = ret[1]; 188 | 189 | ret = imgui_input_float2("Input Float2",float_v,"%.3f",0); 190 | if (ret[0]) { 191 | float_v[0] = ret[1]; 192 | float_v[1] = ret[2]; 193 | } 194 | 195 | ret = imgui_input_float3("Input Float3",float_v,"%.3f",0); 196 | if (ret[0]) { 197 | float_v[0] = ret[1]; 198 | float_v[1] = ret[2]; 199 | float_v[2] = ret[3]; 200 | } 201 | 202 | ret = imgui_input_float4("Input Float4",float_v,"%.3f",0); 203 | if (ret[0]) { 204 | float_v[0] = ret[1]; 205 | float_v[1] = ret[2]; 206 | float_v[2] = ret[3]; 207 | float_v[3] = ret[4]; 208 | } 209 | 210 | ret = imgui_input_int("Input Int",int_v[0],10,100,0); 211 | if (ret[0]) int_v[0] = ret[1]; 212 | 213 | ret = imgui_input_int2("Input Int2",int_v,0); 214 | if (ret[0]) { 215 | int_v[0] = ret[1]; 216 | int_v[1] = ret[2]; 217 | } 218 | 219 | ret = imgui_input_int3("Input Int3",int_v,0); 220 | if (ret[0]) { 221 | int_v[0] = ret[1]; 222 | int_v[1] = ret[2]; 223 | int_v[2] = ret[3]; 224 | } 225 | 226 | ret = imgui_input_int4("Input Int4",int_v,0); 227 | if (ret[0]) { 228 | int_v[0] = ret[1]; 229 | int_v[1] = ret[2]; 230 | int_v[2] = ret[3]; 231 | int_v[3] = ret[4]; 232 | } 233 | } 234 | imgui_separator(); 235 | #endregion 236 | 237 | #region ColorEdit/ColorPicker/ColorButton 238 | ret = imgui_collapsing_header("ColorEdit/ColorPicker/ColorButton Functions",noone,0); 239 | if (ret[0]) { 240 | ret = imgui_color_edit3("Color Edit3",color,0); 241 | if (ret[0]) { 242 | color[0] = ret[1]; 243 | color[1] = ret[2]; 244 | color[2] = ret[3]; 245 | } 246 | 247 | ret = imgui_color_edit4("Color Edit4",color,0); 248 | if (ret[0]) { 249 | color[0] = ret[1]; 250 | color[1] = ret[2]; 251 | color[2] = ret[3]; 252 | color[3] = ret[4]; 253 | } 254 | 255 | ret = imgui_color_picker3("Color Picker3",color,0); 256 | if (ret[0]) { 257 | color[0] = ret[1]; 258 | color[1] = ret[2]; 259 | color[2] = ret[3]; 260 | } 261 | 262 | ret = imgui_color_picker4("Color Picker4",color,0); 263 | if (ret[0]) { 264 | color[0] = ret[1]; 265 | color[1] = ret[2]; 266 | color[2] = ret[3]; 267 | color[3] = ret[4]; 268 | } 269 | 270 | if (imgui_color_button("Color Button",color,0,0,0)) { 271 | color[0] = random(1); 272 | color[1] = random(1); 273 | color[2] = random(1); 274 | } 275 | } 276 | imgui_separator(); 277 | #endregion 278 | 279 | #region Tree Functions 280 | if (collapsing_header_open) { 281 | ret = imgui_collapsing_header("Closing Collapsing Header",collapsing_header_open,0); 282 | if (ret[0]) { 283 | imgui_text("Text inside collapsing header that you can close."); 284 | if (imgui_tree_node("Tree Node")) { 285 | imgui_text("Text inside tree node inside collapsing header that you can close."); 286 | if (imgui_tree_node_ex("Tree Node Ex",0)) { 287 | imgui_text("Text inside inner tree node inside tree node inside collapsing header that you can close."); 288 | imgui_tree_pop();// always remember to pop out of every tree you start 289 | } 290 | imgui_tree_pop();// you have to pop out of tree or else it will crash 291 | } 292 | } 293 | collapsing_header_open = ret[1]; 294 | } 295 | #endregion 296 | 297 | #region List Box Functions 298 | ret = imgui_collapsing_header("List Box Functions",noone,0); 299 | if (ret[0]) { 300 | ret = imgui_list_box("List Box",current_index,items,array_length(items),-1); 301 | if (ret[0]) current_index = ret[1]; 302 | 303 | if (imgui_list_box_header("List Box Header",0,64)) { 304 | imgui_text("Text1 in LBH"); 305 | imgui_text("Text2 in LBH"); 306 | imgui_text("Text3 in LBH"); 307 | imgui_text("Text4 in LBH"); 308 | imgui_list_box_footer(); 309 | } 310 | } 311 | #endregion 312 | 313 | #region Plotting Functions 314 | ret = imgui_collapsing_header("Plotting Functions",noone,0); 315 | if (ret[0]) { 316 | imgui_plot_lines("Plot Lines",[0,1,2,3,4,5,6,7,8,9],2,0,noone,noone,200,50); 317 | imgui_plot_histogram("Plot Histogram",[0,1,2,3,4,5,6,7,8,9],5,"Overlay",noone,noone,500,500); 318 | } 319 | #endregion 320 | 321 | #region Tooltips 322 | imgui_text("Press F1 to see normal tooltip"); 323 | if (keyboard_check(vk_f1)) { 324 | imgui_set_tooltip("Tooltip"); 325 | } 326 | 327 | imgui_text("Press F2 to see custom tooltip"); 328 | if (keyboard_check(vk_f2)) { 329 | imgui_begin_tooltip(); 330 | imgui_button("Button in a tooltip. But why?",0,0); 331 | imgui_set_next_item_open(true,0); 332 | if (imgui_tree_node("Tree in a tooltip")) { 333 | imgui_label_text("Labeled", "Some text in a tree in a tooltip."); 334 | imgui_tree_pop(); 335 | } 336 | imgui_end_tooltip(); 337 | } 338 | #endregion 339 | 340 | #region Popups, Modals 341 | 342 | if (imgui_button("How about a popup?",0,0)) { 343 | imgui_open_popup("Popup",0); 344 | } 345 | if (imgui_begin_popup("Popup",0)) { 346 | imgui_text("I'm in a popup"); 347 | imgui_end_popup(); 348 | } 349 | 350 | if (imgui_button("How about a modal popup?",0,0)) { 351 | imgui_open_popup("Modal Popup",0); 352 | } 353 | ret = imgui_begin_popup_modal("Modal Popup",modal_open,0); 354 | if (ret[0]) { 355 | modal_open = ret[1]; 356 | imgui_text("Im in a modal popup"); 357 | if (imgui_button("Close",0,0)) { 358 | imgui_close_current_popup(); 359 | } 360 | imgui_end_popup(); 361 | } 362 | 363 | // It's really annoying when the comment-block below is active. 364 | // Uncomment to see them popup helper functions working. 365 | /* 366 | if (imgui_begin_child(1,0,0,true,0)) { 367 | imgui_text("Howdy"); 368 | imgui_end_child(); 369 | } 370 | if (imgui_begin_popup_context_item("0",0)) { 371 | imgui_text("Text in a context item popup"); 372 | imgui_end_popup(); 373 | } 374 | 375 | if (imgui_begin_popup_context_window("Test",0)) { 376 | imgui_text("Text in a context window popup"); 377 | imgui_end_popup(); 378 | } 379 | 380 | if (imgui_begin_popup_context_void("Oi",0)) { 381 | imgui_text("Text in a context void popup"); 382 | imgui_end_popup(); 383 | } 384 | */ 385 | 386 | #endregion 387 | 388 | #region Columns 389 | 390 | imgui_columns(4,"columns",true); 391 | imgui_separator(); 392 | imgui_text("ID"); imgui_next_column(); 393 | imgui_text("Name"); imgui_next_column(); 394 | imgui_text("Path"); imgui_next_column(); 395 | imgui_text("Hovered"); imgui_next_column(); 396 | imgui_separator(); 397 | var names = [ "One", "Two", "Three" ]; 398 | var paths = [ "/path/one", "/path/two", "/path/three" ]; 399 | var selected = -1; 400 | for (var i = 0; i < 3; ++i) { 401 | if (imgui_selectable(string_format(i,4,0),selected == i, 0,0,0)) { 402 | selected = i; 403 | } 404 | var hovered = imgui_is_item_hovered(); 405 | imgui_next_column(); 406 | imgui_text(names[i]); imgui_next_column(); 407 | imgui_text(paths[i]); imgui_next_column(); 408 | imgui_text(string(hovered)); imgui_next_column(); 409 | } 410 | imgui_columns(1,0,false); 411 | imgui_separator(); 412 | 413 | #endregion 414 | 415 | #region Tab bars, Tabs 416 | if (imgui_begin_tab_bar("Tab Bar",0)) { 417 | ret = imgui_begin_tab_item("Avocado",avocado_open,0); 418 | if (ret[1] == false and avocado_open) avocado_open = ret[1]; 419 | if (ret[0]) { 420 | avocado_open = ret[1]; 421 | imgui_text("This is the Avocado tab!\nblah blah blah blah blah"); 422 | imgui_end_tab_item(); 423 | } 424 | ret = imgui_begin_tab_item("Broccoli",noone,0); 425 | if (ret[0]) { 426 | //broccoli_open = ret[1]; 427 | imgui_text("This is the Broccoli tab!\nblah blah blah blah blah"); 428 | imgui_end_tab_item(); 429 | } 430 | ret = imgui_begin_tab_item("Cucumber",cucumber_open,0); 431 | if (ret[1] == false and cucumber_open) cucumber_open = ret[1]; 432 | if (ret[0]) { 433 | imgui_text("This is the Cucumber tab!\nblah blah blah blah blah"); 434 | imgui_end_tab_item(); 435 | } 436 | 437 | imgui_end_tab_bar(); 438 | } 439 | #endregion 440 | 441 | } 442 | imgui_end(); 443 | } 444 | 445 | imgui_show_demo_window(true); -------------------------------------------------------------------------------- /imgui_gamemaker_example/scripts/scr_imgui_demo/scr_imgui_demo.gml: -------------------------------------------------------------------------------- 1 | function imgui_help_marker(desc) { 2 | imgui_text_disabled("(?)"); 3 | if (imgui_is_item_hovered()) { 4 | imgui_begin_tooltip(); 5 | imgui_push_text_wrap_pos(imgui_get_font_size() * 35); 6 | imgui_text_unformatted(desc) 7 | imgui_pop_text_wrap_pos(); 8 | imgui_end_tooltip(); 9 | } 10 | } 11 | 12 | function imgui_demo_show_docking_disabled_message() { 13 | var io = imgui_get_io(); 14 | imgui_text("ERROR: Docking is not enabled! See Demo > Configuration."); 15 | imgui_text("Set config_flags |= ImGuiConfigFlags.DockingEnable in your code, or "); 16 | imgui_same_line(0,0); 17 | if (imgui_small_button("click here")) { 18 | var config_flags = imgui_io_get_config_flags(io); 19 | config_flags |= ImGuiConfigFlags.DockingEnable; 20 | imgui_io_set_config_flags(io,config_flags); 21 | } 22 | } 23 | 24 | // Helper to display basic user controls. 25 | function imgui_demo_show_user_guide() { 26 | var io = imgui_get_io(); 27 | imgui_bullet_text("Double-click on title bar to collapse window."); 28 | imgui_bullet_text("Click and drag on lower corner to resize window\n (double-click to auto fit window to its contents)."); 29 | imgui_bullet_text("CTRL+Click on a slider or drag box to input value as text."); 30 | imgui_bullet_text("TAB/SHIFT+TAB to cycle through keyboard editable fields."); 31 | imgui_bullet_text("CTRL+Tab to select a window."); 32 | if (imgui_io_get_font_allow_user_scaling(io)) 33 | imgui_bullet_text("CTRL+Mouse Wheel to zoom window contents."); 34 | imgui_bullet_text("While inputing text:\n"); 35 | imgui_indent(); 36 | imgui_bullet_text("CTRL+Left/Right to word jump."); 37 | imgui_bullet_text("CTRL+A or double-click to select all."); 38 | imgui_bullet_text("CTRL+X/C/V to use clipboard cut/copy/paste."); 39 | imgui_bullet_text("CTRL+Z,CTRL+Y to undo/redo."); 40 | imgui_bullet_text("ESCAPE to revert."); 41 | imgui_unindent(); 42 | imgui_bullet_text("With keyboard navigation enabled:"); 43 | imgui_indent(); 44 | imgui_bullet_text("Arrow keys to navigate."); 45 | imgui_bullet_text("Space to activate a widget."); 46 | imgui_bullet_text("Return to input text into a widget."); 47 | imgui_bullet_text("Escape to deactivate a widget, close popup, exit child window."); 48 | imgui_bullet_text("Alt to jump to the menu layer of a window."); 49 | imgui_unindent(); 50 | } 51 | 52 | 53 | function imgui_demo_show_demo_window_widgets() { 54 | var ret = imgui_collapsing_header("Widgets"); 55 | if (!ret[0]) return; 56 | 57 | static disable_all = false; 58 | if (disable_all) imgui_begin_disabled(); 59 | 60 | if (imgui_tree_node("Basic")) { 61 | 62 | static basic_button_clicked = 0; 63 | if (imgui_button("Button")) basic_button_clicked++; 64 | 65 | if (basic_button_clicked & 1) { 66 | imgui_same_line(); 67 | imgui_text("Thanks for clicking me!"); 68 | } 69 | 70 | static basic_checkbox_check = true; 71 | ret = imgui_checkbox("checkbox",basic_checkbox_check); 72 | basic_checkbox_check = ret[1]; 73 | 74 | static basic_radio_button_e = 0; 75 | if (imgui_radio_button("radio a",basic_radio_button_e == 0)) basic_radio_button_e = 0; imgui_same_line(); 76 | if (imgui_radio_button("radio b",basic_radio_button_e == 1)) basic_radio_button_e = 1; imgui_same_line(); 77 | if (imgui_radio_button("radio c",basic_radio_button_e == 2)) basic_radio_button_e = 2; 78 | 79 | // Color buttons, demonstrate using imgui_push_id() to add unique identifier in the ID stack, and changing style. 80 | for (var i = 0; i < 7; ++i) { 81 | if (i > 0) imgui_same_line(); 82 | imgui_push_id(i); 83 | var col_btn = imgui_color_convert_hsv_to_rgb([i/7,0.6,0.6]); col_btn[3] = 1; 84 | var col_btn_hvr = imgui_color_convert_hsv_to_rgb([i/7,0.7,0.7]); col_btn_hvr[3] = 1; 85 | var col_btn_active = imgui_color_convert_hsv_to_rgb([i/7,0.8,0.8]); col_btn_active[3] = 1; 86 | imgui_push_style_color(ImGuiCol.Button, col_btn); 87 | imgui_push_style_color(ImGuiCol.ButtonHovered,col_btn_hvr); 88 | imgui_push_style_color(ImGuiCol.ButtonActive,col_btn_active); 89 | imgui_button("Click"); 90 | imgui_pop_style_color(3); 91 | imgui_pop_id(); 92 | } 93 | 94 | // Use imgui_align_text_to_frame_padding() to align text baseline to the baseline of framed widgets elements 95 | // (otherwise a Text+SameLine+Button sequence will have the text a little too high by default!) 96 | // See 'Demo->Layout->Text Baseline Alignment' for details. 97 | imgui_align_text_to_frame_padding(); 98 | imgui_text("Hold to repeat:"); 99 | imgui_same_line(); 100 | 101 | // Arrow buttons with Repeater 102 | static basic_repeat_counter = 0; 103 | var style = imgui_get_style(); 104 | var spacing = imgui_style_get_item_inner_spacing(style)[0]; 105 | imgui_push_button_repeat(true); 106 | if (imgui_arrow_button("##left",ImGuiDir.Left)) basic_repeat_counter--; 107 | imgui_same_line(0,spacing); 108 | if (imgui_arrow_button("##right",ImGuiDir.Right)) basic_repeat_counter++; 109 | imgui_pop_button_repeat(); 110 | imgui_same_line(); 111 | imgui_text(string(basic_repeat_counter)); 112 | 113 | imgui_text("Hover over me"); 114 | if (imgui_is_item_hovered()) imgui_set_tooltip("I am a tooltip"); 115 | 116 | imgui_same_line(); 117 | imgui_text("- or me"); 118 | if (imgui_is_item_hovered()) { 119 | imgui_begin_tooltip(); 120 | imgui_text("I am a fancy tooltip"); 121 | static basic_fancy_tooltip_arr = [0.6,0.1,1,0.5,0.92,0.1,0.2]; 122 | imgui_plot_lines("Curve",basic_fancy_tooltip_arr,array_length(basic_fancy_tooltip_arr)); 123 | imgui_end_tooltip(); 124 | } 125 | imgui_separator(); 126 | imgui_label_text("label", "Value"); 127 | 128 | { 129 | 130 | var basic_combo_items = ["AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIIIIII", "JJJJ", "KKKKKKK"]; 131 | static basic_combo_item_current = 0; 132 | ret = imgui_combo("combo",basic_combo_item_current,basic_combo_items,array_length(basic_combo_items)); 133 | basic_combo_item_current = ret[1]; 134 | imgui_same_line(); 135 | imgui_help_marker("Using the simplified one-liner Combo API here.\nRefer to the \"Combo\" section below for an explanation of how to use the more flexible and general imgui_begin_combo/imgui_end_combo API."); 136 | 137 | } 138 | 139 | { 140 | 141 | static basic_input_text_str0 = "Hello, world!"; 142 | ret = imgui_input_text("input text",basic_input_text_str0); 143 | if (ret[0]) basic_input_text_str0 = ret[1]; 144 | imgui_same_line(); 145 | imgui_help_marker("USER:\nHold SHIFT or use mouse to select text.\nCTRL+Left/Right to word jump.\nCTRL+A or double-click to select all.\nCTRL+X,CTRL+C,CTRL+V clipboard.\nCTRL+Z,CTRL+Y undo/redo.\nESCAPE to revert.\n\nPROGRAMMER:\n"); 146 | 147 | static basic_input_text_str1 = ""; 148 | ret = imgui_input_text_with_hint("input text (w/ hint)", "enter text here", basic_input_text_str1); 149 | if (ret[0]) basic_input_text_str1 = ret[1]; 150 | 151 | static basic_input_i0 = 123; 152 | ret = imgui_input_int("input int", basic_input_i0); 153 | if (ret[0]) basic_input_i0 = ret[1]; 154 | 155 | static basic_input_f0 = 0.001; 156 | ret = imgui_input_float("input float", basic_input_f0,0.01,1,"%.3f"); 157 | if (ret[0]) basic_input_f0 = ret[1]; 158 | 159 | static basic_input_d0 = 999999.00000001; 160 | ret = imgui_input_double("input double", basic_input_d0,0.01,1,"%.8f"); 161 | if (ret[0]) basic_input_d0 = ret[1]; 162 | 163 | static basic_input_f1 = 10000000000; 164 | ret = imgui_input_float("input scientific", basic_input_f1,0,0,"%e"); 165 | if (ret[0]) basic_input_f1 = ret[1]; 166 | imgui_same_line(); 167 | imgui_help_marker("You can input value using the scientific notation.\n e.g. \"1e+8\" becomes \"100000000\""); 168 | 169 | static basic_input_vec4a = [0.1,0.2,0.3,0.44]; 170 | ret = imgui_input_float3("input float3", basic_input_vec4a); 171 | if (ret[0]) array_copy(basic_input_vec4a,0,ret,1,3); 172 | 173 | } 174 | 175 | { 176 | 177 | static basic_drag_i1 = 50; 178 | static basic_drag_i2 = 42; 179 | ret = imgui_drag_int("drag int",basic_drag_i1,1); 180 | if (ret[0]) basic_drag_i1 = ret[1]; 181 | imgui_same_line(); 182 | imgui_help_marker("Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+Click to input value."); 183 | 184 | ret = imgui_drag_int("drag int 0..100", basic_drag_i2, 1, 0, 100, "%d%%", ImGuiSliderFlags.AlwaysClamp); 185 | if (ret[0]) basic_drag_i2 = ret[1]; 186 | 187 | static basic_drag_float_f1 = 1; 188 | static basic_drag_float_f2 = 0.0067; 189 | ret = imgui_drag_float("drag float", basic_drag_float_f1, 0.005); 190 | if (ret[0]) basic_drag_float_f1 = ret[1]; 191 | ret = imgui_drag_float("drag small float", basic_drag_float_f2, 0.0001,0,0,"%.06fns"); 192 | if (ret[0]) basic_drag_float_f2 = ret[1]; 193 | 194 | } 195 | 196 | { 197 | 198 | static basic_slider_i1 = 0; 199 | ret = imgui_slider_int("slider int",basic_slider_i1,-1,3); 200 | if (ret[0]) basic_slider_i1 = ret[1]; 201 | imgui_same_line(); 202 | imgui_help_marker("CTRL+Click to input value."); 203 | 204 | static basic_slider_f1 = 0.123; 205 | static basic_slider_f2 = 0; 206 | ret = imgui_slider_float("slider float",basic_slider_f1,0.0,1.0,"ratio = %.3f"); 207 | if (ret[0]) basic_slider_f1 = ret[1]; 208 | ret = imgui_slider_float("slider float (log)",basic_slider_f2,-10.0,10.0,"%.4f",ImGuiSliderFlags.Logarithmic); 209 | if (ret[0]) basic_slider_f2 = ret[1]; 210 | 211 | static basic_slider_angle = 0; 212 | ret = imgui_slider_angle("slider angle",basic_slider_angle); 213 | if (ret[0]) basic_slider_angle = ret[1]; 214 | 215 | enum Element { Fire, Earth, Air, Water, COUNT } 216 | static basic_slider_elem = Element.Fire; 217 | var elem_names = ["Fire","Earth","Air","Water"]; 218 | var elem_name = (basic_slider_elem >= 0 && basic_slider_elem < Element.COUNT) ? elem_names[basic_slider_elem] : "Unknown"; 219 | ret = imgui_slider_int("slider enum",basic_slider_elem,0,Element.COUNT-1,elem_name); 220 | if (ret[0]) basic_slider_elem = ret[1]; 221 | imgui_same_line(); 222 | imgui_help_marker("Using the format string parameter to display a name instead of the underlying integer."); 223 | 224 | } 225 | 226 | { 227 | 228 | static basic_coloredit_col1 = [ 1.0, 0.0, 0.2 ]; 229 | static basic_coloredit_col2 = [ 0.4, 0.7, 0.0, 0.5 ]; 230 | 231 | ret = imgui_color_edit3("color 1", basic_coloredit_col1); 232 | if (ret[0]) array_copy(basic_coloredit_col1,0,ret,1,3); 233 | imgui_same_line(); 234 | imgui_help_marker("Click on the color square to open a color picker.\nClick and hold to use drag and drop.\nRight-click on the color square to show options.\nCTRL+Click on individual component to input value.\n"); 235 | ret = imgui_color_edit4("color 2", basic_coloredit_col2); 236 | if (ret[0]) array_copy(basic_coloredit_col2,0,ret,1,4); 237 | 238 | } 239 | 240 | { 241 | 242 | var basic_listbox_items = ["Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon"]; 243 | static basic_listbox_item_current = 1; 244 | ret = imgui_list_box("listbox",basic_listbox_item_current,basic_listbox_items,array_length(basic_listbox_items),4); 245 | if (ret[0]) basic_listbox_item_current = ret[1]; 246 | 247 | } 248 | 249 | imgui_tree_pop(); 250 | } 251 | 252 | if (imgui_tree_node("Trees")) { 253 | 254 | if (imgui_tree_node("Basic trees")) { 255 | for (var i = 0; i < 5; ++i) { 256 | if (i == 0) imgui_set_next_item_open(true,ImGuiCond.Once); 257 | if (imgui_tree_node("Child " + string(i))) { 258 | imgui_text("blah blah"); 259 | imgui_same_line(); 260 | if (imgui_small_button("button")) {} 261 | imgui_tree_pop(); 262 | } 263 | } 264 | imgui_tree_pop(); 265 | } 266 | 267 | if (imgui_tree_node("Advanced, with Selectable nodes")) { 268 | imgui_help_marker("This is a more typical looking tree with selectable nodes.\nClick to select, CTRL+Click to toggle, click on arrows or double-click to open."); 269 | static trees_adv_base_flags = ImGuiTreeNodeFlags.OpenOnArrow | ImGuiTreeNodeFlags.OpenOnDoubleClick | ImGuiTreeNodeFlags.SpanAvailWidth; 270 | static tree_adv_align_label_with_current_x_position = false; 271 | static tree_adv_test_drag_and_drop = false; 272 | 273 | ret = imgui_checkbox_flags("ImGuiTreeNodesFlags.OpenOnArrow", trees_adv_base_flags, ImGuiTreeNodeFlags.OpenOnArrow); 274 | if (ret[0]) trees_adv_base_flags = ret[1]; 275 | ret = imgui_checkbox_flags("ImGuiTreeNodesFlags.OpenOnDoubleClick", trees_adv_base_flags, ImGuiTreeNodeFlags.OpenOnDoubleClick); 276 | if (ret[0]) trees_adv_base_flags = ret[1]; 277 | ret = imgui_checkbox_flags("ImGuiTreeNodesFlags.SpanAvailWidth", trees_adv_base_flags, ImGuiTreeNodeFlags.SpanAvailWidth); imgui_same_line(); imgui_help_marker("Extend hit area to all available width instead of allowing more items to be laid out after the node."); 278 | if (ret[0]) trees_adv_base_flags = ret[1]; 279 | ret = imgui_checkbox_flags("ImGuiTreeNodesFlags.SpanFullWidth", trees_adv_base_flags, ImGuiTreeNodeFlags.SpanFullWidth); 280 | if (ret[0]) trees_adv_base_flags = ret[1]; 281 | 282 | ret = imgui_checkbox("Align label with current X position",tree_adv_align_label_with_current_x_position); 283 | if (ret[0]) tree_adv_align_label_with_current_x_position = ret[1]; 284 | ret = imgui_checkbox("Test tree node as a drag source",tree_adv_test_drag_and_drop); 285 | if (ret[0]) tree_adv_test_drag_and_drop = ret[1]; 286 | imgui_text("Hello!"); 287 | if (tree_adv_align_label_with_current_x_position) imgui_unindent(imgui_get_tree_node_to_label_spacing()); 288 | 289 | static trees_adv_selection_mask = 1<<2; 290 | var node_clicked = -1; 291 | for (var i = 0; i < 6; ++i) { 292 | var node_flags = trees_adv_base_flags; 293 | var is_selected = (trees_adv_selection_mask & (1<= 'width' 147 | // or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1' 148 | // 149 | // If you don't do either of the above things, widths will be quantized to multiples 150 | // of small integers to guarantee the algorithm doesn't run out of temporary storage. 151 | // 152 | // If you do #2, then the non-quantized algorithm will be used, but the algorithm 153 | // may run out of temporary storage and be unable to pack some rectangles. 154 | 155 | STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem); 156 | // Optionally call this function after init but before doing any packing to 157 | // change the handling of the out-of-temp-memory scenario, described above. 158 | // If you call init again, this will be reset to the default (false). 159 | 160 | 161 | STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic); 162 | // Optionally select which packing heuristic the library should use. Different 163 | // heuristics will produce better/worse results for different data sets. 164 | // If you call init again, this will be reset to the default. 165 | 166 | enum 167 | { 168 | STBRP_HEURISTIC_Skyline_default=0, 169 | STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default, 170 | STBRP_HEURISTIC_Skyline_BF_sortHeight 171 | }; 172 | 173 | 174 | ////////////////////////////////////////////////////////////////////////////// 175 | // 176 | // the details of the following structures don't matter to you, but they must 177 | // be visible so you can handle the memory allocations for them 178 | 179 | struct stbrp_node 180 | { 181 | stbrp_coord x,y; 182 | stbrp_node *next; 183 | }; 184 | 185 | struct stbrp_context 186 | { 187 | int width; 188 | int height; 189 | int align; 190 | int init_mode; 191 | int heuristic; 192 | int num_nodes; 193 | stbrp_node *active_head; 194 | stbrp_node *free_head; 195 | stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' 196 | }; 197 | 198 | #ifdef __cplusplus 199 | } 200 | #endif 201 | 202 | #endif 203 | 204 | ////////////////////////////////////////////////////////////////////////////// 205 | // 206 | // IMPLEMENTATION SECTION 207 | // 208 | 209 | #ifdef STB_RECT_PACK_IMPLEMENTATION 210 | #ifndef STBRP_SORT 211 | #include 212 | #define STBRP_SORT qsort 213 | #endif 214 | 215 | #ifndef STBRP_ASSERT 216 | #include 217 | #define STBRP_ASSERT assert 218 | #endif 219 | 220 | #ifdef _MSC_VER 221 | #define STBRP__NOTUSED(v) (void)(v) 222 | #define STBRP__CDECL __cdecl 223 | #else 224 | #define STBRP__NOTUSED(v) (void)sizeof(v) 225 | #define STBRP__CDECL 226 | #endif 227 | 228 | enum 229 | { 230 | STBRP__INIT_skyline = 1 231 | }; 232 | 233 | STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic) 234 | { 235 | switch (context->init_mode) { 236 | case STBRP__INIT_skyline: 237 | STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight); 238 | context->heuristic = heuristic; 239 | break; 240 | default: 241 | STBRP_ASSERT(0); 242 | } 243 | } 244 | 245 | STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem) 246 | { 247 | if (allow_out_of_mem) 248 | // if it's ok to run out of memory, then don't bother aligning them; 249 | // this gives better packing, but may fail due to OOM (even though 250 | // the rectangles easily fit). @TODO a smarter approach would be to only 251 | // quantize once we've hit OOM, then we could get rid of this parameter. 252 | context->align = 1; 253 | else { 254 | // if it's not ok to run out of memory, then quantize the widths 255 | // so that num_nodes is always enough nodes. 256 | // 257 | // I.e. num_nodes * align >= width 258 | // align >= width / num_nodes 259 | // align = ceil(width/num_nodes) 260 | 261 | context->align = (context->width + context->num_nodes-1) / context->num_nodes; 262 | } 263 | } 264 | 265 | STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes) 266 | { 267 | int i; 268 | 269 | for (i=0; i < num_nodes-1; ++i) 270 | nodes[i].next = &nodes[i+1]; 271 | nodes[i].next = NULL; 272 | context->init_mode = STBRP__INIT_skyline; 273 | context->heuristic = STBRP_HEURISTIC_Skyline_default; 274 | context->free_head = &nodes[0]; 275 | context->active_head = &context->extra[0]; 276 | context->width = width; 277 | context->height = height; 278 | context->num_nodes = num_nodes; 279 | stbrp_setup_allow_out_of_mem(context, 0); 280 | 281 | // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly) 282 | context->extra[0].x = 0; 283 | context->extra[0].y = 0; 284 | context->extra[0].next = &context->extra[1]; 285 | context->extra[1].x = (stbrp_coord) width; 286 | context->extra[1].y = (1<<30); 287 | context->extra[1].next = NULL; 288 | } 289 | 290 | // find minimum y position if it starts at x1 291 | static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste) 292 | { 293 | stbrp_node *node = first; 294 | int x1 = x0 + width; 295 | int min_y, visited_width, waste_area; 296 | 297 | STBRP__NOTUSED(c); 298 | 299 | STBRP_ASSERT(first->x <= x0); 300 | 301 | #if 0 302 | // skip in case we're past the node 303 | while (node->next->x <= x0) 304 | ++node; 305 | #else 306 | STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency 307 | #endif 308 | 309 | STBRP_ASSERT(node->x <= x0); 310 | 311 | min_y = 0; 312 | waste_area = 0; 313 | visited_width = 0; 314 | while (node->x < x1) { 315 | if (node->y > min_y) { 316 | // raise min_y higher. 317 | // we've accounted for all waste up to min_y, 318 | // but we'll now add more waste for everything we've visted 319 | waste_area += visited_width * (node->y - min_y); 320 | min_y = node->y; 321 | // the first time through, visited_width might be reduced 322 | if (node->x < x0) 323 | visited_width += node->next->x - x0; 324 | else 325 | visited_width += node->next->x - node->x; 326 | } else { 327 | // add waste area 328 | int under_width = node->next->x - node->x; 329 | if (under_width + visited_width > width) 330 | under_width = width - visited_width; 331 | waste_area += under_width * (min_y - node->y); 332 | visited_width += under_width; 333 | } 334 | node = node->next; 335 | } 336 | 337 | *pwaste = waste_area; 338 | return min_y; 339 | } 340 | 341 | typedef struct 342 | { 343 | int x,y; 344 | stbrp_node **prev_link; 345 | } stbrp__findresult; 346 | 347 | static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height) 348 | { 349 | int best_waste = (1<<30), best_x, best_y = (1 << 30); 350 | stbrp__findresult fr; 351 | stbrp_node **prev, *node, *tail, **best = NULL; 352 | 353 | // align to multiple of c->align 354 | width = (width + c->align - 1); 355 | width -= width % c->align; 356 | STBRP_ASSERT(width % c->align == 0); 357 | 358 | // if it can't possibly fit, bail immediately 359 | if (width > c->width || height > c->height) { 360 | fr.prev_link = NULL; 361 | fr.x = fr.y = 0; 362 | return fr; 363 | } 364 | 365 | node = c->active_head; 366 | prev = &c->active_head; 367 | while (node->x + width <= c->width) { 368 | int y,waste; 369 | y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste); 370 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL 371 | // bottom left 372 | if (y < best_y) { 373 | best_y = y; 374 | best = prev; 375 | } 376 | } else { 377 | // best-fit 378 | if (y + height <= c->height) { 379 | // can only use it if it first vertically 380 | if (y < best_y || (y == best_y && waste < best_waste)) { 381 | best_y = y; 382 | best_waste = waste; 383 | best = prev; 384 | } 385 | } 386 | } 387 | prev = &node->next; 388 | node = node->next; 389 | } 390 | 391 | best_x = (best == NULL) ? 0 : (*best)->x; 392 | 393 | // if doing best-fit (BF), we also have to try aligning right edge to each node position 394 | // 395 | // e.g, if fitting 396 | // 397 | // ____________________ 398 | // |____________________| 399 | // 400 | // into 401 | // 402 | // | | 403 | // | ____________| 404 | // |____________| 405 | // 406 | // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned 407 | // 408 | // This makes BF take about 2x the time 409 | 410 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) { 411 | tail = c->active_head; 412 | node = c->active_head; 413 | prev = &c->active_head; 414 | // find first node that's admissible 415 | while (tail->x < width) 416 | tail = tail->next; 417 | while (tail) { 418 | int xpos = tail->x - width; 419 | int y,waste; 420 | STBRP_ASSERT(xpos >= 0); 421 | // find the left position that matches this 422 | while (node->next->x <= xpos) { 423 | prev = &node->next; 424 | node = node->next; 425 | } 426 | STBRP_ASSERT(node->next->x > xpos && node->x <= xpos); 427 | y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste); 428 | if (y + height <= c->height) { 429 | if (y <= best_y) { 430 | if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) { 431 | best_x = xpos; 432 | //STBRP_ASSERT(y <= best_y); [DEAR IMGUI] 433 | best_y = y; 434 | best_waste = waste; 435 | best = prev; 436 | } 437 | } 438 | } 439 | tail = tail->next; 440 | } 441 | } 442 | 443 | fr.prev_link = best; 444 | fr.x = best_x; 445 | fr.y = best_y; 446 | return fr; 447 | } 448 | 449 | static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height) 450 | { 451 | // find best position according to heuristic 452 | stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height); 453 | stbrp_node *node, *cur; 454 | 455 | // bail if: 456 | // 1. it failed 457 | // 2. the best node doesn't fit (we don't always check this) 458 | // 3. we're out of memory 459 | if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) { 460 | res.prev_link = NULL; 461 | return res; 462 | } 463 | 464 | // on success, create new node 465 | node = context->free_head; 466 | node->x = (stbrp_coord) res.x; 467 | node->y = (stbrp_coord) (res.y + height); 468 | 469 | context->free_head = node->next; 470 | 471 | // insert the new node into the right starting point, and 472 | // let 'cur' point to the remaining nodes needing to be 473 | // stiched back in 474 | 475 | cur = *res.prev_link; 476 | if (cur->x < res.x) { 477 | // preserve the existing one, so start testing with the next one 478 | stbrp_node *next = cur->next; 479 | cur->next = node; 480 | cur = next; 481 | } else { 482 | *res.prev_link = node; 483 | } 484 | 485 | // from here, traverse cur and free the nodes, until we get to one 486 | // that shouldn't be freed 487 | while (cur->next && cur->next->x <= res.x + width) { 488 | stbrp_node *next = cur->next; 489 | // move the current node to the free list 490 | cur->next = context->free_head; 491 | context->free_head = cur; 492 | cur = next; 493 | } 494 | 495 | // stitch the list back in 496 | node->next = cur; 497 | 498 | if (cur->x < res.x + width) 499 | cur->x = (stbrp_coord) (res.x + width); 500 | 501 | #ifdef _DEBUG 502 | cur = context->active_head; 503 | while (cur->x < context->width) { 504 | STBRP_ASSERT(cur->x < cur->next->x); 505 | cur = cur->next; 506 | } 507 | STBRP_ASSERT(cur->next == NULL); 508 | 509 | { 510 | int count=0; 511 | cur = context->active_head; 512 | while (cur) { 513 | cur = cur->next; 514 | ++count; 515 | } 516 | cur = context->free_head; 517 | while (cur) { 518 | cur = cur->next; 519 | ++count; 520 | } 521 | STBRP_ASSERT(count == context->num_nodes+2); 522 | } 523 | #endif 524 | 525 | return res; 526 | } 527 | 528 | static int STBRP__CDECL rect_height_compare(const void *a, const void *b) 529 | { 530 | const stbrp_rect *p = (const stbrp_rect *) a; 531 | const stbrp_rect *q = (const stbrp_rect *) b; 532 | if (p->h > q->h) 533 | return -1; 534 | if (p->h < q->h) 535 | return 1; 536 | return (p->w > q->w) ? -1 : (p->w < q->w); 537 | } 538 | 539 | static int STBRP__CDECL rect_original_order(const void *a, const void *b) 540 | { 541 | const stbrp_rect *p = (const stbrp_rect *) a; 542 | const stbrp_rect *q = (const stbrp_rect *) b; 543 | return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); 544 | } 545 | 546 | STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) 547 | { 548 | int i, all_rects_packed = 1; 549 | 550 | // we use the 'was_packed' field internally to allow sorting/unsorting 551 | for (i=0; i < num_rects; ++i) { 552 | rects[i].was_packed = i; 553 | } 554 | 555 | // sort according to heuristic 556 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare); 557 | 558 | for (i=0; i < num_rects; ++i) { 559 | if (rects[i].w == 0 || rects[i].h == 0) { 560 | rects[i].x = rects[i].y = 0; // empty rect needs no space 561 | } else { 562 | stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h); 563 | if (fr.prev_link) { 564 | rects[i].x = (stbrp_coord) fr.x; 565 | rects[i].y = (stbrp_coord) fr.y; 566 | } else { 567 | rects[i].x = rects[i].y = STBRP__MAXVAL; 568 | } 569 | } 570 | } 571 | 572 | // unsort 573 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); 574 | 575 | // set was_packed flags and all_rects_packed status 576 | for (i=0; i < num_rects; ++i) { 577 | rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL); 578 | if (!rects[i].was_packed) 579 | all_rects_packed = 0; 580 | } 581 | 582 | // return the all_rects_packed status 583 | return all_rects_packed; 584 | } 585 | #endif 586 | 587 | /* 588 | ------------------------------------------------------------------------------ 589 | This software is available under 2 licenses -- choose whichever you prefer. 590 | ------------------------------------------------------------------------------ 591 | ALTERNATIVE A - MIT License 592 | Copyright (c) 2017 Sean Barrett 593 | Permission is hereby granted, free of charge, to any person obtaining a copy of 594 | this software and associated documentation files (the "Software"), to deal in 595 | the Software without restriction, including without limitation the rights to 596 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 597 | of the Software, and to permit persons to whom the Software is furnished to do 598 | so, subject to the following conditions: 599 | The above copyright notice and this permission notice shall be included in all 600 | copies or substantial portions of the Software. 601 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 602 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 603 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 604 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 605 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 606 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 607 | SOFTWARE. 608 | ------------------------------------------------------------------------------ 609 | ALTERNATIVE B - Public Domain (www.unlicense.org) 610 | This is free and unencumbered software released into the public domain. 611 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this 612 | software, either in source code form or as a compiled binary, for any purpose, 613 | commercial or non-commercial, and by any means. 614 | In jurisdictions that recognize copyright laws, the author or authors of this 615 | software dedicate any and all copyright interest in the software to the public 616 | domain. We make this dedication for the benefit of the public at large and to 617 | the detriment of our heirs and successors. We intend this dedication to be an 618 | overt act of relinquishment in perpetuity of all present and future rights to 619 | this software under copyright law. 620 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 621 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 622 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 623 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 624 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 625 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 626 | ------------------------------------------------------------------------------ 627 | */ 628 | -------------------------------------------------------------------------------- /old stuff/imgui_gamemaker_x64/imgui/imstb_rectpack.h: -------------------------------------------------------------------------------- 1 | // [DEAR IMGUI] 2 | // This is a slightly modified version of stb_rect_pack.h 1.01. 3 | // Grep for [DEAR IMGUI] to find the changes. 4 | // 5 | // stb_rect_pack.h - v1.01 - public domain - rectangle packing 6 | // Sean Barrett 2014 7 | // 8 | // Useful for e.g. packing rectangular textures into an atlas. 9 | // Does not do rotation. 10 | // 11 | // Before #including, 12 | // 13 | // #define STB_RECT_PACK_IMPLEMENTATION 14 | // 15 | // in the file that you want to have the implementation. 16 | // 17 | // Not necessarily the awesomest packing method, but better than 18 | // the totally naive one in stb_truetype (which is primarily what 19 | // this is meant to replace). 20 | // 21 | // Has only had a few tests run, may have issues. 22 | // 23 | // More docs to come. 24 | // 25 | // No memory allocations; uses qsort() and assert() from stdlib. 26 | // Can override those by defining STBRP_SORT and STBRP_ASSERT. 27 | // 28 | // This library currently uses the Skyline Bottom-Left algorithm. 29 | // 30 | // Please note: better rectangle packers are welcome! Please 31 | // implement them to the same API, but with a different init 32 | // function. 33 | // 34 | // Credits 35 | // 36 | // Library 37 | // Sean Barrett 38 | // Minor features 39 | // Martins Mozeiko 40 | // github:IntellectualKitty 41 | // 42 | // Bugfixes / warning fixes 43 | // Jeremy Jaussaud 44 | // Fabian Giesen 45 | // 46 | // Version history: 47 | // 48 | // 1.01 (2021-07-11) always use large rect mode, expose STBRP__MAXVAL in public section 49 | // 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles 50 | // 0.99 (2019-02-07) warning fixes 51 | // 0.11 (2017-03-03) return packing success/fail result 52 | // 0.10 (2016-10-25) remove cast-away-const to avoid warnings 53 | // 0.09 (2016-08-27) fix compiler warnings 54 | // 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0) 55 | // 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0) 56 | // 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort 57 | // 0.05: added STBRP_ASSERT to allow replacing assert 58 | // 0.04: fixed minor bug in STBRP_LARGE_RECTS support 59 | // 0.01: initial release 60 | // 61 | // LICENSE 62 | // 63 | // See end of file for license information. 64 | 65 | ////////////////////////////////////////////////////////////////////////////// 66 | // 67 | // INCLUDE SECTION 68 | // 69 | 70 | #ifndef STB_INCLUDE_STB_RECT_PACK_H 71 | #define STB_INCLUDE_STB_RECT_PACK_H 72 | 73 | #define STB_RECT_PACK_VERSION 1 74 | 75 | #ifdef STBRP_STATIC 76 | #define STBRP_DEF static 77 | #else 78 | #define STBRP_DEF extern 79 | #endif 80 | 81 | #ifdef __cplusplus 82 | extern "C" { 83 | #endif 84 | 85 | typedef struct stbrp_context stbrp_context; 86 | typedef struct stbrp_node stbrp_node; 87 | typedef struct stbrp_rect stbrp_rect; 88 | 89 | typedef int stbrp_coord; 90 | 91 | #define STBRP__MAXVAL 0x7fffffff 92 | // Mostly for internal use, but this is the maximum supported coordinate value. 93 | 94 | STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects); 95 | // Assign packed locations to rectangles. The rectangles are of type 96 | // 'stbrp_rect' defined below, stored in the array 'rects', and there 97 | // are 'num_rects' many of them. 98 | // 99 | // Rectangles which are successfully packed have the 'was_packed' flag 100 | // set to a non-zero value and 'x' and 'y' store the minimum location 101 | // on each axis (i.e. bottom-left in cartesian coordinates, top-left 102 | // if you imagine y increasing downwards). Rectangles which do not fit 103 | // have the 'was_packed' flag set to 0. 104 | // 105 | // You should not try to access the 'rects' array from another thread 106 | // while this function is running, as the function temporarily reorders 107 | // the array while it executes. 108 | // 109 | // To pack into another rectangle, you need to call stbrp_init_target 110 | // again. To continue packing into the same rectangle, you can call 111 | // this function again. Calling this multiple times with multiple rect 112 | // arrays will probably produce worse packing results than calling it 113 | // a single time with the full rectangle array, but the option is 114 | // available. 115 | // 116 | // The function returns 1 if all of the rectangles were successfully 117 | // packed and 0 otherwise. 118 | 119 | struct stbrp_rect 120 | { 121 | // reserved for your use: 122 | int id; 123 | 124 | // input: 125 | stbrp_coord w, h; 126 | 127 | // output: 128 | stbrp_coord x, y; 129 | int was_packed; // non-zero if valid packing 130 | 131 | }; // 16 bytes, nominally 132 | 133 | 134 | STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes); 135 | // Initialize a rectangle packer to: 136 | // pack a rectangle that is 'width' by 'height' in dimensions 137 | // using temporary storage provided by the array 'nodes', which is 'num_nodes' long 138 | // 139 | // You must call this function every time you start packing into a new target. 140 | // 141 | // There is no "shutdown" function. The 'nodes' memory must stay valid for 142 | // the following stbrp_pack_rects() call (or calls), but can be freed after 143 | // the call (or calls) finish. 144 | // 145 | // Note: to guarantee best results, either: 146 | // 1. make sure 'num_nodes' >= 'width' 147 | // or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1' 148 | // 149 | // If you don't do either of the above things, widths will be quantized to multiples 150 | // of small integers to guarantee the algorithm doesn't run out of temporary storage. 151 | // 152 | // If you do #2, then the non-quantized algorithm will be used, but the algorithm 153 | // may run out of temporary storage and be unable to pack some rectangles. 154 | 155 | STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem); 156 | // Optionally call this function after init but before doing any packing to 157 | // change the handling of the out-of-temp-memory scenario, described above. 158 | // If you call init again, this will be reset to the default (false). 159 | 160 | 161 | STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic); 162 | // Optionally select which packing heuristic the library should use. Different 163 | // heuristics will produce better/worse results for different data sets. 164 | // If you call init again, this will be reset to the default. 165 | 166 | enum 167 | { 168 | STBRP_HEURISTIC_Skyline_default=0, 169 | STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default, 170 | STBRP_HEURISTIC_Skyline_BF_sortHeight 171 | }; 172 | 173 | 174 | ////////////////////////////////////////////////////////////////////////////// 175 | // 176 | // the details of the following structures don't matter to you, but they must 177 | // be visible so you can handle the memory allocations for them 178 | 179 | struct stbrp_node 180 | { 181 | stbrp_coord x,y; 182 | stbrp_node *next; 183 | }; 184 | 185 | struct stbrp_context 186 | { 187 | int width; 188 | int height; 189 | int align; 190 | int init_mode; 191 | int heuristic; 192 | int num_nodes; 193 | stbrp_node *active_head; 194 | stbrp_node *free_head; 195 | stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' 196 | }; 197 | 198 | #ifdef __cplusplus 199 | } 200 | #endif 201 | 202 | #endif 203 | 204 | ////////////////////////////////////////////////////////////////////////////// 205 | // 206 | // IMPLEMENTATION SECTION 207 | // 208 | 209 | #ifdef STB_RECT_PACK_IMPLEMENTATION 210 | #ifndef STBRP_SORT 211 | #include 212 | #define STBRP_SORT qsort 213 | #endif 214 | 215 | #ifndef STBRP_ASSERT 216 | #include 217 | #define STBRP_ASSERT assert 218 | #endif 219 | 220 | #ifdef _MSC_VER 221 | #define STBRP__NOTUSED(v) (void)(v) 222 | #define STBRP__CDECL __cdecl 223 | #else 224 | #define STBRP__NOTUSED(v) (void)sizeof(v) 225 | #define STBRP__CDECL 226 | #endif 227 | 228 | enum 229 | { 230 | STBRP__INIT_skyline = 1 231 | }; 232 | 233 | STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic) 234 | { 235 | switch (context->init_mode) { 236 | case STBRP__INIT_skyline: 237 | STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight); 238 | context->heuristic = heuristic; 239 | break; 240 | default: 241 | STBRP_ASSERT(0); 242 | } 243 | } 244 | 245 | STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem) 246 | { 247 | if (allow_out_of_mem) 248 | // if it's ok to run out of memory, then don't bother aligning them; 249 | // this gives better packing, but may fail due to OOM (even though 250 | // the rectangles easily fit). @TODO a smarter approach would be to only 251 | // quantize once we've hit OOM, then we could get rid of this parameter. 252 | context->align = 1; 253 | else { 254 | // if it's not ok to run out of memory, then quantize the widths 255 | // so that num_nodes is always enough nodes. 256 | // 257 | // I.e. num_nodes * align >= width 258 | // align >= width / num_nodes 259 | // align = ceil(width/num_nodes) 260 | 261 | context->align = (context->width + context->num_nodes-1) / context->num_nodes; 262 | } 263 | } 264 | 265 | STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes) 266 | { 267 | int i; 268 | 269 | for (i=0; i < num_nodes-1; ++i) 270 | nodes[i].next = &nodes[i+1]; 271 | nodes[i].next = NULL; 272 | context->init_mode = STBRP__INIT_skyline; 273 | context->heuristic = STBRP_HEURISTIC_Skyline_default; 274 | context->free_head = &nodes[0]; 275 | context->active_head = &context->extra[0]; 276 | context->width = width; 277 | context->height = height; 278 | context->num_nodes = num_nodes; 279 | stbrp_setup_allow_out_of_mem(context, 0); 280 | 281 | // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly) 282 | context->extra[0].x = 0; 283 | context->extra[0].y = 0; 284 | context->extra[0].next = &context->extra[1]; 285 | context->extra[1].x = (stbrp_coord) width; 286 | context->extra[1].y = (1<<30); 287 | context->extra[1].next = NULL; 288 | } 289 | 290 | // find minimum y position if it starts at x1 291 | static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste) 292 | { 293 | stbrp_node *node = first; 294 | int x1 = x0 + width; 295 | int min_y, visited_width, waste_area; 296 | 297 | STBRP__NOTUSED(c); 298 | 299 | STBRP_ASSERT(first->x <= x0); 300 | 301 | #if 0 302 | // skip in case we're past the node 303 | while (node->next->x <= x0) 304 | ++node; 305 | #else 306 | STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency 307 | #endif 308 | 309 | STBRP_ASSERT(node->x <= x0); 310 | 311 | min_y = 0; 312 | waste_area = 0; 313 | visited_width = 0; 314 | while (node->x < x1) { 315 | if (node->y > min_y) { 316 | // raise min_y higher. 317 | // we've accounted for all waste up to min_y, 318 | // but we'll now add more waste for everything we've visted 319 | waste_area += visited_width * (node->y - min_y); 320 | min_y = node->y; 321 | // the first time through, visited_width might be reduced 322 | if (node->x < x0) 323 | visited_width += node->next->x - x0; 324 | else 325 | visited_width += node->next->x - node->x; 326 | } else { 327 | // add waste area 328 | int under_width = node->next->x - node->x; 329 | if (under_width + visited_width > width) 330 | under_width = width - visited_width; 331 | waste_area += under_width * (min_y - node->y); 332 | visited_width += under_width; 333 | } 334 | node = node->next; 335 | } 336 | 337 | *pwaste = waste_area; 338 | return min_y; 339 | } 340 | 341 | typedef struct 342 | { 343 | int x,y; 344 | stbrp_node **prev_link; 345 | } stbrp__findresult; 346 | 347 | static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height) 348 | { 349 | int best_waste = (1<<30), best_x, best_y = (1 << 30); 350 | stbrp__findresult fr; 351 | stbrp_node **prev, *node, *tail, **best = NULL; 352 | 353 | // align to multiple of c->align 354 | width = (width + c->align - 1); 355 | width -= width % c->align; 356 | STBRP_ASSERT(width % c->align == 0); 357 | 358 | // if it can't possibly fit, bail immediately 359 | if (width > c->width || height > c->height) { 360 | fr.prev_link = NULL; 361 | fr.x = fr.y = 0; 362 | return fr; 363 | } 364 | 365 | node = c->active_head; 366 | prev = &c->active_head; 367 | while (node->x + width <= c->width) { 368 | int y,waste; 369 | y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste); 370 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL 371 | // bottom left 372 | if (y < best_y) { 373 | best_y = y; 374 | best = prev; 375 | } 376 | } else { 377 | // best-fit 378 | if (y + height <= c->height) { 379 | // can only use it if it first vertically 380 | if (y < best_y || (y == best_y && waste < best_waste)) { 381 | best_y = y; 382 | best_waste = waste; 383 | best = prev; 384 | } 385 | } 386 | } 387 | prev = &node->next; 388 | node = node->next; 389 | } 390 | 391 | best_x = (best == NULL) ? 0 : (*best)->x; 392 | 393 | // if doing best-fit (BF), we also have to try aligning right edge to each node position 394 | // 395 | // e.g, if fitting 396 | // 397 | // ____________________ 398 | // |____________________| 399 | // 400 | // into 401 | // 402 | // | | 403 | // | ____________| 404 | // |____________| 405 | // 406 | // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned 407 | // 408 | // This makes BF take about 2x the time 409 | 410 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) { 411 | tail = c->active_head; 412 | node = c->active_head; 413 | prev = &c->active_head; 414 | // find first node that's admissible 415 | while (tail->x < width) 416 | tail = tail->next; 417 | while (tail) { 418 | int xpos = tail->x - width; 419 | int y,waste; 420 | STBRP_ASSERT(xpos >= 0); 421 | // find the left position that matches this 422 | while (node->next->x <= xpos) { 423 | prev = &node->next; 424 | node = node->next; 425 | } 426 | STBRP_ASSERT(node->next->x > xpos && node->x <= xpos); 427 | y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste); 428 | if (y + height <= c->height) { 429 | if (y <= best_y) { 430 | if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) { 431 | best_x = xpos; 432 | //STBRP_ASSERT(y <= best_y); [DEAR IMGUI] 433 | best_y = y; 434 | best_waste = waste; 435 | best = prev; 436 | } 437 | } 438 | } 439 | tail = tail->next; 440 | } 441 | } 442 | 443 | fr.prev_link = best; 444 | fr.x = best_x; 445 | fr.y = best_y; 446 | return fr; 447 | } 448 | 449 | static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height) 450 | { 451 | // find best position according to heuristic 452 | stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height); 453 | stbrp_node *node, *cur; 454 | 455 | // bail if: 456 | // 1. it failed 457 | // 2. the best node doesn't fit (we don't always check this) 458 | // 3. we're out of memory 459 | if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) { 460 | res.prev_link = NULL; 461 | return res; 462 | } 463 | 464 | // on success, create new node 465 | node = context->free_head; 466 | node->x = (stbrp_coord) res.x; 467 | node->y = (stbrp_coord) (res.y + height); 468 | 469 | context->free_head = node->next; 470 | 471 | // insert the new node into the right starting point, and 472 | // let 'cur' point to the remaining nodes needing to be 473 | // stiched back in 474 | 475 | cur = *res.prev_link; 476 | if (cur->x < res.x) { 477 | // preserve the existing one, so start testing with the next one 478 | stbrp_node *next = cur->next; 479 | cur->next = node; 480 | cur = next; 481 | } else { 482 | *res.prev_link = node; 483 | } 484 | 485 | // from here, traverse cur and free the nodes, until we get to one 486 | // that shouldn't be freed 487 | while (cur->next && cur->next->x <= res.x + width) { 488 | stbrp_node *next = cur->next; 489 | // move the current node to the free list 490 | cur->next = context->free_head; 491 | context->free_head = cur; 492 | cur = next; 493 | } 494 | 495 | // stitch the list back in 496 | node->next = cur; 497 | 498 | if (cur->x < res.x + width) 499 | cur->x = (stbrp_coord) (res.x + width); 500 | 501 | #ifdef _DEBUG 502 | cur = context->active_head; 503 | while (cur->x < context->width) { 504 | STBRP_ASSERT(cur->x < cur->next->x); 505 | cur = cur->next; 506 | } 507 | STBRP_ASSERT(cur->next == NULL); 508 | 509 | { 510 | int count=0; 511 | cur = context->active_head; 512 | while (cur) { 513 | cur = cur->next; 514 | ++count; 515 | } 516 | cur = context->free_head; 517 | while (cur) { 518 | cur = cur->next; 519 | ++count; 520 | } 521 | STBRP_ASSERT(count == context->num_nodes+2); 522 | } 523 | #endif 524 | 525 | return res; 526 | } 527 | 528 | static int STBRP__CDECL rect_height_compare(const void *a, const void *b) 529 | { 530 | const stbrp_rect *p = (const stbrp_rect *) a; 531 | const stbrp_rect *q = (const stbrp_rect *) b; 532 | if (p->h > q->h) 533 | return -1; 534 | if (p->h < q->h) 535 | return 1; 536 | return (p->w > q->w) ? -1 : (p->w < q->w); 537 | } 538 | 539 | static int STBRP__CDECL rect_original_order(const void *a, const void *b) 540 | { 541 | const stbrp_rect *p = (const stbrp_rect *) a; 542 | const stbrp_rect *q = (const stbrp_rect *) b; 543 | return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); 544 | } 545 | 546 | STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) 547 | { 548 | int i, all_rects_packed = 1; 549 | 550 | // we use the 'was_packed' field internally to allow sorting/unsorting 551 | for (i=0; i < num_rects; ++i) { 552 | rects[i].was_packed = i; 553 | } 554 | 555 | // sort according to heuristic 556 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare); 557 | 558 | for (i=0; i < num_rects; ++i) { 559 | if (rects[i].w == 0 || rects[i].h == 0) { 560 | rects[i].x = rects[i].y = 0; // empty rect needs no space 561 | } else { 562 | stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h); 563 | if (fr.prev_link) { 564 | rects[i].x = (stbrp_coord) fr.x; 565 | rects[i].y = (stbrp_coord) fr.y; 566 | } else { 567 | rects[i].x = rects[i].y = STBRP__MAXVAL; 568 | } 569 | } 570 | } 571 | 572 | // unsort 573 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); 574 | 575 | // set was_packed flags and all_rects_packed status 576 | for (i=0; i < num_rects; ++i) { 577 | rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL); 578 | if (!rects[i].was_packed) 579 | all_rects_packed = 0; 580 | } 581 | 582 | // return the all_rects_packed status 583 | return all_rects_packed; 584 | } 585 | #endif 586 | 587 | /* 588 | ------------------------------------------------------------------------------ 589 | This software is available under 2 licenses -- choose whichever you prefer. 590 | ------------------------------------------------------------------------------ 591 | ALTERNATIVE A - MIT License 592 | Copyright (c) 2017 Sean Barrett 593 | Permission is hereby granted, free of charge, to any person obtaining a copy of 594 | this software and associated documentation files (the "Software"), to deal in 595 | the Software without restriction, including without limitation the rights to 596 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 597 | of the Software, and to permit persons to whom the Software is furnished to do 598 | so, subject to the following conditions: 599 | The above copyright notice and this permission notice shall be included in all 600 | copies or substantial portions of the Software. 601 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 602 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 603 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 604 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 605 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 606 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 607 | SOFTWARE. 608 | ------------------------------------------------------------------------------ 609 | ALTERNATIVE B - Public Domain (www.unlicense.org) 610 | This is free and unencumbered software released into the public domain. 611 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this 612 | software, either in source code form or as a compiled binary, for any purpose, 613 | commercial or non-commercial, and by any means. 614 | In jurisdictions that recognize copyright laws, the author or authors of this 615 | software dedicate any and all copyright interest in the software to the public 616 | domain. We make this dedication for the benefit of the public at large and to 617 | the detriment of our heirs and successors. We intend this dedication to be an 618 | overt act of relinquishment in perpetuity of all present and future rights to 619 | this software under copyright law. 620 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 621 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 622 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 623 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 624 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 625 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 626 | ------------------------------------------------------------------------------ 627 | */ 628 | --------------------------------------------------------------------------------