From 68cb13a0ebb19aec0b8801626509addafe1cbc04 Mon Sep 17 00:00:00 2001 From: gurpreetsinghmatharoo Date: Mon, 11 Nov 2024 18:16:47 +0530 Subject: [PATCH 1/5] docs(general): Remove mention of 'delete' freeing memory in the next step --- .../GML_Overview/Language_Features/delete.htm | 4 ++-- Manual/contents/GameMaker_Language/GML_Overview/Structs.htm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Manual/contents/GameMaker_Language/GML_Overview/Language_Features/delete.htm b/Manual/contents/GameMaker_Language/GML_Overview/Language_Features/delete.htm index a1e78c9d2..482d3ccc7 100644 --- a/Manual/contents/GameMaker_Language/GML_Overview/Language_Features/delete.htm +++ b/Manual/contents/GameMaker_Language/GML_Overview/Language_Features/delete.htm @@ -15,9 +15,9 @@

delete

-

The delete operator is used to de-reference a struct, and has the following syntax:

+

The delete operator is used to de-reference a struct and has the following syntax:

delete <variable>;

-

What this means is that you call the delete operator along with the variable that holds a struct and it will remove the specific reference to the struct stored in the given variable (a reference is simply a value that points to the memory area that is storing the struct and its contents). If this reference was the last reference to the struct in your game, then the garbage collector will remove the struct from memory in a following iteration, typically at the very start of the next step.

+

You call the delete operator along with the variable that holds a struct and it will remove the specific reference to the struct stored in the given variable (a reference is simply a value that points to the memory area that is storing the struct and its contents). If this reference was the last reference to the struct in your game, then the garbage collector will remove the struct from memory in its next iteration.

 delete can only be used along with variables, and not expressions.

By default, structs with no further references in code will be garbage collected automatically in the steps following their use, but it is good practice to use this operator to flag them explicitly for the garbage collector to remove from memory at the very start of the following step, freeing the memory quickly and more efficiently.

The following example shows a struct being created - for example in the Create Event of an instance:

diff --git a/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm b/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm index 985fb3f98..e8b76a65e 100644 --- a/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm +++ b/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm @@ -137,7 +137,7 @@

Accessing Struct Variables

and writing: 

mystruct[$ "x"] = 200;

If you need to use strings to access a struct variable, it is faster to get its hash and use that in read/write to the variable.

-

When a struct is no longer required it can be removed from memory using the delete operator, which flags the struct as being able to be garbage collected. This is not strictly required as the garbage collector will do this automatically if the struct is no longer referenced in your code, but using delete prioritises the referenced struct for garbage collection (for example, call delete in the Clean Up event of an instance to explicitly tell the garbage collector that an instance scope struct is to be deleted as soon as possible). Setting a struct variable to undefined has the same effect.

+

When a struct is no longer required it can be removed from memory using the delete operator, which flags the struct as being able to be garbage collected. This is not strictly required as the garbage collector will do this automatically if the struct is no longer referenced in your code, but using delete prioritises the referenced struct for garbage collection (for example, call delete in the Clean Up event of an instance to explicitly tell the garbage collector that an instance scope struct is to be deleted as soon as possible).

Here is an example:

// Create event
mystruct =
From d2ded502a3ace19cb4347762487567dd89b1c304 Mon Sep 17 00:00:00 2001 From: gurpreetsinghmatharoo Date: Wed, 20 Nov 2024 16:17:07 +0530 Subject: [PATCH 2/5] docs(feature): Mark SVG support as beta only https://github.com/YoYoGames/YoYoStudio/issues/10930 --- .../Sprite_Information/sprite_get_info.htm | 96 +++++++++---------- .../Sprites_And_Tiles/Sprites_And_Tiles.htm | 5 +- .../Sprites_And_Tiles/draw_enable_svg_aa.htm | 1 + .../draw_get_svg_aa_level.htm | 1 + .../draw_get_swf_aa_level.htm | 2 +- .../draw_set_svg_aa_level.htm | 1 + .../Introduction_To_GameMaker_Studio_2.htm | 2 +- .../Introduction/The_Asset_Browser.htm | 4 +- .../IDE_Preferences/General/Paths.htm | 2 +- .../Sprite_Editor_Preferences.htm | 2 +- .../Non-Bitmap_Sprites.htm | 21 +++- Manual/contents/The_Asset_Editors/Sprites.htm | 8 +- .../snippets/Vector_Types_Supported.hts | 14 +++ Manual/toc/Default.toc | 6 +- 14 files changed, 99 insertions(+), 66 deletions(-) create mode 100644 Manual/contents/assets/snippets/Vector_Types_Supported.hts diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Sprites/Sprite_Information/sprite_get_info.htm b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Sprites/Sprite_Information/sprite_get_info.htm index 5ae1ca5c8..f7a0480fd 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Sprites/Sprite_Information/sprite_get_info.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Sprites/Sprite_Information/sprite_get_info.htm @@ -73,7 +73,7 @@

sprite_get_info

0 - Bitmap (Regular sprites)
1 - SWF
2 - Spine
- 3 - SVG + 3 - SVG @@ -230,7 +230,7 @@

sprite_get_info

This section contains information on variables included in the struct for all kinds of sprites.

The messages variable is an array that contains information on the broadcast messages that exist in the given sprite. Each broadcast message in this array is a struct containing the following variables:

- +
@@ -239,19 +239,19 @@

sprite_get_info

