Skip to content

Sprite2D

Eduard Gushchin edited this page Jun 24, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.Sprite2D
Namespace Electron2D
Kind class
Category Rendering

Overview

Provides a node that submits a 2D texture for drawing.

Syntax

public class Electron2D.Sprite2D : Electron2D.Node2D

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: Sprite2D

Texture, centered/offset drawing rect, region rect, flip flags, pixel opacity and internal submission baseline.

Remarks

Electron2D.Sprite2D displays the assigned Electron2D.Texture2D or a rectangular region of that texture.

Use Electron2D.AnimatedSprite2D with Electron2D.SpriteFrames for frame-based texture animation.

Thread Safety

This type is not synchronized. Create and mutate sprites on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimatedSprite2D
  • Electron2D.Node2D
  • Electron2D.Texture2D

Members

Member Kind Summary
Centered Property Gets or sets whether the texture is drawn centered on the node origin.
FlipH Property Gets or sets whether the texture is flipped horizontally.
FlipV Property Gets or sets whether the texture is flipped vertically.
Offset Property Gets or sets the local drawing offset.
RegionEnabled Property Gets or sets whether Electron2D.Sprite2D.RegionRect limits the sampled texture region.
RegionFilterClipEnabled Property Gets or sets whether filtering should clip to the enabled region.
RegionRect Property Gets or sets the source rectangle used when Electron2D.Sprite2D.RegionEnabled is true.
Texture Property Gets or sets the texture displayed by this sprite.
Electron2D.Sprite2D() Constructor Initializes a new instance of the Sprite2D type.
GetRect() Method Gets the local rectangle occupied by this sprite.
IsPixelOpaque(Electron2D.Vector2) Method Checks whether a local sprite position maps to an opaque texture pixel.

Member Details

Centered

Kind: Property

public System.Boolean Centered { get; set; }

Summary

Gets or sets whether the texture is drawn centered on the node origin.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current centered value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

FlipH

Kind: Property

public System.Boolean FlipH { get; set; }

Summary

Gets or sets whether the texture is flipped horizontally.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current flip h value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

FlipV

Kind: Property

public System.Boolean FlipV { get; set; }

Summary

Gets or sets whether the texture is flipped vertically.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current flip v value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

Offset

Kind: Property

public Electron2D.Vector2 Offset { get; set; }

Summary

Gets or sets the local drawing offset.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current offset value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

RegionEnabled

Kind: Property

public System.Boolean RegionEnabled { get; set; }

Summary

Gets or sets whether Electron2D.Sprite2D.RegionRect limits the sampled texture region.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current region enabled value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D.RegionRect

RegionFilterClipEnabled

Kind: Property

public System.Boolean RegionFilterClipEnabled { get; set; }

Summary

Gets or sets whether filtering should clip to the enabled region.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current region filter clip enabled value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

RegionRect

Kind: Property

public Electron2D.Rect2 RegionRect { get; set; }

Summary

Gets or sets the source rectangle used when Electron2D.Sprite2D.RegionEnabled is true.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current region rect value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

Texture

Kind: Property

public Electron2D.Texture2D Texture { get; set; }

Summary

Gets or sets the texture displayed by this sprite.

Remarks

If this property is null, the sprite remains part of the scene tree but does not submit a draw command.

Value

The current texture value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

Electron2D.Sprite2D()

Kind: Constructor

public Electron2D.Sprite2D()

Summary

Initializes a new instance of the Sprite2D type.

Remarks

The new instance follows the lifetime and validation rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

GetRect()

Kind: Method

public Electron2D.Rect2 GetRect()()

Summary

Gets the local rectangle occupied by this sprite.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

The local drawing rectangle derived from the texture size, region and offset.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

IsPixelOpaque(Electron2D.Vector2)

Kind: Method

public System.Boolean IsPixelOpaque(Electron2D.Vector2)(Electron2D.Vector2 pos)

Summary

Checks whether a local sprite position maps to an opaque texture pixel.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • pos: The position in the sprite's local drawing coordinates.

Returns

true if the mapped texture pixel is opaque; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Sprite2D

Clone this wiki locally