Download Now

    Reference ISprite

    Declared in Codebot.Render.Graphics.pas on line 376

    ISprite draws one cell of a sprite sheet with a position, rotation, and scale
      ISprite = interface
      public
        function GetBitmap: IBitmap;
        procedure SetBitmap(Value: IBitmap);
        function GetCols: Integer;
        procedure SetCols(Value: Integer);
        function GetRows: Integer;
        procedure SetRows(Value: Integer);
        function GetCell: Integer;
        procedure SetCell(Value: Integer);
        function GetPivot: TVec2;
        procedure SetPivot(Value: TVec2);
        function GetPosition: TVec2;
        procedure SetPosition(Value: TVec2);
        function GetRotation: Single;
        procedure SetRotation(Value: Single);
        function GetScale: TVec2;
        procedure SetScale(Value: TVec2);
        function GetOpacity: Single;
        procedure SetOpacity(Value: Single);
        { The sprite sheet }
        property Bitmap: IBitmap read GetBitmap write SetBitmap;
        { The number of columns left and right in the sprite sheet }
        property Cols: Integer read GetCols write SetCols;
        { The number of rows up and down in the sprite sheet }
        property Rows: Integer read GetRows write SetRows;
        { A zero based idnex of the current cell. Numbering starts at the top left,
          continuing right, then moving down to the next row. The total number of
          cells equals cols * rows. }
        property Cell: Integer read GetCell write SetCell;
        { A two compoent vector in the range of 0..1 that specifcies the position,
          rotation, and scale pivot. }
        property Pivot: TVec2 read GetPivot write SetPivot;
        { Position of the sprite in pixels }
        property Position: TVec2 read GetPosition write SetPosition;
        { Rotation Angle of the sprite in radians }
        property Rotation: Single read GetRotation write SetRotation;
        { Scale of the sprite in both the x and y }
        property Scale: TVec2 read GetScale write SetScale;
        { Opacity of the sprite  in the range of 0..1 }
        property Opacity: Single read GetOpacity write SetOpacity;
      end;

    See also

    TVec2 in Codebot.Geometry.pas