Show / Hide Table of Contents

    Interface IScale

    Allows scaling (changing the size of) entities/sprites.

    Inherited Members
    System.ComponentModel.INotifyPropertyChanged.PropertyChanged
    Namespace: AGS.API
    Assembly: AGS.API.dll
    Syntax
    public interface IScale : INotifyPropertyChanged

    Properties

    | Improve this Doc View Source

    BaseSize

    Gets or sets the base size (the "original" size), on top of which the scale is calculated.

    Declaration
    SizeF BaseSize { get; set; }
    Property Value
    Type Description
    SizeF

    The size of the base.

    | Improve this Doc View Source

    Height

    Gets the height (in pixels).

    Declaration
    float Height { get; }
    Property Value
    Type Description
    System.Single

    The height.

    | Improve this Doc View Source

    Scale

    Scales the size by a factor. The factor is calculated on top of the original size, not the current size. (1,1) is the default, meaning no scale.

    Declaration
    PointF Scale { get; set; }
    Property Value
    Type Description
    PointF
    Examples
    sprite.ResetScale(10f,10f);
    sprite.Scale = new PointF(2f, 1f);
    Debug.WriteLine("Size of sprite is ({0},{1})", sprite.Width, sprite.Height); //prints "Size of sprite is (20,10)"
    sprite.Scale = new PointF(3f, 4f);
    Debug.WriteLine("Size of sprite is ({0},{1})", sprite.Width, sprite.Height); //prints "Size of sprite is (30,40)"
    | Improve this Doc View Source

    ScaleX

    Gets or sets the current horizontal scale (1 by default- meaning no scale). The scaling is calculated based on the original size, meaning that ScaleX * BaseSize.Width = Width.

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

    The scale x.

    | Improve this Doc View Source

    ScaleY

    Gets or sets the current vertical scale (1 by default- meaning no scale). The scaling is calculated based on the original size, meaning that ScaleY * BaseSize.Height = Height.

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

    The scale y.

    | Improve this Doc View Source

    Width

    Gets the width (in pixels).

    Declaration
    float Width { get; }
    Property Value
    Type Description
    System.Single

    The width.

    Methods

    | Improve this Doc View Source

    FlipHorizontally()

    Flips the scale horizontally (this is done by negating ScaleX and Pivot's X).

    Declaration
    void FlipHorizontally()
    | Improve this Doc View Source

    FlipVertically()

    Flips the scale vertucally (this is done by negating ScaleY and Pivot's Y).

    Declaration
    void FlipVertically()
    | Improve this Doc View Source

    ResetScale()

    Resets the scale to (1,1), i.e no scaling.

    Declaration
    void ResetScale()
    | Improve this Doc View Source

    ResetScale(Single, Single)

    Resets the base size (the "original" size, BaseSize) to the specified scale, and then resets the scale to (1,1), i.e no scaling.

    Declaration
    void ResetScale(float initialWidth, float initialHeight)
    Parameters
    Type Name Description
    System.Single initialWidth

    Initial width.

    System.Single initialHeight

    Initial height.

    | Improve this Doc View Source

    ScaleTo(Single, Single)

    Scales the size to a specific size. This will change ScaleX and ScaleY to fit.

    Declaration
    void ScaleTo(float width, float height)
    Parameters
    Type Name Description
    System.Single width

    Width.

    System.Single height

    Height.

    Examples
    sprite.ResetScale(10f,10f);
    sprite.ScaleTo(20f,30f);
    Debug.WriteLine("Sprite is scaled by ({0},{1})", sprite.ScaleX, sprite.ScaleY); //prints "Sprite is scaled by (2,3)"
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX