Implement animation slice drawing in CanvasItem

* Added a function to ignore subsequent commands if they don't fall within the slice.
* This will be used by the new TileMap to properly provide animated tiles.
This commit is contained in:
reduz 2021-06-17 11:30:20 -03:00
parent 085e1d3c03
commit 94d31ac327
9 changed files with 81 additions and 0 deletions

View file

@ -24,6 +24,21 @@
Overridable function called by the engine (if defined) to draw the canvas item.
</description>
</method>
<method name="draw_animation_slice">
<return type="void">
</return>
<argument index="0" name="animation_length" type="float">
</argument>
<argument index="1" name="slice_begin" type="float">
</argument>
<argument index="2" name="slice_end" type="float">
</argument>
<argument index="3" name="offset" type="float" default="0.0">
</argument>
<description>
Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly.
</description>
</method>
<method name="draw_arc">
<return type="void">
</return>
@ -98,6 +113,13 @@
Draws a colored polygon of any amount of points, convex or concave.
</description>
</method>
<method name="draw_end_animation">
<return type="void">
</return>
<description>
After submitting all animations slices via [method draw_animation_slice], this function can be used to revert drawing to its default state (all subsequent drawing commands will be visible). If you don't care about this particular use case, usage of this function after submitting the slices is not required.
</description>
</method>
<method name="draw_line">
<return type="void">
</return>