Table des matières

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

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

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

Example

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

toString

Returns a string representing this Size.

Syntax

myObject.toString();

Returns

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

setHeight

Sets the height of this Size.

Syntax

myObject.setHeight(height);

Arguments

  1. height - (integer) the height

Returns

width

Returns the width of this Size.

Syntax

myObject.width();

Returns

height

Returns the height of this Size.

Syntax

myObject.height();

Returns

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);