User Tools

Site Tools


Action unknown: siteexport_addpage
en:code:core:size

Size

This object represents a size in a 2D space.

Functions

Size

Constructor function.

Syntax

var myObject = new Size();
var myObject = new Size(otherSize);
var myObject = new Size(width, height);

Arguments

  1. otherSize - (Size) other Size to copy
  2. width - (integer) width of the Size
  3. height - (integer) height of the Size

Exceptions

  • (ParameterTypeError) incorrect parameter type
  • (ParameterCountError) incorrect parameter count

Example

Create a Size representing a zero size.

var myObject = new Size();

Create a Size representing a copy of otherSize.

var myObject = new Size(otherSize);

Create a Size representing the (50;75) size.

var myObject = new Size(50, 75);

Methods

clone

Returns a copy of this Size.

Syntax

myObject.clone();

Returns

  • (Size) a copy of this Size

Example

var copyOfMyObject = myObject.clone();

equals

Returns true if this Size and another are referencing the same size.

Syntax

myObject.equals(other);

Arguments

  1. other - (Size) another Size

Returns

  • (bool) true if other is referencing the same size

Example

if(myFirstObject.equals(mySecondObject))
	//Do something

toString

Returns a string representing this Size.

Syntax

myObject.toString();

Returns

  • (string) a string representing this Size

Example

Console.print(myObject.toString());

Notes

This method is automatically called when trying to convert a Size to a string.

setWidth

Sets the width of this Size.

Syntax

myObject.setWidth(width);

Arguments

  1. width - (integer) the width

Returns

  • (Size) this Size

setHeight

Sets the height of this Size.

Syntax

myObject.setHeight(height);

Arguments

  1. height - (integer) the height

Returns

  • (Size) this Size

width

Returns the width of this Size.

Syntax

myObject.width();

Returns

  • (integer) the width of this Size

height

Returns the height of this Size.

Syntax

myObject.height();

Returns

  • (integer) the height of this Size

Attributes

width

The width of this Size. (integer)

Example

myObject.width = 50;
Console.print(myObject.width);

height

The height of this Size. (integer)

Example

myObject.height = 50;
Console.print(myObject.height);
en/code/core/size.txt · Last modified: 2021/02/13 11:23 by 127.0.0.1