Documentation
¶
Overview ¶
A Polygon2D is defined by a set of points. Each point is connected to the next, with the final point being connected to the first, resulting in a closed polygon. Polygon2Ds can be filled with color (solid or gradient) or filled with a given texture.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AddBone(path string, weights []float32)
- func (self Instance) Antialiased() bool
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode2D() Node2D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsPolygon2D() Instance
- func (self Instance) ClearBones()
- func (self Instance) Color() Color.RGBA
- func (self Instance) EraseBone(index int)
- func (self Instance) GetBoneCount() int
- func (self Instance) GetBonePath(index int) string
- func (self Instance) GetBoneWeights(index int) []float32
- func (self Instance) ID() ID
- func (self Instance) InternalVertexCount() int
- func (self Instance) InvertBorder() Float.X
- func (self Instance) InvertEnabled() bool
- func (self Instance) Offset() Vector2.XY
- func (self Instance) Polygon() []Vector2.XY
- func (self Instance) Polygons() [][]int32
- func (self Instance) SetAntialiased(value bool)
- func (self Instance) SetBonePath(index int, path string)
- func (self Instance) SetBoneWeights(index int, weights []float32)
- func (self Instance) SetColor(value Color.RGBA)
- func (self Instance) SetInternalVertexCount(value int)
- func (self Instance) SetInvertBorder(value Float.X)
- func (self Instance) SetInvertEnabled(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOffset(value Vector2.XY)
- func (self Instance) SetPolygon(value []Vector2.XY)
- func (self Instance) SetPolygons(value [][]int32)
- func (self Instance) SetSkeleton(value string)
- func (self Instance) SetTexture(value Texture2D.Instance)
- func (self Instance) SetTextureOffset(value Vector2.XY)
- func (self Instance) SetTextureRotation(value Angle.Radians)
- func (self Instance) SetTextureScale(value Vector2.XY)
- func (self Instance) SetUv(value []Vector2.XY)
- func (self Instance) SetVertexColors(value []Color.RGBA)
- func (self Instance) Skeleton() string
- func (self Instance) Texture() Texture2D.Instance
- func (self Instance) TextureOffset() Vector2.XY
- func (self Instance) TextureRotation() Angle.Radians
- func (self Instance) TextureScale() Vector2.XY
- func (self Instance) Uv() []Vector2.XY
- func (self Instance) VertexColors() []Color.RGBA
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
func (*Extension[T]) AsPolygon2D ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) Antialiased ¶
If true, polygon edges will be anti-aliased.
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsPolygon2D ¶
func (Instance) ClearBones ¶
func (self Instance) ClearBones()
Removes all bones from this Polygon2D.
func (Instance) Color ¶
The polygon's fill color. If Texture is set, it will be multiplied by this color. It will also be the default color for vertices not set in VertexColors.
func (Instance) GetBoneCount ¶
Returns the number of bones in this Polygon2D.
func (Instance) GetBonePath ¶
Returns the path to the node associated with the specified bone.
func (Instance) GetBoneWeights ¶
Returns the weight values of the specified bone.
func (Instance) InternalVertexCount ¶
Number of internal vertices, used for UV mapping.
func (Instance) InvertBorder ¶
Added padding applied to the bounding box when InvertEnabled is set to true. Setting this value too small may result in a "Bad Polygon" error.
func (Instance) InvertEnabled ¶
If true, the polygon will be inverted, containing the area outside the defined points and extending to the InvertBorder.
func (Instance) Polygon ¶
The polygon's list of vertices. The final point will be connected to the first.
func (Instance) Polygons ¶
The list of polygons, in case more than one is being represented. Every individual polygon is stored as a []int32 where each int is an index to a point in Polygon. If empty, this property will be ignored, and the resulting single polygon will be composed of all points in Polygon, using the order they are stored in.
func (Instance) SetAntialiased ¶
SetAntialiased sets the property returned by [GetAntialiased].
func (Instance) SetBonePath ¶
Sets the path to the node associated with the specified bone.
func (Instance) SetBoneWeights ¶
Sets the weight values for the specified bone.
func (Instance) SetInternalVertexCount ¶
SetInternalVertexCount sets the property returned by [GetInternalVertexCount].
func (Instance) SetInvertBorder ¶
SetInvertBorder sets the property returned by [GetInvertBorder].
func (Instance) SetInvertEnabled ¶
SetInvertEnabled sets the property returned by [GetInvertEnabled].
func (Instance) SetPolygon ¶
SetPolygon sets the property returned by [GetPolygon].
func (Instance) SetPolygons ¶
SetPolygons sets the property returned by [GetPolygons].
func (Instance) SetSkeleton ¶
SetSkeleton sets the property returned by [GetSkeleton].
func (Instance) SetTexture ¶
SetTexture sets the property returned by [GetTexture].
func (Instance) SetTextureOffset ¶
SetTextureOffset sets the property returned by [GetTextureOffset].
func (Instance) SetTextureRotation ¶
SetTextureRotation sets the property returned by [GetTextureRotation].
func (Instance) SetTextureScale ¶
SetTextureScale sets the property returned by [GetTextureScale].
func (Instance) SetVertexColors ¶
SetVertexColors sets the property returned by [GetVertexColors].
func (Instance) Skeleton ¶
Path to a Skeleton2D node used for skeleton-based deformations of this polygon. If empty or invalid, skeletal deformations will not be used.
func (Instance) TextureOffset ¶
Amount to offset the polygon's Texture. If set to Vector2(0, 0), the texture's origin (its top-left corner) will be placed at the polygon's position.
func (Instance) TextureRotation ¶
The texture's rotation in radians.
func (Instance) TextureScale ¶
Amount to multiply the Uv coordinates when using Texture. Larger values make the texture smaller, and vice versa.
func (Instance) Uv ¶
Texture coordinates for each vertex of the polygon. There should be one UV value per polygon vertex. If there are fewer, undefined vertices will use Vector2(0, 0).
func (Instance) VertexColors ¶
Color for each vertex. Colors are interpolated between vertices, resulting in smooth gradients. There should be one per polygon vertex. If there are fewer, undefined vertices will use Color.