Sprite

General-purpose sprite node.

A node that displays a 2D texture. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation.

@GodotBaseClass
struct Sprite {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

_textureChanged
void _textureChanged()
getFrame
long getFrame()
getFrameCoords
Vector2 getFrameCoords()
getHframes
long getHframes()
getNormalMap
Ref!Texture getNormalMap()
getOffset
Vector2 getOffset()
getRect
Rect2 getRect()

Returns a Rect2 representing the Sprite's boundary in local coordinates. Can be used to detect if the Sprite was clicked. Example:

getRegionRect
Rect2 getRegionRect()
getTexture
Ref!Texture getTexture()
getVframes
long getVframes()
isCentered
bool isCentered()
isFlippedH
bool isFlippedH()
isFlippedV
bool isFlippedV()
isPixelOpaque
bool isPixelOpaque(Vector2 pos)

Returns true, if the pixel at the given position is opaque and false in other case. Note: It also returns false, if the sprite's texture is null or if the given position is invalid.

isRegion
bool isRegion()
isRegionFilterClipEnabled
bool isRegionFilterClipEnabled()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Sprite other)
opEquals
bool opEquals(typeof(null) n)
setCentered
void setCentered(bool centered)
setFlipH
void setFlipH(bool flip_h)
setFlipV
void setFlipV(bool flip_v)
setFrame
void setFrame(long frame)
setFrameCoords
void setFrameCoords(Vector2 coords)
setHframes
void setHframes(long hframes)
setNormalMap
void setNormalMap(Texture normal_map)
setOffset
void setOffset(Vector2 offset)
setRegion
void setRegion(bool enabled)
setRegionFilterClip
void setRegionFilterClip(bool enabled)
setRegionRect
void setRegionRect(Rect2 rect)
setTexture
void setTexture(Texture texture)
setVframes
void setVframes(long vframes)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

centered
bool centered [@property getter]
bool centered [@property setter]

If true, texture is centered.

flipH
bool flipH [@property getter]
bool flipH [@property setter]

If true, texture is flipped horizontally.

flipV
bool flipV [@property getter]
bool flipV [@property setter]

If true, texture is flipped vertically.

frame
long frame [@property getter]
long frame [@property setter]

Current frame to display from sprite sheet. hframes or vframes must be greater than 1.

frameCoords
Vector2 frameCoords [@property getter]
Vector2 frameCoords [@property setter]

Coordinates of the frame to display from sprite sheet. This is as an alias for the frame property. hframes or vframes must be greater than 1.

hframes
long hframes [@property getter]
long hframes [@property setter]

The number of columns in the sprite sheet.

normalMap
Texture normalMap [@property getter]
Texture normalMap [@property setter]

The normal map gives depth to the Sprite. Note: Godot expects the normal map to use X+, Y-, and Z+ coordinates. See url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinatesthis page/url for a comparison of normal map coordinates expected by popular engines.

offset
Vector2 offset [@property getter]
Vector2 offset [@property setter]

The texture's drawing offset.

regionEnabled
bool regionEnabled [@property getter]
bool regionEnabled [@property setter]

If true, texture is cut from a larger atlas texture. See regionRect.

regionFilterClip
bool regionFilterClip [@property getter]
bool regionFilterClip [@property setter]

If true, the outermost pixels get blurred out.

regionRect
Rect2 regionRect [@property getter]
Rect2 regionRect [@property setter]

The region of the atlas texture to display. regionEnabled must be true.

texture
Texture texture [@property getter]
Texture texture [@property setter]

Texture object to draw.

vframes
long vframes [@property getter]
long vframes [@property setter]

The number of rows in the sprite sheet.

Static functions

_new
Sprite _new()

Construct a new instance of Sprite. Note: use memnew!Sprite instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta