Class: LiteRGSS::Rect

Inherits:
Object
  • Object
show all
Defined in:
LiteRGSS.rb

Overview

Class that defines a rectangular surface of a Graphical element

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#new(width, height) ⇒ Rect #new(x, width, height) ⇒ Rect #new(x, y, width, height) ⇒ Rect

Create a new surface

Parameters:

  • x (Integer)

    x position of the surface

  • y (Integer)

    y position of the surface

  • width (Integer)

    width of the surface

  • height (Integer)

    height of the surface

Instance Attribute Details

#heightInteger

height of the surface

Returns:

  • (Integer)

#widthInteger

width of the surface

Returns:

  • (Integer)

#xInteger

x position of the surface

Returns:

  • (Integer)

#yInteger

y position of the surface

Returns:

  • (Integer)

Class Method Details

._load(str) ⇒ Rect

Load a rect from a serialized rect

Parameters:

  • str (String)

    the serialized rect

Returns:

Instance Method Details

#_dump(limit) ⇒ String

Serialize the rect

Parameters:

  • limit (Object)

    ignored

Returns:

  • (String)

    serialization of the rect

#emptyself

Set all the rect coordinates to 0

Returns:

  • (self)

#eql?(rect) ⇒ Boolean Also known as: ==, ===

Test if the Rect is equal to an other Rect

Parameters:

  • rect (Rect)

    the other rect

Returns:

  • (Boolean)

#set(x, y = nil, width = nil, height = nil) ⇒ self

Set the parameters of the surface

Parameters:

  • x (Integer, nil)

    x position of the surface

  • y (Integer, nil) (defaults to: nil)

    y position of the surface

  • width (Integer, nil) (defaults to: nil)

    width of the surface

  • height (Integer, nil) (defaults to: nil)

    height of the surface

Returns:

  • (self)

#to_sString Also known as: inspect

Convert the rect to a string that can be shown to the user

Returns:

  • (String)

    (x, y, width, height)