- + - +
Variable Name
frameRealReal The timing of this broadcast message from the start of the animation (in frames)
messageStringString The broadcast message string

The frame_info variable is an array that contains information on the timings of the sprite's frames. Each frame in this array is a struct containing the following variables:

 For sprites that do not contain any stretched frames, frame_info will be undefined, meaning no array is provided.

- +
@@ -260,17 +260,17 @@

sprite_get_info

- + - + - + @@ -281,7 +281,7 @@

sprite_get_info

This section contains information on variables included in the struct for Bitmap sprites (sprites that are not Spine or vector type sprites).

The frames variable is an array that contains information on the textures of the sprite's frames. Each frame in this array is a struct containing the following variables:

-
Variable Name
frameRealReal The timing for the start of this frame (in frames)
durationRealReal The duration of this frame (in frames)
image_indexRealReal The image index of this frame
+
@@ -295,57 +295,57 @@

sprite_get_info

- + - + - + - + - + - + - + - + - + - + - + @@ -356,7 +356,7 @@

sprite_get_info

This section contains information on variables included in the struct for Spine sprites.

The bones variable is an array that contains information on all bones in the given Spine sprite. Each bone in this array is a struct containing the following variables:

-
xRealReal The X position of this frame on its texture page (in pixels)
yRealReal The Y position of this frame on its texture page (in pixels)
wRealReal The logical width of the frame (in pixels) used internally
hRealReal The logical height of the frame (in pixels) used internally
textureRealReal The texture page ID for this frame
original_widthRealReal The original width of the frame (in pixels)
original_heightRealReal The original height of the frame (in pixels)
crop_widthRealReal The actual width of the frame on the texture page after cropping and scaling (since GameMaker automatically trims the empty space around an image, and also scales it down if it doesn't fit)
crop_heightRealReal The actual height of the frame on the texture page after cropping and scaling
x_offsetRealReal The X offset from the left edge of the original image to the left edge of the cropped section
y_offsetRealReal The Y offset from the top edge of the original image to the top edge of the cropped section
+
@@ -365,69 +365,69 @@

sprite_get_info

- + - + - + - + - + - + - + - + - + - + - + - +
Variable Name
parentStringString The name of the parent bone, or undefined if this bone doesn't have a parent
nameStringString The name of this bone
indexRealReal The index of this bone
lengthRealReal The length of this bone
xRealReal The X position of this bone
yRealReal The Y position of this bone
rotationRealReal The rotation of this bone
scale_xRealReal (Internal to Spine) Scale value on X
scale_yRealReal (Internal to Spine) Scale value on Y
shear_xRealReal (Internal to Spine) Shear value on X
shear_yRealReal (Internal to Spine) Shear value on Y
transform_modeRealReal (Internal to Spine) The transform mode

 Please consult the Spine documentation for more information regarding Spine's internal variables.

The slots variable is an array that contains information on all slots in the given Spine sprite. Each slot in this array is a struct containing the following variables:

- +
@@ -436,72 +436,72 @@

sprite_get_info

- + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Sprites_And_Tiles/Sprites_And_Tiles.htm b/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Sprites_And_Tiles/Sprites_And_Tiles.htm index a773cd98e..4464ec4ad 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Sprites_And_Tiles/Sprites_And_Tiles.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Sprites_And_Tiles/Sprites_And_Tiles.htm @@ -31,11 +31,14 @@

Sprites And Tiles

  • draw_sprite_tiled_ext
  •  

    -

    If you are using SWF or SVG format sprites, then there are also additional options for controlling the anti-aliasing used when drawing (see Importing Non-Bitmap Sprites for more information on these types of sprites). Note that these functions work on a global level and will set the AA on all vector SWF or SVG sprites drawn after they have been called.

    +

    If you are using  format sprites, then there are also additional options for controlling the anti-aliasing used when drawing (see Importing Non-Bitmap Sprites for more information on these types of sprites). Note that these functions work on a global level and will set the AA on all vector sprites drawn after they have been called.

    +

     

    +
    Variable Name
    nameStringString The name of the slot
    indexRealReal The index of the slot
    boneStringString The name of the slot's bone, or "(none)" if there is no bone for this slot
    attachmentStringString Attachment name
    redRealReal Red component of the slot's colour (0-1)
    greenRealReal Green component of the slot's colour (0-1)
    blueRealReal Blue component of the slot's colour (0-1)
    alphaRealReal Alpha component of the slot's colour (0-1)
    blend_modeRealReal (Internal to Spine) Blend mode for the slot
    dark_red*RealReal Red component of the slot's dark colour (0-1)
    dark_green*RealReal Green component of the slot's dark colour (0-1)
    dark_blue*RealReal Blue component of the slot's dark colour (0-1)
    dark_alpha*StringString Alpha component of the slot's dark colour (0-1)
    attachmentsArray of StringArray of String An array containing the names of all available attachments for this slot.
    - - - - - - - - - - - - -
    ArgumentTypeDescription
    background_element_idBackground Element IDThe unique ID value of the background element to be destroyed
    -

    -

    Returns:

    -

    N/A

    -

    -

    Example:

    -

    var lay_id = layer_get_id("Background_trees"); -
    - var bck_id = layer_background_get_id("Forrest"); -
    - if (layer_background_exists(lay_id, bck_id)) -
    - { -
    - layer_background_destroy(bck_id); -
    - }

    -

    The above code checks the layer "Background_trees" to see if the given background element exists and if it does, then it is destroyed (but not the layer).

    -

    -

    -

    -