Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Size

Size containing widht and height

Hierarchy

  • Size

Implements

Index

Constructors

constructor

  • new Size(width: number, height: number): Size
  • Creates a Size object from the given width and height (floats).

    Parameters

    • width: number

      width of the new size

    • height: number

      height of the new size

    Returns Size

Properties

height

height: number

Height

width

width: number

Width

Accessors

surface

  • get surface(): number
  • The surface of the Size : width * height (float).

    Returns number

Methods

add

  • Sums the width and height of two sizes

    Parameters

    • otherSize: Size

      size to add to this size

    Returns Size

    a new Size set as the addition result of the current Size and the given one.

clone

  • Clones the size

    Returns Size

    a new Size copied from the given one.

copyFrom

  • copyFrom(src: Size): void
  • Updates the current size from the given one.

    Parameters

    • src: Size

      the given size

    Returns void

copyFromFloats

  • copyFromFloats(width: number, height: number): Size
  • Updates in place the current Size from the given floats.

    Parameters

    • width: number

      width of the new size

    • height: number

      height of the new size

    Returns Size

    the updated Size.

equals

  • equals(other: Size): boolean
  • True if the current Size and the given one width and height are strictly equal.

    Parameters

    • other: Size

      the other size to compare against

    Returns boolean

    True if the current Size and the given one width and height are strictly equal.

getClassName

  • getClassName(): string
  • "Size"

    Returns string

    the string "Size"

getHashCode

  • getHashCode(): number
  • Returns the Size hash code.

    Returns number

    a hash code for a unique width and height

multiplyByFloats

  • multiplyByFloats(w: number, h: number): Size
  • Multiplies the width and height by numbers

    Parameters

    • w: number

      factor to multiple the width by

    • h: number

      factor to multiple the height by

    Returns Size

    a new Size set with the multiplication result of the current Size and the given floats.

set

  • set(width: number, height: number): Size
  • Updates in place the current Size from the given floats.

    Parameters

    • width: number

      width to set

    • height: number

      height to set

    Returns Size

    the updated Size.

subtract

  • Subtracts the width and height of two

    Parameters

    • otherSize: Size

      size to subtract to this size

    Returns Size

    a new Size set as the subtraction result of the given one from the current Size.

toJSON

  • toJSON(): { height: number; width: number }
  • Returns a JSON representation of this vector. This is necessary due to the way Actors detect changes on components like the actor's transform. They do this by adding properties for observation, and we don't want these properties serialized.

    Returns { height: number; width: number }

    • height: number
    • width: number

toString

  • toString(): string
  • Returns a string with the Size width and height

    Returns string

    a string with the Size width and height

Static Lerp

  • Creates a new Size set at the linear interpolation "amount" between "start" and "end"

    Parameters

    • start: Size

      starting size to lerp between

    • end: Size

      end size to lerp between

    • amount: number

      amount to lerp between the start and end values

    Returns Size

    a new Size set at the linear interpolation "amount" between "start" and "end"

Static Zero

  • Create a new size of zero

    Returns Size

    a new Size set to (0.0, 0.0)