Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
TextureRepeat
CanvasItem.swift:68enum TextureRepeat
Cases
case parentNode
The
CanvasItem
will inherit the filter from its parent.case disabled
Texture will not repeat.
case enabled
Texture will repeat normally.
case mirror
Texture will repeat in a 2x2 tiled mode, where elements at even positions are mirrored.
case max
Represents the size of the
TextureRepeat
enum.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (86) members.
Types
Type members
static let notificationDraw: Int
The
CanvasItem
is requested to draw (see_draw
).static let notificationEnterCanvas: Int
The
CanvasItem
has entered the canvas.static let notificationExitCanvas: Int
The
CanvasItem
has exited the canvas.static let notificationLocalTransformChanged: Int
The
CanvasItem
’s local transform has changed. This notification is only received if enabled bysetNotifyLocalTransform(enable:)
.static let notificationTransformChanged: Int
The
CanvasItem
’s global transform has changed. This notification is only received if enabled bysetNotifyTransform(enable:)
.static let notificationVisibilityChanged: Int
The
CanvasItem
’s visibility has changed.static let notificationWorld2dChanged: Int
The
CanvasItem
’s activeWorld2D
changed.class var godotClassName: StringName
Instance members
var clipChildren: CanvasItem.ClipChildrenMode
Allows the current node to clip children nodes, essentially acting as a mask.
var draw: SimpleSignal
Emitted when the
CanvasItem
must redraw, after the relatednotificationDraw
notification, and before_draw
is called.var itemRectChanged: SimpleSignal
Emitted when the item’s
Rect2
boundaries (position or size) have changed, or when an action is taking place that may have impacted these boundaries (e.g. changingtexture
).var lightMask: Int32
The rendering layers in which this
CanvasItem
responds toLight2D
nodes.var material: Material?
The material applied to this
CanvasItem
.var modulate: Color
The color applied to this
CanvasItem
. This property does affect childCanvasItem
s, unlikeselfModulate
which only affects the node itself.var selfModulate: Color
The color applied to this
CanvasItem
. This property does not affect childCanvasItem
s, unlikemodulate
which affects both the node itself and its children.var showBehindParent: Bool
If
true
, the object draws behind its parent.var textureFilter: CanvasItem.TextureFilter
The texture filtering mode to use on this
CanvasItem
.var textureRepeat: CanvasItem.TextureRepeat
The texture repeating mode to use on this
CanvasItem
.var topLevel: Bool
If
true
, thisCanvasItem
will not inherit its transform from parentCanvasItem
s. Its draw order will also be changed to make it draw on top of otherCanvasItem
s that do not havetopLevel
set totrue
. TheCanvasItem
will effectively act as if it was placed as a child of a bareNode
.var useParentMaterial: Bool
If
true
, the parentCanvasItem
‘smaterial
property is used as this one’s material.var visibilityChanged: SimpleSignal
Emitted when the visibility (hidden/visible) changes.
var visibilityLayer: UInt32
The rendering layer in which this
CanvasItem
is rendered byViewport
nodes. AViewport
will render aCanvasItem
if it and all its parents share a layer with theViewport
’s canvas cull mask.var visible: Bool
If
true
, thisCanvasItem
is drawn. The node is only visible if all of its ancestors are visible as well (in other words,isVisibleInTree
must returntrue
).var ySortEnabled: Bool
If
true
, child nodes with the lowest Y position are drawn before those with a higher Y position. Iffalse
, Y-sorting is disabled. Y-sorting only affects children that inherit fromCanvasItem
.var zAsRelative: Bool
If
true
, the node’s Z index is relative to its parent’s Z index. If this node’s Z index is 2 and its parent’s effective Z index is 3, then this node’s effective Z index will be 2 + 3 = 5.var zIndex: Int32
Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between
RenderingServer
canvasItemZMinand ``RenderingServer/``canvasItemZMax
(inclusive).func drawAnimationSlice(animationLength: Double, sliceBegin: Double, sliceEnd: Double, offset: Double
) 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.
func drawArc(center: Vector2, radius: Double, startAngle: Double, endAngle: Double, pointCount: Int32, color: Color, width: Double, antialiased: Bool
) Draws an unfilled arc between the given angles with a uniform
color
andwidth
and optional antialiasing (supported only for positivewidth
). The larger the value ofpointCount
, the smoother the curve. See alsodrawCircle(position:radius:color:)
.func drawChar(font: Font?, pos: Vector2, char: String, fontSize: Int32, modulate: Color
) Draws a string first character using a custom font.
func drawCharOutline(font: Font?, pos: Vector2, char: String, fontSize: Int32, size: Int32, modulate: Color
) Draws a string first character outline using a custom font.
func drawCircle(position: Vector2, radius: Double, color: Color
) Draws a colored, filled circle. See also
drawArc(center:radius:startAngle:endAngle:pointCount:color:width:antialiased:)
,drawPolyline(points:color:width:antialiased:)
anddrawPolygon(points:colors:uvs:texture:)
.func drawColoredPolygon(points: PackedVector2Array, color: Color, uvs: PackedVector2Array, texture: Texture2D?
) Draws a colored polygon of any number of points, convex or concave. Unlike
drawPolygon(points:colors:uvs:texture:)
, a single color must be specified for the whole polygon.func drawDashedLine(from: Vector2, to: Vector2, color: Color, width: Double, dash: Double, aligned: Bool
) Draws a dashed line from a 2D point to another, with a given color and width. See also
drawMultiline(points:color:width:)
anddrawPolyline(points:color:width:antialiased:)
.func drawEndAnimation(
) After submitting all animations slices via
drawAnimationSlice(animationLength:sliceBegin:sliceEnd:offset:)
, 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.func drawLcdTextureRectRegion(texture: Texture2D?, rect: Rect2, srcRect: Rect2, modulate: Color
) Draws a textured rectangle region of the font texture with LCD subpixel anti-aliasing at a given position, optionally modulated by a color.
func drawLine(from: Vector2, to: Vector2, color: Color, width: Double, antialiased: Bool
) Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased. See also
drawMultiline(points:color:width:)
anddrawPolyline(points:color:width:antialiased:)
.func drawMesh(Mesh?, texture: Texture2D?, transform: Transform2D, modulate: Color
) Draws a
Mesh
in 2D, using the provided texture. SeeMeshInstance2D
for related documentation.func drawMsdfTextureRectRegion(texture: Texture2D?, rect: Rect2, srcRect: Rect2, modulate: Color, outline: Double, pixelRange: Double, scale: Double
) Draws a textured rectangle region of the multi-channel signed distance field texture at a given position, optionally modulated by a color. See
multichannelSignedDistanceField
for more information and caveats about MSDF font rendering.func drawMultiline(points: PackedVector2Array, color: Color, width: Double
) Draws multiple disconnected lines with a uniform
width
andcolor
. Each line is defined by two consecutive points frompoints
array, i.e. i-th segment consists ofpoints[2 * i]
,points[2 * i + 1]
endpoints. When drawing large amounts of lines, this is faster than using individualdrawLine(from:to:color:width:antialiased:)
calls. To draw interconnected lines, usedrawPolyline(points:color:width:antialiased:)
instead.func drawMultilineColors(points: PackedVector2Array, colors: PackedColorArray, width: Double
) Draws multiple disconnected lines with a uniform
width
and segment-by-segment coloring. Each segment is defined by two consecutive points frompoints
array and a corresponding color fromcolors
array, i.e. i-th segment consists ofpoints[2 * i]
,points[2 * i + 1]
endpoints and hascolors_
color. When drawing large amounts of lines, this is faster than using individualdrawLine(from:to:color:width:antialiased:)
calls. To draw interconnected lines, usedrawPolylineColors(points:colors:width:antialiased:)
instead.func drawMultilineString(font: Font?, pos: Vector2, text: String, alignment: HorizontalAlignment, width: Double, fontSize: Int32, maxLines: Int32, modulate: Color, brkFlags: TextServer.LineBreakFlag, justificationFlags: TextServer.JustificationFlag, direction: TextServer.Direction, orientation: TextServer.Orientation
) Breaks
text
into lines and draws it using the specifiedfont
at thepos
(top-left corner). The text will have its color multiplied bymodulate
. Ifwidth
is greater than or equal to 0, the text will be clipped if it exceeds the specified width.func drawMultilineStringOutline(font: Font?, pos: Vector2, text: String, alignment: HorizontalAlignment, width: Double, fontSize: Int32, maxLines: Int32, size: Int32, modulate: Color, brkFlags: TextServer.LineBreakFlag, justificationFlags: TextServer.JustificationFlag, direction: TextServer.Direction, orientation: TextServer.Orientation
) Breaks
text
to the lines and draws text outline using the specifiedfont
at thepos
(top-left corner). The text will have its color multiplied bymodulate
. Ifwidth
is greater than or equal to 0, the text will be clipped if it exceeds the specified width.func drawMultimesh(MultiMesh?, texture: Texture2D?
) Draws a
MultiMesh
in 2D with the provided texture. SeeMultiMeshInstance2D
for related documentation.func drawPolygon(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array, texture: Texture2D?
) Draws a solid polygon of any number of points, convex or concave. Unlike
drawColoredPolygon(points:color:uvs:texture:)
, each point’s color can be changed individually. See alsodrawPolyline(points:color:width:antialiased:)
anddrawPolylineColors(points:colors:width:antialiased:)
. If you need more flexibility (such as being able to use bones), usecanvasItemAddTriangleArray(item:indices:points:colors:uvs:bones:weights:texture:count:)
instead.func drawPolyline(points: PackedVector2Array, color: Color, width: Double, antialiased: Bool
) Draws interconnected line segments with a uniform
color
andwidth
and optional antialiasing (supported only for positivewidth
). When drawing large amounts of lines, this is faster than using individualdrawLine(from:to:color:width:antialiased:)
calls. To draw disconnected lines, usedrawMultiline(points:color:width:)
instead. See alsodrawPolygon(points:colors:uvs:texture:)
.func drawPolylineColors(points: PackedVector2Array, colors: PackedColorArray, width: Double, antialiased: Bool
) Draws interconnected line segments with a uniform
width
, point-by-point coloring, and optional antialiasing (supported only for positivewidth
). Colors assigned to line points match by index betweenpoints
andcolors
, i.e. each line segment is filled with a gradient between the colors of the endpoints. When drawing large amounts of lines, this is faster than using individualdrawLine(from:to:color:width:antialiased:)
calls. To draw disconnected lines, usedrawMultilineColors(points:colors:width:)
instead. See alsodrawPolygon(points:colors:uvs:texture:)
.func drawPrimitive(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array, texture: Texture2D?
) Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle, and 4 points for a quad. If 0 points or more than 4 points are specified, nothing will be drawn and an error message will be printed. See also
drawLine(from:to:color:width:antialiased:)
,drawPolyline(points:color:width:antialiased:)
,drawPolygon(points:colors:uvs:texture:)
, anddrawRect(_:color:filled:width:)
.func drawRect(Rect2, color: Color, filled: Bool, width: Double
) Draws a rectangle. If
filled
istrue
, the rectangle will be filled with thecolor
specified. Iffilled
isfalse
, the rectangle will be drawn as a stroke with thecolor
andwidth
specified. See alsodrawTextureRect(texture:rect:tile:modulate:transpose:)
.func drawSetTransform(position: Vector2, rotation: Double, scale: Vector2
) Sets a custom transform for drawing via components. Anything drawn afterwards will be transformed by this.
func drawSetTransformMatrix(xform: Transform2D
) Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this.
func drawString(font: Font?, pos: Vector2, text: String, alignment: HorizontalAlignment, width: Double, fontSize: Int32, modulate: Color, justificationFlags: TextServer.JustificationFlag, direction: TextServer.Direction, orientation: TextServer.Orientation
) Draws
text
using the specifiedfont
at thepos
(bottom-left corner using the baseline of the font). The text will have its color multiplied bymodulate
. Ifwidth
is greater than or equal to 0, the text will be clipped if it exceeds the specified width.func drawStringOutline(font: Font?, pos: Vector2, text: String, alignment: HorizontalAlignment, width: Double, fontSize: Int32, size: Int32, modulate: Color, justificationFlags: TextServer.JustificationFlag, direction: TextServer.Direction, orientation: TextServer.Orientation
) Draws
text
outline using the specifiedfont
at thepos
(bottom-left corner using the baseline of the font). The text will have its color multiplied bymodulate
. Ifwidth
is greater than or equal to 0, the text will be clipped if it exceeds the specified width.func drawStyleBox(StyleBox?, rect: Rect2
) Draws a styled rectangle.
func drawTexture(Texture2D?, position: Vector2, modulate: Color
) Draws a texture at a given position.
func drawTextureRect(texture: Texture2D?, rect: Rect2, tile: Bool, modulate: Color, transpose: Bool
) Draws a textured rectangle at a given position, optionally modulated by a color. If
transpose
istrue
, the texture will have its X and Y coordinates swapped. See alsodrawRect(_:color:filled:width:)
anddrawTextureRectRegion(texture:rect:srcRect:modulate:transpose:clipUv:)
.func drawTextureRectRegion(texture: Texture2D?, rect: Rect2, srcRect: Rect2, modulate: Color, transpose: Bool, clipUv: Bool
) Draws a textured rectangle from a texture’s region (specified by
srcRect
) at a given position, optionally modulated by a color. Iftranspose
istrue
, the texture will have its X and Y coordinates swapped. See alsodrawTextureRect(texture:rect:tile:modulate:transpose:)
.func forceUpdateTransform(
) Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.
func getCanvas(
) -> RID Returns the
RID
of theWorld2D
canvas where this item is in.func getCanvasItem(
) -> RID Returns the canvas item RID used by
RenderingServer
for this item.func getCanvasTransform(
) -> Transform2D Returns the transform from the coordinate system of the canvas, this item is in, to the
Viewport
s coordinate system.func getGlobalMousePosition(
) -> Vector2 Returns the mouse’s position in the
CanvasLayer
that thisCanvasItem
is in using the coordinate system of theCanvasLayer
.func getGlobalTransform(
) -> Transform2D Returns the global transform matrix of this item, i.e. the combined transform up to the topmost
CanvasItem
node. The topmost item is aCanvasItem
that either has no parent, has non-CanvasItem
parent or it hastopLevel
enabled.func getGlobalTransformWithCanvas(
) -> Transform2D Returns the transform from the local coordinate system of this
CanvasItem
to theViewport
s coordinate system.func getLocalMousePosition(
) -> Vector2 Returns the mouse’s position in this
CanvasItem
using the local coordinate system of thisCanvasItem
.func getScreenTransform(
) -> Transform2D Returns the transform of this
CanvasItem
in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.func getTransform(
) -> Transform2D Returns the transform matrix of this item.
func getViewportRect(
) -> Rect2 Returns the viewport’s boundaries as a
Rect2
.func getViewportTransform(
) -> Transform2D Returns the transform from the coordinate system of the canvas, this item is in, to the
Viewport
s embedders coordinate system.func getVisibilityLayerBit(layer: UInt32
) -> Bool Returns an individual bit on the rendering visibility layer.
func getWorld2d(
) -> World2D? Returns the
World2D
where this item is in.func hide(
) Hide the
CanvasItem
if it’s currently visible. This is equivalent to settingvisible
tofalse
.func isLocalTransformNotificationEnabled(
) -> Bool Returns
true
if local transform notifications are communicated to children.func isTransformNotificationEnabled(
) -> Bool Returns
true
if global transform notifications are communicated to children.func isVisibleInTree(
) -> Bool Returns
true
if the node is present in theSceneTree
, itsvisible
property istrue
and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree, and is consequently not drawn (see_draw
).func makeCanvasPositionLocal(screenPoint: Vector2
) -> Vector2 Assigns
screenPoint
as this node’s new local transform.func makeInputLocal(event: InputEvent?
) -> InputEvent? Transformations issued by
event
’s inputs are applied in local space instead of global space.func moveToFront(
) Moves this node to display on top of its siblings.
func queueRedraw(
) Queues the
CanvasItem
to redraw. During idle time, ifCanvasItem
is visible,notificationDraw
is sent and_draw
is called. This only occurs once per frame, even if this method has been called multiple times.func setNotifyLocalTransform(enable: Bool
) If
enable
istrue
, this node will receivenotificationLocalTransformChanged
when its local transform changes.func setNotifyTransform(enable: Bool
) If
enable
istrue
, this node will receivenotificationTransformChanged
when its global transform changes.func setVisibilityLayerBit(layer: UInt32, enabled: Bool
) Set/clear individual bits on the rendering visibility layer. This simplifies editing this
CanvasItem
’s visibility layer.func show(
) Show the
CanvasItem
if it’s currently hidden. This is equivalent to settingvisible
totrue
. For controls that inheritPopup
, the correct way to make them visible is to call one of the multiplepopup*()
functions instead.
Show implementation details (1)
Hide implementation details
func _draw(
) Called when
CanvasItem
has been requested to redraw (afterqueueRedraw
is called, either manually or by the engine).
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.