├── Destructors.yyp ├── LICENSE ├── README.md ├── objects └── oExample │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── oExample.yy ├── options ├── amazonfire │ └── options_amazonfire.yy ├── android │ └── options_android.yy ├── html5 │ └── options_html5.yy ├── ios │ └── options_ios.yy ├── linux │ └── options_linux.yy ├── mac │ └── options_mac.yy ├── main │ └── options_main.yy ├── operagx │ └── options_operagx.yy ├── ps4 │ └── options_ps4.yy ├── switch │ └── options_switch.yy ├── tvos │ └── options_tvos.yy ├── windows │ └── options_windows.yy ├── windowsuap │ └── options_windowsuap.yy └── xboxone │ └── options_xboxone.yy ├── rooms └── Room1 │ └── Room1.yy └── scripts ├── Destructors ├── Destructors.gml └── Destructors.yy └── oExample_CallbackScript ├── oExample_CallbackScript.gml └── oExample_CallbackScript.yy /Destructors.yyp: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMProject", 3 | "resourceVersion": "1.6", 4 | "name": "Destructors", 5 | "resources": [ 6 | {"id":{"name":"oExample","path":"objects/oExample/oExample.yy",},"order":0,}, 7 | {"id":{"name":"oExample_CallbackScript","path":"scripts/oExample_CallbackScript/oExample_CallbackScript.yy",},"order":1,}, 8 | {"id":{"name":"Destructors","path":"scripts/Destructors/Destructors.yy",},"order":11,}, 9 | {"id":{"name":"Room1","path":"rooms/Room1/Room1.yy",},"order":0,}, 10 | ], 11 | "Options": [ 12 | {"name":"Linux","path":"options/linux/options_linux.yy",}, 13 | {"name":"macOS","path":"options/mac/options_mac.yy",}, 14 | {"name":"Windows","path":"options/windows/options_windows.yy",}, 15 | {"name":"operagx","path":"options/operagx/options_operagx.yy",}, 16 | {"name":"Main","path":"options/main/options_main.yy",}, 17 | ], 18 | "defaultScriptType": 1, 19 | "isEcma": false, 20 | "configs": { 21 | "name": "Default", 22 | "children": [], 23 | }, 24 | "RoomOrderNodes": [ 25 | {"roomId":{"name":"Room1","path":"rooms/Room1/Room1.yy",},}, 26 | ], 27 | "Folders": [ 28 | {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Example","folderPath":"folders/Example.yy","order":14,}, 29 | {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Rooms","folderPath":"folders/Example/Rooms.yy","order":2,}, 30 | ], 31 | "AudioGroups": [ 32 | {"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,}, 33 | ], 34 | "TextureGroups": [ 35 | {"resourceType":"GMTextureGroup","resourceVersion":"1.3","name":"Default","isScaled":true,"compressFormat":"bz2","loadType":"default","directory":"","autocrop":true,"border":2,"mipsToGenerate":0,"groupParent":null,"targets":-1,}, 36 | ], 37 | "IncludedFiles": [], 38 | "MetaData": { 39 | "IDEVersion": "2022.1100.0.227", 40 | }, 41 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Zach Reedy, Juju Adams, Torin Freimiller 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GML2.3 Destructors 2 | 3 | This library adds destructors to GameMaker: Studio 2.3's release. This allows you to use `ds_*` types such as `list`s and `map`s inside of `struct`s without fear of leaking memory when they're deleted. 4 | 5 | ## Getting Started 6 | 7 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. 8 | 9 | ### Installation via Local Package (.yymps) 10 | 11 | GameMaker Studio 2 allows you to import assets, including scripts and shaders, directly into your project via the "Local Package" system. From the [Releases](https://github.com/DatZach/Destructors/releases) tab for this repo, download the .yymp file for the latest version. In the GMS2 IDE, load up your project and click on "Tools" on the main window toolbar. Select "Import Local Package" from the drop-down menu then import all scripts from the Destructors package. 12 | 13 | ### Installation via Copy/Paste 14 | 15 | You can simply copy and paste the contents of [Destructors.gml](https://github.com/DatZach/Destructors/blob/master/scripts/Destructors/Destructors.gml) into a new Script in your project. 16 | 17 | ### Usage 18 | 19 | Destructors are registered via the `dtor_track(type, value, [option])` function. This function can be called multiple times on the same struct instance to registered multiple destructors. 20 | 21 | In order to register a destructor callback, 22 | 23 | *Note that struct members cannot be accessed inside of the callback.* 24 | ```javascript 25 | function foo() constructor { 26 | name = "Zach"; 27 | 28 | dtor_track(DtorType.Function, function () { 29 | show_debug_message("Destructed!"); 30 | }); 31 | } 32 | 33 | var a = new foo(); 34 | delete a; // "Destructed!" 35 | ``` 36 | 37 | In order to register a destructor to clean an allocated `ds_*`, 38 | ```javascript 39 | function test1() constructor { 40 | list = ds_list_create(); 41 | 42 | dtor_track(DtorType.List, list); 43 | } 44 | 45 | var a = new test1(); // foo.list exists 46 | delete a; // foo.list has been destroyed 47 | ``` 48 | 49 | Additionally, `Sprite`, `Surface`, `VertexBuffer`, `VertexFormat`, `Path`, `AnimCurve` and `Instance` types can be destroyed via `dtor_track`. 50 | 51 | ## Running the Example 52 | 53 | Clone this repo and open and run the project in GameMaker: Studio. Follow the on screen instructions for a demonstration of the library. 54 | 55 | ## Authors 56 | 57 | * **Zach Reedy** - *Developed first implementation. Finalized codebase.* - [DatZach](https://github.com/DatZach) 58 | * **Juju Adams** - *Second draft implementation. Examples.* - [JujuAdams](https://github.com/JujuAdams) 59 | * **Torin Freimiller** - *Initial discoveries related to tracking objects.* - [Nommiin](https://github.com/nommiin) 60 | 61 | ## License 62 | 63 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details 64 | -------------------------------------------------------------------------------- /objects/oExample/Create_0.gml: -------------------------------------------------------------------------------- 1 | function test1() constructor { 2 | static start = function() { 3 | list = ds_list_create(); 4 | global.listReference = list; 5 | dtor(DtorType.List, list); 6 | } 7 | start(); 8 | } 9 | 10 | function test2() constructor { 11 | name = "Jing"; 12 | 13 | function callback(_parameter) { 14 | show_message("This callback cannot reference variables defined inside the constructor, but we can take parameters defined when registering the callback:\n\n\""+ string(_parameter) + "\""); 15 | 16 | try { 17 | show_message(name); 18 | } 19 | catch(_error) { 20 | show_message("Here's what happens when you try to read a variable from a GC'd struct in this callback:\n\n\n" + string(_error)); 21 | } 22 | } 23 | 24 | dtor(DtorType.Function, callback, "This is a parameter passed into the function."); 25 | } 26 | 27 | function test3() constructor { 28 | dtor(DtorType.Script, oExample_CallbackScript, "This is a parameter passed into the script."); 29 | } 30 | 31 | a = new test1(); 32 | b = new test2(); 33 | c = new test3(); -------------------------------------------------------------------------------- /objects/oExample/Draw_64.gml: -------------------------------------------------------------------------------- 1 | var _string = @" 2 | GMS 2.3.1 Destructors - Zach Reedy / Juju Adams / Nommiin 3 | 4 | Press 1 to destroy struct --> Garbage collects a list 5 | Press 2 to destroy struct --> Executes a callback function 6 | Press 3 to destroy struct --> Executes a callback script 7 | 8 | " + (ds_exists(global.listReference, ds_type_list)? "List created by exists" : "List created by doesn't exist"); 9 | 10 | draw_text(10, 10, _string); 11 | var _t = DtorManager() 12 | draw_text(10, 200, "Manager Size: " + string( _t.size) ); 13 | draw_text(10, 220, "Manager Index: " + string(_t.index) ); 14 | var _state = time_source_get_state(_t.step); 15 | switch(_state) { 16 | case time_source_state_active: draw_text(10, 240, "Manager TimeSource State: Active"); break; 17 | case time_source_state_stopped: draw_text(10, 240, "Manager TimeSource State: Stopped"); break; 18 | } 19 | -------------------------------------------------------------------------------- /objects/oExample/Step_0.gml: -------------------------------------------------------------------------------- 1 | // NOTE This is the only line that is required for GC Dtors to work. 2 | // Should be placed inside of a persistent game controller object 3 | if (keyboard_check_pressed(ord("1"))) { 4 | show_debug_message("Deleting "); 5 | delete a; 6 | } 7 | 8 | if (keyboard_check_pressed(ord("2"))) { 9 | show_debug_message("Deleting "); 10 | delete b; 11 | } 12 | 13 | if (keyboard_check_pressed(ord("3"))) { 14 | show_debug_message("Deleting "); 15 | delete c; 16 | } 17 | 18 | if (keyboard_check_pressed(ord("4"))) { 19 | a = new test1(); 20 | } -------------------------------------------------------------------------------- /objects/oExample/oExample.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "oExample", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": true, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 28 | ], 29 | "properties": [], 30 | "overriddenProperties": [], 31 | "parent": { 32 | "name": "Example", 33 | "path": "folders/Example.yy", 34 | }, 35 | } -------------------------------------------------------------------------------- /options/amazonfire/options_amazonfire.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_amazonfire_sync_android": false, 3 | "option_amazonfire_display_name": "Created with GameMaker Studio 2", 4 | "option_amazonfire_version": "1.0.0.0", 5 | "option_amazonfire_tools_from_version": false, 6 | "option_amazonfire_build_tools": "", 7 | "option_amazonfire_support_lib": "", 8 | "option_amazonfire_target_sdk": "", 9 | "option_amazonfire_minimum_sdk": "", 10 | "option_amazonfire_compile_sdk": "", 11 | "option_amazonfire_package_domain": "com", 12 | "option_amazonfire_package_company": "company", 13 | "option_amazonfire_package_product": "game", 14 | "option_amazonfire_orient_portrait": true, 15 | "option_amazonfire_orient_portrait_flipped": true, 16 | "option_amazonfire_orient_landscape": true, 17 | "option_amazonfire_orient_landscape_flipped": true, 18 | "option_amazonfire_gamepad_support": true, 19 | "option_amazonfire_lint": false, 20 | "option_amazonfire_install_location": 0, 21 | "option_amazonfire_sleep_margin": 4, 22 | "option_amazonfire_splash_screens_landscape": "${base_options_dir}\\amazonfire\\splash\\landscape.png", 23 | "option_amazonfire_splash_screens_portrait": "${base_options_dir}\\amazonfire\\splash\\portrait.png", 24 | "option_amazonfire_splash_time": 0, 25 | "option_amazonfire_launchscreen_fill": 0, 26 | "option_amazonfire_splashscreen_background_colour": 255, 27 | "option_amazonfire_tv_banner": "${base_options_dir}\\amazonfire\\tv_banner.png", 28 | "option_amazonfire_interpolate_pixels": false, 29 | "option_amazonfire_screen_depth": 0, 30 | "option_amazonfire_scale": 0, 31 | "option_amazonfire_texture_page": "2048x2048", 32 | "option_amazonfire_icon_ldpi": "${base_options_dir}\\android\\icons\\ldpi.png", 33 | "option_amazonfire_icon_mdpi": "${base_options_dir}\\android\\icons\\mdpi.png", 34 | "option_amazonfire_icon_hdpi": "${base_options_dir}\\android\\icons\\hdpi.png", 35 | "option_amazonfire_icon_xhdpi": "${base_options_dir}\\android\\icons\\xhdpi.png", 36 | "option_amazonfire_icon_xxhdpi": "${base_options_dir}\\android\\icons\\xxhdpi.png", 37 | "option_amazonfire_icon_xxxhdpi": "${base_options_dir}\\android\\icons\\xxxhdpi.png", 38 | "option_amazonfire_permission_write_external_storage": false, 39 | "option_amazonfire_permission_read_phone_state": false, 40 | "option_amazonfire_permission_network_state": false, 41 | "option_amazonfire_permission_internet": true, 42 | "option_amazonfire_permission_bluetooth": true, 43 | "option_amazonfire_permission_record_audio": false, 44 | "option_amazonfire_application_tag_inject": "", 45 | "resourceVersion": "1.0", 46 | "name": "Amazon Fire", 47 | "tags": [], 48 | "resourceType": "GMAmazonFireOptions", 49 | } -------------------------------------------------------------------------------- /options/android/options_android.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_android_sync_amazon": false, 3 | "option_android_display_name": "Created with GameMaker Studio 2", 4 | "option_android_version": "1.0.0.0", 5 | "option_android_tools_from_version": false, 6 | "option_android_build_tools": "", 7 | "option_android_support_lib": "", 8 | "option_android_target_sdk": "", 9 | "option_android_minimum_sdk": "", 10 | "option_android_compile_sdk": "", 11 | "option_android_package_domain": "com", 12 | "option_android_package_company": "company", 13 | "option_android_package_product": "game", 14 | "option_android_arch_armv7": true, 15 | "option_android_arch_x86": false, 16 | "option_android_arch_arm64": false, 17 | "option_android_arch_x86_64": false, 18 | "option_android_orient_portrait": true, 19 | "option_android_orient_portrait_flipped": true, 20 | "option_android_orient_landscape": true, 21 | "option_android_orient_landscape_flipped": true, 22 | "option_android_gamepad_support": true, 23 | "option_android_lint": false, 24 | "option_android_install_location": 0, 25 | "option_android_sleep_margin": 4, 26 | "option_android_splash_screens_landscape": "${base_options_dir}\\android\\splash\\landscape.png", 27 | "option_android_splash_screens_portrait": "${base_options_dir}\\android\\splash\\portrait.png", 28 | "option_android_splash_time": 0, 29 | "option_android_launchscreen_fill": 0, 30 | "option_android_splashscreen_background_colour": 255, 31 | "option_android_tv_banner": "${base_options_dir}\\android\\tv_banner.png", 32 | "option_android_interpolate_pixels": false, 33 | "option_android_screen_depth": 0, 34 | "option_android_device_support": 0, 35 | "option_android_scale": 0, 36 | "option_android_texture_page": "2048x2048", 37 | "option_android_icon_ldpi": "${base_options_dir}\\android\\icons\\ldpi.png", 38 | "option_android_icon_mdpi": "${base_options_dir}\\android\\icons\\mdpi.png", 39 | "option_android_icon_hdpi": "${base_options_dir}\\android\\icons\\hdpi.png", 40 | "option_android_icon_xhdpi": "${base_options_dir}\\android\\icons\\xhdpi.png", 41 | "option_android_icon_xxhdpi": "${base_options_dir}\\android\\icons\\xxhdpi.png", 42 | "option_android_icon_xxxhdpi": "${base_options_dir}\\android\\icons\\xxxhdpi.png", 43 | "option_android_icon_adaptive_generate": false, 44 | "option_android_icon_adaptive_ldpi": "${base_options_dir}\\android\\icons_adaptive\\ldpi.png", 45 | "option_android_icon_adaptive_mdpi": "${base_options_dir}\\android\\icons_adaptive\\mdpi.png", 46 | "option_android_icon_adaptive_hdpi": "${base_options_dir}\\android\\icons_adaptive\\hdpi.png", 47 | "option_android_icon_adaptive_xhdpi": "${base_options_dir}\\android\\icons_adaptive\\xhdpi.png", 48 | "option_android_icon_adaptive_xxhdpi": "${base_options_dir}\\android\\icons_adaptive\\xxhdpi.png", 49 | "option_android_icon_adaptive_xxxhdpi": "${base_options_dir}\\android\\icons_adaptive\\xxxhdpi.png", 50 | "option_android_icon_adaptivebg_ldpi": "${base_options_dir}\\android\\icons_adaptivebg\\ldpi.png", 51 | "option_android_icon_adaptivebg_mdpi": "${base_options_dir}\\android\\icons_adaptivebg\\mdpi.png", 52 | "option_android_icon_adaptivebg_hdpi": "${base_options_dir}\\android\\icons_adaptivebg\\hdpi.png", 53 | "option_android_icon_adaptivebg_xhdpi": "${base_options_dir}\\android\\icons_adaptivebg\\xhdpi.png", 54 | "option_android_icon_adaptivebg_xxhdpi": "${base_options_dir}\\android\\icons_adaptivebg\\xxhdpi.png", 55 | "option_android_icon_adaptivebg_xxxhdpi": "${base_options_dir}\\android\\icons_adaptivebg\\xxxhdpi.png", 56 | "option_android_use_facebook": false, 57 | "option_android_facebook_id": "", 58 | "option_android_facebook_app_display_name": "", 59 | "option_android_google_cloud_saving": false, 60 | "option_android_google_services_app_id": "", 61 | "option_android_permission_write_external_storage": false, 62 | "option_android_permission_read_phone_state": false, 63 | "option_android_permission_network_state": false, 64 | "option_android_permission_internet": true, 65 | "option_android_permission_bluetooth": true, 66 | "option_android_permission_record_audio": false, 67 | "option_android_application_tag_inject": "", 68 | "option_android_google_apk_expansion": false, 69 | "option_android_google_licensing_public_key": "", 70 | "option_android_tv_isgame": true, 71 | "resourceVersion": "1.0", 72 | "name": "Android", 73 | "tags": [], 74 | "resourceType": "GMAndroidOptions", 75 | } -------------------------------------------------------------------------------- /options/html5/options_html5.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_html5_browser_title": "Created with GameMaker Studio 2", 3 | "option_html5_version": "1.0.0.0", 4 | "option_html5_foldername": "html5game", 5 | "option_html5_outputname": "index.html", 6 | "option_html5_splash_png": "${base_options_dir}\\html5\\splash.png", 7 | "option_html5_usesplash": false, 8 | "option_html5_outputdebugtoconsole": false, 9 | "option_html5_display_cursor": true, 10 | "option_html5_localrunalert": true, 11 | "option_html5_index": "", 12 | "option_html5_loadingbar": "", 13 | "option_html5_jsprepend": "", 14 | "option_html5_icon": "${base_options_dir}\\html5\\fav.ico", 15 | "option_html5_allow_fullscreen": true, 16 | "option_html5_interpolate_pixels": true, 17 | "option_html5_centregame": false, 18 | "option_html5_usebuiltinparticles": true, 19 | "option_html5_usebuiltinfont": true, 20 | "option_html5_webgl": 2, 21 | "option_html5_scale": 0, 22 | "option_html5_texture_page": "2048x2048", 23 | "option_html5_use_facebook": false, 24 | "option_html5_facebook_id": "", 25 | "option_html5_facebook_app_display_name": "", 26 | "option_html5_flurry_enable": false, 27 | "option_html5_flurry_id": "", 28 | "option_html5_google_analytics_enable": false, 29 | "option_html5_google_tracking_id": "", 30 | "resourceVersion": "1.0", 31 | "name": "HTML5", 32 | "tags": [], 33 | "resourceType": "GMHtml5Options", 34 | } -------------------------------------------------------------------------------- /options/ios/options_ios.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_ios_display_name": "Created with GameMaker Studio 2", 3 | "option_ios_bundle_name": "com.company.game", 4 | "option_ios_version": "1.0.0.0", 5 | "option_ios_output_dir": "~/gamemakerstudio2", 6 | "option_ios_team_id": "", 7 | "option_ios_orientation_portrait": true, 8 | "option_ios_orientation_portrait_flipped": true, 9 | "option_ios_orientation_landscape": true, 10 | "option_ios_orientation_landscape_flipped": true, 11 | "option_ios_devices": 2, 12 | "option_ios_defer_home_indicator": false, 13 | "option_ios_icon_iphone_app_120": "${base_options_dir}/ios/icons/app/iphone_120.png", 14 | "option_ios_icon_iphone_app_180": "${base_options_dir}/ios/icons/app/iphone_180.png", 15 | "option_ios_icon_ipad_app_76": "${base_options_dir}/ios/icons/app/ipad_76.png", 16 | "option_ios_icon_ipad_app_152": "${base_options_dir}/ios/icons/app/ipad_152.png", 17 | "option_ios_icon_ipad_pro_app_167": "${base_options_dir}/ios/icons/app/ipad_pro_167.png", 18 | "option_ios_icon_iphone_notification_40": "${base_options_dir}/ios/icons/notification/iphone_40.png", 19 | "option_ios_icon_iphone_notification_60": "${base_options_dir}/ios/icons/notification/iphone_60.png", 20 | "option_ios_icon_ipad_notification_20": "${base_options_dir}/ios/icons/notification/ipad_20.png", 21 | "option_ios_icon_ipad_notification_40": "${base_options_dir}/ios/icons/notification/ipad_40.png", 22 | "option_ios_icon_iphone_spotlight_80": "${base_options_dir}/ios/icons/spotlight/iphone_80.png", 23 | "option_ios_icon_iphone_spotlight_120": "${base_options_dir}/ios/icons/spotlight/iphone_120.png", 24 | "option_ios_icon_ipad_spotlight_40": "${base_options_dir}/ios/icons/spotlight/ipad_40.png", 25 | "option_ios_icon_ipad_spotlight_80": "${base_options_dir}/ios/icons/spotlight/ipad_80.png", 26 | "option_ios_icon_iphone_settings_58": "${base_options_dir}/ios/icons/settings/iphone_58.png", 27 | "option_ios_icon_iphone_settings_87": "${base_options_dir}/ios/icons/settings/iphone_87.png", 28 | "option_ios_icon_ipad_settings_29": "${base_options_dir}/ios/icons/settings/ipad_29.png", 29 | "option_ios_icon_ipad_settings_58": "${base_options_dir}/ios/icons/settings/ipad_58.png", 30 | "option_ios_icon_itunes_artwork_1024": "${base_options_dir}/ios/icons/itunes/itunes_1024.png", 31 | "option_ios_splashscreen_background_colour": 255, 32 | "option_ios_launchscreen_image": "${base_options_dir}/ios/splash/launchscreen.png", 33 | "option_ios_launchscreen_image_landscape": "${base_options_dir}/ios/splash/launchscreen-landscape.png", 34 | "option_ios_launchscreen_fill": 0, 35 | "option_ios_interpolate_pixels": false, 36 | "option_ios_half_ipad1_textures": false, 37 | "option_ios_scale": 0, 38 | "option_ios_texture_page": "2048x2048", 39 | "option_ios_use_facebook": false, 40 | "option_ios_facebook_id": "", 41 | "option_ios_facebook_app_display_name": "", 42 | "option_ios_push_notifications": false, 43 | "option_ios_apple_sign_in": false, 44 | "option_ios_podfile_path": "${options_dir}/ios/Podfile", 45 | "option_ios_podfile_lock_path": "${options_dir}/ios/Podfile.lock", 46 | "resourceVersion": "1.3", 47 | "name": "iOS", 48 | "tags": [], 49 | "resourceType": "GMiOSOptions", 50 | } -------------------------------------------------------------------------------- /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": false, 21 | "resourceVersion": "1.0", 22 | "name": "Linux", 23 | "tags": [], 24 | "resourceType": "GMLinuxOptions", 25 | } -------------------------------------------------------------------------------- /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_menu_dock": false, 12 | "option_mac_display_cursor": true, 13 | "option_mac_start_fullscreen": false, 14 | "option_mac_allow_fullscreen": false, 15 | "option_mac_interpolate_pixels": true, 16 | "option_mac_vsync": false, 17 | "option_mac_resize_window": false, 18 | "option_mac_enable_retina": false, 19 | "option_mac_scale": 0, 20 | "option_mac_texture_page": "2048x2048", 21 | "option_mac_build_app_store": false, 22 | "option_mac_allow_incoming_network": false, 23 | "option_mac_allow_outgoing_network": false, 24 | "option_mac_app_category": "Games", 25 | "option_mac_enable_steam": false, 26 | "option_mac_disable_sandbox": false, 27 | "option_mac_apple_sign_in": false, 28 | "resourceVersion": "1.0", 29 | "name": "macOS", 30 | "tags": [], 31 | "resourceType": "GMMacOptions", 32 | } -------------------------------------------------------------------------------- /options/main/options_main.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_gameguid": "7379e6a8-90d4-4cad-a374-a0b43d4b69d1", 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 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /options/ps4/options_ps4.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_ps4_package_id": "IV0002-NPXS29129_00-APP0990000000022", 3 | "option_ps4_passcode": "GvE6xCpZxd96scOUGuLPbuLp8O800B0s", 4 | "option_ps4_nptitleid": "", 5 | "option_ps4_nptitlesecret": "", 6 | "option_ps4_paramsfo": "", 7 | "option_ps4_nptitledat": "", 8 | "option_ps4_trophyedit": "", 9 | "option_ps4_shareparam": "", 10 | "option_ps4_pronunciation": "", 11 | "option_ps4_splash_screen": "${base_options_dir}\\ps4\\sce_sys\\pic1.png", 12 | "option_ps4_save_data_icon": "${base_options_dir}\\ps4\\sce_sys\\save_data.png", 13 | "option_ps4_trophy_screen": "${base_options_dir}\\ps4\\sce_sys\\pic0.png", 14 | "option_ps4_interpolate_pixels": true, 15 | "option_ps4_display_cursor": false, 16 | "option_ps4_scale": 0, 17 | "option_ps4_texture_page": "2048x2048", 18 | "option_ps4_max_display_width": -1, 19 | "option_ps4_max_display_height": -1, 20 | "option_ps4_icon": "${base_options_dir}\\ps4\\sce_sys\\icon0.png", 21 | "option_ps4_shareoverlay_image": "${base_options_dir}\\ps4\\sce_sys\\shareoverlayimage.png", 22 | "option_ps4_nptitledat_file": "${options_dir}\\ps4\\sce_sys\\nptitle.dat", 23 | "option_ps4_paramsfo_file": "${options_dir}\\ps4\\sce_sys\\param.sfo", 24 | "option_ps4_trophy00trp_file": "${options_dir}\\ps4\\sce_sys\\trophy\\trophy00.trp", 25 | "option_ps4_shareparam_file": "${options_dir}\\ps4\\sce_sys\\shareparam.json", 26 | "option_ps4_pronunciation_file": "${options_dir}\\ps4\\sce_sys\\pronunciation.xml", 27 | "option_ps4_pronunciation_sig": "${options_dir}\\ps4\\sce_sys\\pronunciation.sig", 28 | "option_ps4_onion": 2048, 29 | "option_ps4_garlic": 1024, 30 | "option_ps4_neo_onion": 2048, 31 | "option_ps4_neo_garlic": 1536, 32 | "resourceVersion": "1.0", 33 | "name": "PlayStation 4", 34 | "tags": [], 35 | "resourceType": "GMPS4Options", 36 | } -------------------------------------------------------------------------------- /options/switch/options_switch.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_switch_project_nmeta": "${options_dir}/switch/application.nmeta", 3 | "option_switch_enable_nex_libraries": false, 4 | "option_switch_interpolate_pixels": true, 5 | "option_switch_scale": 0, 6 | "option_switch_texture_page": "2048x2048", 7 | "option_switch_check_nsp_publish_errors": true, 8 | "option_switch_enable_fileaccess_checking": true, 9 | "option_switch_splash_screen": "${base_options_dir}\\switch\\splash.png", 10 | "option_switch_use_splash": false, 11 | "resourceVersion": "1.0", 12 | "name": "Switch", 13 | "tags": [], 14 | "resourceType": "GMSwitchOptions", 15 | } -------------------------------------------------------------------------------- /options/tvos/options_tvos.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_tvos_display_name": "Made in GameMaker Studio 2", 3 | "option_tvos_bundle_name": "com.company.game", 4 | "option_tvos_version": "1.0.0.0", 5 | "option_tvos_output_dir": "~/GameMakerStudio2/tvOS", 6 | "option_tvos_team_id": "", 7 | "option_tvos_icon_400": "${base_options_dir}/tvos/icons/400.png", 8 | "option_tvos_icon_400_2x": "${base_options_dir}/tvos/icons/400_2x.png", 9 | "option_tvos_icon_1280": "${base_options_dir}/tvos/icons/1280.png", 10 | "option_tvos_topshelf": "${base_options_dir}/tvos/topshelf/topshelf.png", 11 | "option_tvos_topshelf_2x": "${base_options_dir}/tvos/topshelf/topshelf_2x.png", 12 | "option_tvos_topshelf_wide": "${base_options_dir}/tvos/topshelf/topshelf_wide.png", 13 | "option_tvos_topshelf_wide_2x": "${base_options_dir}/tvos/topshelf/topshelf_wide_2x.png", 14 | "option_tvos_splashscreen": "${base_options_dir}/tvos/splash/splash.png", 15 | "option_tvos_splashscreen_2x": "${base_options_dir}/tvos/splash/splash_2x.png", 16 | "option_tvos_splash_time": 0, 17 | "option_tvos_interpolate_pixels": true, 18 | "option_tvos_scale": 0, 19 | "option_tvos_texture_page": "2048x2048", 20 | "option_tvos_display_cursor": false, 21 | "option_tvos_push_notifications": false, 22 | "option_tvos_apple_sign_in": false, 23 | "option_tvos_podfile_path": "${options_dir}\\tvos\\Podfile", 24 | "option_tvos_podfile_lock_path": "${options_dir}\\tvos\\Podfile.lock", 25 | "resourceVersion": "1.3", 26 | "name": "tvOS", 27 | "tags": [], 28 | "resourceType": "GMtvOSOptions", 29 | } -------------------------------------------------------------------------------- /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": 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": false, 32 | "resourceVersion": "1.1", 33 | "name": "Windows", 34 | "tags": [], 35 | "resourceType": "GMWindowsOptions", 36 | } -------------------------------------------------------------------------------- /options/windowsuap/options_windowsuap.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_windowsuap_display_name": "Created with GameMaker Studio 2", 3 | "option_windowsuap_package_name": "YourPackageName", 4 | "option_windowsuap_publisher_display_name": "YourPublisherName", 5 | "option_windowsuap_package_display_name": "YourPackageDisplayName", 6 | "option_windowsuap_description": "Your Description", 7 | "option_windowsuap_version": "1.0.0.0", 8 | "option_windowsuap_orient_portrait": true, 9 | "option_windowsuap_orient_portrait_flipped": true, 10 | "option_windowsuap_orient_landscape": true, 11 | "option_windowsuap_orient_landscape_flipped": true, 12 | "option_windowsuap_small_logo": "${base_options_dir}\\windowsuap\\logos\\SmallLogo.scale-100.png", 13 | "option_windowsuap_smallish_logo": "${base_options_dir}\\windowsuap\\logos\\SmallishLogo.scale-100.png", 14 | "option_windowsuap_store_logo": "${base_options_dir}\\windowsuap\\logos\\StoreLogo.scale-100.png", 15 | "option_windowsuap_logo": "${base_options_dir}\\windowsuap\\logos\\Logo.scale-100.png", 16 | "option_windowsuap_logo_background_colour": 4278190080, 17 | "option_windowsuap_logo_foreground_text": 0, 18 | "option_windowsuap_wide_logo": "${base_options_dir}\\windowsuap\\logos\\WideLogo.scale-100.png", 19 | "option_windowsuap_large_logo": "${base_options_dir}\\windowsuap\\logos\\LargeLogo.scale-100.png", 20 | "option_windowsuap_splash_png": "${base_options_dir}\\windowsuap\\splash\\SplashScreen.scale-100.png", 21 | "option_windowsuap_splash_background_colour": 4278190080, 22 | "option_windowsuap_interpolate_pixels": false, 23 | "option_windowsuap_display_cursor": true, 24 | "option_windowsuap_start_fullscreen": false, 25 | "option_windowsuap_allow_fullscreen_switching": false, 26 | "option_windowsuap_use_synchronization": true, 27 | "option_windowsuap_scale": 0, 28 | "option_windowsuap_texture_page": "2048x2048", 29 | "option_windowsuap_certificate_location": "${base_options_dir}\\windowsuap\\keys\\WinUWPRunner_TemporaryKey.pfx", 30 | "option_windowsuap_certificate_publishername": "CN=Sandbox", 31 | "option_windowsuap_native_cpu": 0, 32 | "option_windowsuap_internet_capable": false, 33 | "option_windowsuap_microphone_capable": false, 34 | "option_windowsuap_iap_sandbox": false, 35 | "option_windowsuap_target_platform_version": "10.0.14393.0", 36 | "option_windowsuap_target_platform_min_version": "10.0.14393.0", 37 | "option_windowsuap_xbox_live": false, 38 | "option_windowsuap_xbox_live_creators_program": false, 39 | "option_windowsuap_xbox_live_title_id": 0, 40 | "option_windowsuap_xbox_live_scid": "00000000-0000-0000-0000-000000000000", 41 | "resourceVersion": "1.0", 42 | "name": "Windows UWP", 43 | "tags": [], 44 | "resourceType": "GMWindowsUAPOptions", 45 | } -------------------------------------------------------------------------------- /options/xboxone/options_xboxone.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_xbone_display_name": "Created with GameMaker Studio 2", 3 | "option_xbone_description": "Your Description", 4 | "option_xbone_publisher": "Company Name", 5 | "option_xbone_publisher_display_name": "Company Display Name", 6 | "option_xbone_version": "1.0.0.0", 7 | "option_xbone_product_id": "", 8 | "option_xbone_title_id": "01234567", 9 | "option_xbone_service_config_id": "00000000-0000-0000-0000-000000000000", 10 | "option_xbone_program_id": "A149997C-9864-464E-9E03-8E06832F4CFF", 11 | "option_xbone_require_xbox_live": false, 12 | "option_xbone_require_game_chat": false, 13 | "option_xbone_game_chat_slots": 4, 14 | "option_xbone_require_audio_recording": false, 15 | "option_xbone_x_title_memory": 5, 16 | "option_xbone_stats_system": 0, 17 | "option_xbone_service_config_manifest": "", 18 | "option_xbone_network_config_manifest": "", 19 | "option_xbone_splash_screen": "${base_options_dir}\\xboxone\\SplashScreen.png", 20 | "option_xbone_splash_screen_colour": 4282795590, 21 | "option_xbone_logo_store": "${base_options_dir}\\xboxone\\logos\\StoreLogo.png", 22 | "option_xbone_logo_small": "${base_options_dir}\\xboxone\\logos\\SmallLogo.png", 23 | "option_xbone_logo_large": "${base_options_dir}\\xboxone\\logos\\Logo.png", 24 | "option_xbone_logo_wide": "${base_options_dir}\\xboxone\\logos\\WideLogo.png", 25 | "option_xbone_logo_background_colour": 4282795590, 26 | "option_xbone_foreground_text": 0, 27 | "option_xbone_interpolate_pixels": false, 28 | "option_xbone_scale": 0, 29 | "option_xbone_texture_page": "2048x2048", 30 | "option_xbone_support_4k_one_x": false, 31 | "option_xbone_support_4k_one_s": false, 32 | "option_xbone_ratings": "\n \n \n \n ", 33 | "option_xbone_languages": "\n \n \n \n ", 34 | "resourceVersion": "1.0", 35 | "name": "Xbox One", 36 | "tags": [], 37 | "resourceType": "GMXBoxOneOptions", 38 | } -------------------------------------------------------------------------------- /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":"oExample","path":"objects/oExample/oExample.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_14A3B0EB","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_14A3B0EB","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": "Rooms", 50 | "path": "folders/Example/Rooms.yy", 51 | }, 52 | "resourceVersion": "1.0", 53 | "name": "Room1", 54 | "tags": [], 55 | "resourceType": "GMRoom", 56 | } -------------------------------------------------------------------------------- /scripts/Destructors/Destructors.gml: -------------------------------------------------------------------------------- 1 | /// GMS 2.3.0 Destructors 2 | /// @author Zach Reedy 3 | /// @author Juju Adams 4 | /// @author Torin Freimiller 5 | // Feather ignore all 6 | #macro DTOR_DEBUG false 7 | #macro DTOR_TIME 5 8 | 9 | enum DtorType { 10 | Function, 11 | Script, 12 | 13 | List, 14 | Map, 15 | Grid, 16 | Priority, 17 | Queue, 18 | Stack, 19 | Buffer, 20 | 21 | Sprite, 22 | Surface, 23 | VertexBuffer, 24 | VertexFormat, 25 | 26 | Path, 27 | AnimCurve, 28 | Instance 29 | } 30 | 31 | /// @ignore 32 | function DtorManager() { 33 | static ins = { 34 | step: undefined, 35 | list: ds_list_create(), 36 | size: 0, 37 | index: 0, 38 | add: function(_ins) { 39 | ds_list_add(list, _ins); 40 | size++; 41 | } 42 | } 43 | return ins; 44 | } 45 | 46 | /// @ignore 47 | /// @param {enum.DtorType} type 48 | /// @param {Any} value 49 | /// @param {Any} [options] 50 | /// @param {Any} [reference] 51 | function DtorInstance(_type, _value, _option, _ref) constructor { 52 | reference = weak_ref_create(_ref); 53 | type = _type; 54 | value = _value; 55 | option = _option; 56 | } 57 | 58 | 59 | /// @param {enum.DtorType} type 60 | /// @param {Any} value 61 | /// @param {Any} [options] 62 | /// @param {Any} [reference] 63 | function dtor(_type, _value, _option, _ref=self) { 64 | static add = DtorManager().add; 65 | static time = DtorManager().step; 66 | var _instance = new DtorInstance(_type, _value, _option, _ref); 67 | 68 | // Add to the manager 69 | add(_instance); 70 | // Re-start timesource 71 | if (time_source_get_state(time) == time_source_state_stopped) {time_source_start(time); } 72 | } 73 | 74 | 75 | // Startup 76 | with (DtorManager() ) { 77 | step = time_source_create(time_source_global, DTOR_TIME, time_source_units_frames, function() { 78 | // Feather disable once GM2017 79 | static clip = function(_data, _min, _max) 80 | { 81 | if (_data > _max) {return (_min); } else 82 | if (_data < _min) {return (_max); } 83 | return (_data ); 84 | } 85 | if (size > 0) { 86 | var _inst = list[| index]; 87 | // Still alive 88 | if (!weak_ref_alive(_inst.reference) ) { 89 | switch(_inst.type) { 90 | case DtorType.Function: _inst.value(_inst.option); break; 91 | case DtorType.Script: script_execute(_inst.value, _inst.option); break; 92 | 93 | case DtorType.List: ds_list_destroy(_inst.value); break; 94 | case DtorType.Map: ds_map_destroy(_inst.value); break; 95 | case DtorType.Grid: ds_grid_destroy(_inst.value); break; 96 | case DtorType.Priority: ds_priority_destroy(_inst.value); break; 97 | case DtorType.Queue: ds_queue_destroy(_inst.value); break; 98 | case DtorType.Stack: ds_stack_destroy(_inst.value); break; 99 | case DtorType.Buffer: buffer_delete(_inst.value); break; 100 | 101 | case DtorType.Sprite: sprite_delete(_inst.value); break; 102 | case DtorType.Surface: surface_free(_inst.value); break; 103 | case DtorType.VertexBuffer: vertex_delete_buffer(_inst.value); break; 104 | case DtorType.VertexFormat: vertex_format_delete(_inst.value); break; 105 | 106 | case DtorType.Path: path_delete(_inst.value); break; 107 | case DtorType.AnimCurve: animcurve_destroy(_inst.value); break; 108 | case DtorType.Instance: instance_destroy(_inst.value); break; 109 | } 110 | 111 | ds_list_delete(list, index); 112 | size = size - 1; // Update list size 113 | if (size <= 0) time_source_stop(step); 114 | if (DTOR_DEBUG) show_debug_message("Dtor Deleted " + string(index) ); 115 | index = index - 1; 116 | if (index < 0) index = 0; 117 | // 118 | } 119 | else { 120 | index = index + 1; 121 | if (index >= size) index = 0; 122 | } 123 | } 124 | }, [], -1); 125 | time_source_start(step); 126 | } -------------------------------------------------------------------------------- /scripts/Destructors/Destructors.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "Destructors", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Destructors", 9 | "path": "Destructors.yyp", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/oExample_CallbackScript/oExample_CallbackScript.gml: -------------------------------------------------------------------------------- 1 | function oExample_CallbackScript(_parameter) 2 | { 3 | show_message("This is a callback script."); 4 | 5 | if (_parameter != undefined) 6 | { 7 | show_message(_parameter); 8 | } 9 | else 10 | { 11 | show_message("It appears script_execute() is bugged atm"); 12 | } 13 | } -------------------------------------------------------------------------------- /scripts/oExample_CallbackScript/oExample_CallbackScript.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Example", 6 | "path": "folders/Example.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "oExample_CallbackScript", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } --------------------------------------------------------------------------------