Class: RGSS::Rect
- Inherits:
-
Object
- Object
- RGSS::Rect
- Defined in:
- lib/rgss/stubs/rect.rb
Overview
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
-
#bottom ⇒ Integer
readonly
The location of the bottom edge of the rectangle on the y-axis.
-
#height ⇒ Integer
The size of the rectangle on the y-axis.
-
#left ⇒ Integer
readonly
The location of the left edge of the rectangle on the x-axis.
-
#location ⇒ Point
The location of the top-left corner of the rectangle.
-
#right ⇒ Integer
readonly
The location of the right edge of the rectangle on the x-axis.
-
#size ⇒ Size
The size (width and height) of the rectangle.
-
#top ⇒ Integer
readonly
The location of the top edge of the rectangle on the y-axis.
-
#width ⇒ Integer
The size of the rectangle on the x-axis.
-
#x ⇒ Integer
The location of the top-left corner on the x-axis.
-
#y ⇒ Integer
The location of the top-left corner on the y-axis.
Class Method Summary collapse
-
.empty ⇒ Rect
Creates and returns a new Rect with all values defaulted to
0
. -
.ltrb(left, right, top, bottom) ⇒ Rect
Creates a new Rect by the specified edges.
Instance Method Summary collapse
-
#[](index) ⇒ Integer
Provides access to the rectangle components by index.
-
#[]=(index, value) ⇒ Integer
Provides access to the rectangle components by index.
- #contains?(*args) ⇒ Boolean (also: #include?)
- #empty? ⇒ Boolean
- #inflate(*args) ⇒ Rect
- #inflate!(*args) ⇒ self
-
#initialize(*args) ⇒ Rect
constructor
Creates a new instance of the Rect class.
- #intersect(other) ⇒ Rect
- #intersect!(other) ⇒ self
- #intersects?(other) ⇒ Boolean
- #offset(*args) ⇒ Rect
- #offset!(*args) ⇒ self
- #set(x, y, width, height) ⇒ Object
-
#to_a ⇒ Array(Integer, Integer, Integer, Integer)
Creates an array instance that represents this object.
-
#to_h ⇒ Hash{Symbol => Integer}
Creates a hash instance that represents this object.
Constructor Details
#initialize ⇒ Rect #initialize(location, size) ⇒ Rect #initialize(x, y, width, height) ⇒ Rect
Creates a new instance of the RGSS::Rect class.
175 176 |
# File 'lib/rgss/stubs/rect.rb', line 175 def initialize(*args) end |
Instance Attribute Details
#bottom ⇒ Integer (readonly)
Returns 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 |
#height ⇒ Integer
Returns the size of the rectangle on the y-axis.
125 126 127 |
# File 'lib/rgss/stubs/rect.rb', line 125 def height @height end |
#left ⇒ Integer (readonly)
Returns 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 |
#location ⇒ Point
Returns 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 |
#right ⇒ Integer (readonly)
Returns 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 |
#size ⇒ Size
Returns the size (width and height) of the rectangle.
133 134 135 |
# File 'lib/rgss/stubs/rect.rb', line 133 def size @size end |
#top ⇒ Integer (readonly)
Returns 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 |
#width ⇒ Integer
Returns the size of the rectangle on the x-axis.
121 122 123 |
# File 'lib/rgss/stubs/rect.rb', line 121 def width @width end |
#x ⇒ Integer
Returns 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 |
#y ⇒ Integer
Returns 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
.empty ⇒ Rect
Creates and returns a new RGSS::Rect with all values defaulted to 0
.
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.
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.
195 196 |
# File 'lib/rgss/stubs/rect.rb', line 195 def [](index) end |
#[]=(index, value) ⇒ Integer
Provides access to the rectangle components by index.
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?
227 228 |
# File 'lib/rgss/stubs/rect.rb', line 227 def contains?(*args) end |
#empty? ⇒ Boolean
212 213 |
# File 'lib/rgss/stubs/rect.rb', line 212 def empty? end |
#inflate(x, y) ⇒ Rect #inflate(amount) ⇒ Rect
239 240 |
# File 'lib/rgss/stubs/rect.rb', line 239 def inflate(*args) end |
#inflate!(x, y) ⇒ self #inflate!(amount) ⇒ self
251 252 |
# File 'lib/rgss/stubs/rect.rb', line 251 def inflate!(*args) end |
#intersect!(other) ⇒ self
267 268 |
# File 'lib/rgss/stubs/rect.rb', line 267 def intersect!(other) end |
#intersects?(other) ⇒ Boolean
274 275 |
# File 'lib/rgss/stubs/rect.rb', line 274 def intersects?(other) end |
#offset(x, y) ⇒ Rect #offset(amount) ⇒ Rect
286 287 |
# File 'lib/rgss/stubs/rect.rb', line 286 def offset(*args) end |
#offset(x, y) ⇒ self #offset(amount) ⇒ 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_a ⇒ Array(Integer, Integer, Integer, Integer)
Creates an array instance that represents this object.
304 305 |
# File 'lib/rgss/stubs/rect.rb', line 304 def to_a end |
#to_h ⇒ Hash{Symbol => Integer}
Creates a hash instance that represents this object.
310 311 |
# File 'lib/rgss/stubs/rect.rb', line 310 def to_h end |