Chroma Engine

  • Home
  • Articles
  • Api Documentation
Search Results for

    Show / Hide Table of Contents
    • Chroma
      • Audio
      • AudioSource
      • BoxCollider
      • Camera
      • CircleCollider
      • Color
      • Component
      • Coroutine
      • Coroutine.CoroutineFunction
      • Entity
      • ExecutionOrder
      • Input
      • Input.ConnectionState
      • Input.Gamepad
      • Input.GamepadAxis
      • Input.GamepadButton
      • Input.JoystickHatState
      • Input.Key
      • Input.Mouse
      • Log
      • Mathf
      • ParticleEmitter
      • RuntimeException
      • Scene
      • SpriteRenderer
      • StateMachine<T>
      • Time
      • Transform
      • Vector2
      • Vector3
      • Vector4

    Class SpriteRenderer

    Sprite Renderer Component. Controls rendering a sprite for an entity.

    Inheritance
    System.Object
    Component
    SpriteRenderer
    Inherited Members
    Component.Entity
    Component.Enabled
    Namespace: Chroma
    Assembly: Chroma.Mono.dll
    Syntax
    public class SpriteRenderer : Component

    Properties

    Animation

    Set sprite animation by index. Index will be bounded by number of animations the sprite contains. Only applies to animated sprites.

    Declaration
    public uint Animation { get; set; }
    Property Value
    Type Description
    System.UInt32

    Color

    Color of the sprite. Default is white.

    Declaration
    public Vector4 Color { get; set; }
    Property Value
    Type Description
    Vector4
    Remarks

    Color is multiplicatively blended with the texture in the fragment shader.

    Frame

    The current frame of the animated sprite. This frame is independent of the selected animation (ie spans frames of all animations). Only applies to animated sprites.

    Declaration
    public uint Frame { get; set; }
    Property Value
    Type Description
    System.UInt32

    Layer

    [DEPRICATED] Layer of the sprite.

    Declaration
    public string Layer { get; set; }
    Property Value
    Type Description
    System.String

    Loop

    Whether the sprite animation should loop. If false, the animation will stop when it hits the last frame. Only applies if the sprite is animated.

    Declaration
    public bool Loop { get; set; }
    Property Value
    Type Description
    System.Boolean

    Offset

    Offset of the sprite. By default the sprite renders starting at the entity's transform position. The offset is added to the transform.

    Declaration
    public Vector2 Offset { get; set; }
    Property Value
    Type Description
    Vector2

    Playing

    Bool representing whether the sprite is playing. Only applies if the sprite is animated.

    Declaration
    public bool Playing { get; set; }
    Property Value
    Type Description
    System.Boolean

    PlayOnStart

    Whether the sprite should begin playing at the start of the scene. If not, setting Playing to true will begin the sprite's animation. Only applies if the sprite is animated.

    Declaration
    public bool PlayOnStart { get; set; }
    Property Value
    Type Description
    System.Boolean

    Speed

    Speed multiplier of the sprite. Default is 1.0. Only applies if the sprite is animated.

    Declaration
    public float Speed { get; set; }
    Property Value
    Type Description
    System.Single

    SpriteID

    Sprite to render. Setting this to an ID of a sprite that does not exist will result in a warning.

    Declaration
    public string SpriteID { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    GetAnimationTag()

    Gets the current animation's tag.

    Declaration
    public string GetAnimationTag()
    Returns
    Type Description
    System.String

    Name/Tag of the current animation

    GetAnimationTag(UInt32)

    Gets the name of the animation from the numerical ID.

    Declaration
    public string GetAnimationTag(uint animation)
    Parameters
    Type Name Description
    System.UInt32 animation

    Numerical ID of the animation

    Returns
    Type Description
    System.String

    Name of the animation.

    RestartAnimation()

    Restarts the current animation.

    Declaration
    public void RestartAnimation()

    SetAnimationByTag(String)

    Sets the sprite animation by the animation's tag.

    Declaration
    public void SetAnimationByTag(string tag)
    Parameters
    Type Name Description
    System.String tag

    Name of the sprite's animation. This is case sensitive.

    ☀
    ☾
    In This Article
    Back to top
    Generated by DocFX
    ☀
    ☾