Class: RGSS::Rect

Inherits:
Object
  • Object
show all
Defined in:
lib/rgss/stubs/rect.rb

Overview

Note:

All relevant methods implemented in Object (i.e. #dup, #clone, Marshalling, equality) have also been properly implemented/overridden, but have been omitted from the documentation for brevity.

Stores a set of four integers that represent the location and size of a rectangle, with the top-left at 0, 0.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRect #initialize(location, size) ⇒ Rect #initialize(x, y, width, height) ⇒ Rect

Creates a new instance of the RGSS::Rect class.

Overloads:

  • #initializeRect

    Creates a new empty rectangle.

  • #initialize(location, size) ⇒ Rect

    Creates a new rectangle with the specified location and size.

    Parameters:

  • #initialize(x, y, width, height) ⇒ Rect

    Creates a new rectangle with the specified dimensions.

    Parameters:

    • x (Numeric)
    • y (Numeric)
    • width (Numeric)
    • height (Numeric)

175
176
# File 'lib/rgss/stubs/rect.rb', line 175

def initialize(*args)
end

Instance Attribute Details

#bottomInteger (readonly)

Returns the location of the bottom edge of the rectangle on the y-axis.

Returns:

  • (Integer)

    the location of the bottom edge of the rectangle on the y-axis.


149
150
151
# File 'lib/rgss/stubs/rect.rb', line 149

def bottom
  @bottom
end

#heightInteger

Returns the size of the rectangle on the y-axis.

Returns:

  • (Integer)

    the size of the rectangle on the y-axis.


125
126
127
# File 'lib/rgss/stubs/rect.rb', line 125

def height
  @height
end

#leftInteger (readonly)

Returns the location of the left edge of the rectangle on the x-axis.

Returns:

  • (Integer)

    the location of the left edge of the rectangle on the x-axis.


137
138
139
# File 'lib/rgss/stubs/rect.rb', line 137

def left
  @left
end

#locationPoint

Returns the location of the top-left corner of the rectangle.

Returns:

  • (Point)

    the location of the top-left corner of the rectangle.


129
130
131
# File 'lib/rgss/stubs/rect.rb', line 129

def location
  @location
end

#rightInteger (readonly)

Returns the location of the right edge of the rectangle on the x-axis.

Returns:

  • (Integer)

    the location of the right edge of the rectangle on the x-axis.


145
146
147
# File 'lib/rgss/stubs/rect.rb', line 145

def right
  @right
end

#sizeSize

Returns the size (width and height) of the rectangle.

Returns:

  • (Size)

    the size (width and height) of the rectangle.


133
134
135
# File 'lib/rgss/stubs/rect.rb', line 133

def size
  @size
end

#topInteger (readonly)

Returns the location of the top edge of the rectangle on the y-axis.

Returns:

  • (Integer)

    the location of the top edge of the rectangle on the y-axis.


141
142
143
# File 'lib/rgss/stubs/rect.rb', line 141

def top
  @top
end

#widthInteger

Returns the size of the rectangle on the x-axis.

Returns:

  • (Integer)

    the size of the rectangle on the x-axis.


121
122
123
# File 'lib/rgss/stubs/rect.rb', line 121

def width
  @width
end

#xInteger

Returns the location of the top-left corner on the x-axis.

Returns:

  • (Integer)

    the location of the top-left corner on the x-axis.


113
114
115
# File 'lib/rgss/stubs/rect.rb', line 113

def x
  @x
end

#yInteger

Returns the location of the top-left corner on the y-axis.

Returns:

  • (Integer)

    the location of the top-left corner on the y-axis.


117
118
119
# File 'lib/rgss/stubs/rect.rb', line 117

def y
  @y
end

Class Method Details

.emptyRect

Creates and returns a new RGSS::Rect with all values defaulted to 0.

Returns:

  • (Rect)

    The newly created rectangle.


155
156
# File 'lib/rgss/stubs/rect.rb', line 155

def self.empty
end

.ltrb(left, right, top, bottom) ⇒ Rect

Creates a new RGSS::Rect by the specified edges.

Parameters:

  • left (Numeric)

    the location of the rectangles left edge on the x-axis.

  • top (Numeric)

    the location of the rectangles top edge on the y-axis.

  • right (Numeric)

    the location of the rectangles right edge on the x-axis.

  • bottom (Numeric)

    the location of the rectangles bottom edge on the y-axis.

Returns:


187
188
# File 'lib/rgss/stubs/rect.rb', line 187

def self.ltrb(left, right, top, bottom)
end

Instance Method Details

#[](index) ⇒ Integer

Provides access to the rectangle components by index.

Parameters:

  • index (Numeric)

    the index of the component (x, y, width, height) to retrieve.

Returns:

  • (Integer)

    the value of the specified component.

Raises:

  • (IndexError)

    if index is less than 0 or greater than 3.


195
196
# File 'lib/rgss/stubs/rect.rb', line 195

def [](index)
end

#[]=(index, value) ⇒ Integer

Provides access to the rectangle components by index.

Parameters:

  • index (Numeric)

    the index of the component (x, y, width, height) to set.

Returns:

  • (Integer)

    the value that was set.

Raises:

  • (IndexError)

    if index is less than 0 or greater than 3.


203
204
# File 'lib/rgss/stubs/rect.rb', line 203

def []=(index, value)
end

#contains?(x, y) ⇒ Boolean #contains?(point) ⇒ Boolean #contains?(rect) ⇒ Boolean Also known as: include?

Overloads:

  • #contains?(x, y) ⇒ Boolean

    Parameters:

    • x (Numeric)
    • y (Numeric)
  • #contains?(point) ⇒ Boolean

    Parameters:

  • #contains?(rect) ⇒ Boolean

    Parameters:

Returns:

  • (Boolean)

227
228
# File 'lib/rgss/stubs/rect.rb', line 227

def contains?(*args)
end

#empty?Boolean

Returns:

  • (Boolean)

212
213
# File 'lib/rgss/stubs/rect.rb', line 212

def empty?
end

#inflate(x, y) ⇒ Rect #inflate(amount) ⇒ Rect

Overloads:

  • #inflate(x, y) ⇒ Rect

    Parameters:

    • x (Numeric)
    • y (Numeric)
  • #inflate(amount) ⇒ Rect

    Parameters:

Returns:


239
240
# File 'lib/rgss/stubs/rect.rb', line 239

def inflate(*args)
end

#inflate!(x, y) ⇒ self #inflate!(amount) ⇒ self

Overloads:

  • #inflate!(x, y) ⇒ self

    Parameters:

    • x (Numeric)
    • y (Numeric)
  • #inflate!(amount) ⇒ self

    Parameters:

Returns:

  • (self)

251
252
# File 'lib/rgss/stubs/rect.rb', line 251

def inflate!(*args)
end

#intersect(other) ⇒ Rect

Parameters:

Returns:


259
260
# File 'lib/rgss/stubs/rect.rb', line 259

def intersect(other)
end

#intersect!(other) ⇒ self

Parameters:

Returns:

  • (self)

267
268
# File 'lib/rgss/stubs/rect.rb', line 267

def intersect!(other)
end

#intersects?(other) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)

274
275
# File 'lib/rgss/stubs/rect.rb', line 274

def intersects?(other)
end

#offset(x, y) ⇒ Rect #offset(amount) ⇒ Rect

Overloads:

  • #offset(x, y) ⇒ Rect

    Parameters:

    • x (Numeric)
    • y (Numeric)
  • #offset(amount) ⇒ Rect

    Parameters:

Returns:


286
287
# File 'lib/rgss/stubs/rect.rb', line 286

def offset(*args)
end

#offset(x, y) ⇒ self #offset(amount) ⇒ self

Overloads:

  • #offset(x, y) ⇒ self

    Parameters:

    • x (Numeric)
    • y (Numeric)
  • #offset(amount) ⇒ self

    Parameters:

Returns:

  • (self)

298
299
# File 'lib/rgss/stubs/rect.rb', line 298

def offset!(*args)
end

#set(x, y, width, height) ⇒ Object


206
207
# File 'lib/rgss/stubs/rect.rb', line 206

def set(x, y, width, height)
end

#to_aArray(Integer, Integer, Integer, Integer)

Creates an array instance that represents this object.

Returns:

  • (Array(Integer, Integer, Integer, Integer))

    The newly created Array.


304
305
# File 'lib/rgss/stubs/rect.rb', line 304

def to_a
end

#to_hHash{Symbol => Integer}

Creates a hash instance that represents this object.

Returns:

  • (Hash{Symbol => Integer})

    The newly created Hash.


310
311
# File 'lib/rgss/stubs/rect.rb', line 310

def to_h
end