Skip to content

Shapes

Extends: Plexigon2D < Node2D

Description

Shapes subclass that makes it easier to use the Plexigon2D class.

Methods

Dictionary Save ( bool copy = false )
void Load ( Dictionary data )
void Resize ( int x, int y, int w, int h )
void DrawRect ( Rect2 rect, bool invertAction )
void DrawCircle ( Rect2 rect, int sides, bool invertAction )
void DrawPolygon ( Vector2[] points, bool invertAction )
void AddPolygon ( Vector2[] points, Rect2 bounds, bool invertAction )
void FinalizeOutlines ( )
void ClipPolygons ( Vector2[] newPolygon, int clipType )
void UpdatePolygon ( int id, Vector2[] points )
void RemovePolygon ( int id )

Method Descriptions

  • Dictionary Save ( bool copy = false ):
    Save the Shapes into the save file format and return it as a Dictionary. The param copy is only used by copy-pasting feature of Dungeondraft.

  • void Load ( Dictionary data ):
    Load a saved Shapes data. Used by a saved map file to load existing shapes.

  • void Resize ( int x, int y, int w, int h ):
    Called automatically when the canvas is resized. DO NOT CALL DIRECTLY. FOR REFERENCE ONLY.




  • void AddPolygon ( Vector2[] points, Rect2 bounds, bool invertAction ):
    The internal method DrawRect(), DrawCircle(), and DrawPolygon() all call to draw onto the water. Calls ClipPolygons() Not advisable to call directly.

  • void FinalizeOutlines ( ):
    Convert added vertices into shapes that are drawn. Called by ClipPolygons() and therefore by AddPolygon() and therefore by DrawRect(), DrawCircle(), and DrawPolygon. Not necessary to call directly.

  • void ClipPolygons ( Vector2[] newPolygon, int clipType ):
    Uses ClipLib algorithm to clip the new polygons against the existing ones. Valid options for clipType are: 0 = Intersection, 1 = Union, 2 = Difference, 3 = Xor.