Interface IScale
Allows scaling (changing the size of) entities/sprites.
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IScale : INotifyPropertyChanged
Properties
| Improve this Doc View SourceBaseSize
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. |
Height
Gets the height (in pixels).
Declaration
float Height { get; }
Property Value
Type | Description |
---|---|
System.Single | The height. |
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. |
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. |
Width
Gets the width (in pixels).
Declaration
float Width { get; }
Property Value
Type | Description |
---|---|
System.Single | The width. |
Methods
| Improve this Doc View SourceFlipHorizontally()
Declaration
void FlipHorizontally()
FlipVertically()
Declaration
void FlipVertically()
ResetScale()
Resets the scale to (1,1), i.e no scaling.
Declaration
void ResetScale()
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. |
ScaleTo(Single, Single)
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)"