Class: MG::Size

Inherits:
Object
  • Object
show all
Defined in:
motion-game

Overview

A size represents the dimensions of width and height of an object.

When calling a method that expects a Size object, a 2-element Array can be passed instead, as a convenience shortcut. For example,

node.size = [200, 400]

is the same as

size = MG::Size.new
size.x = 200
size.y = 400
node.size = size

Properties (collapse)

Helpers (collapse)

Instance Attribute Details

- (Float) height

Returns the size height.

Returns:

  • (Float)

    the size height.



604
605
606
# File 'motion-game', line 604

def height
  @height
end

- (Float) width

Returns the size width.

Returns:

  • (Float)

    the size width.



601
602
603
# File 'motion-game', line 601

def width
  @width
end

Instance Method Details

- (Size) *(delta)

Multiplies the dimensions of the receiver with the given number.

Parameters:

  • delta (Float)

    the number to multiply the receiver with.

Returns:

  • (Size)

    a new Size object.



629
# File 'motion-game', line 629

def *(delta); end

- (Size) +(size)

Adds the dimensions of the receiver with the dimensions of the given size object.

Parameters:

Returns:

  • (Size)

    a new Size object.



613
# File 'motion-game', line 613

def +(size); end

- (Size) -(size)

Substracts the dimensions of the receiver with the dimensions of the given size object.

Parameters:

Returns:

  • (Size)

    a new Size object.



619
# File 'motion-game', line 619

def -(size); end

- (Size) /(delta)

Divides the dimensions of the receiver with the given number.

Parameters:

  • delta (Float)

    the number to divide the receiver with.

Returns:

  • (Size)

    a new Size object.



624
# File 'motion-game', line 624

def /(delta); end