Class: Rect
- Inherits:
-
Object
- Object
- Rect
- Extended by:
- RgssDb::JsonableConstructor
- Includes:
- RgssDb::Jsonable
- Defined in:
- lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb,
lib/rgss_db/model/rpg_maker_data/xp/rgss/rect.rb,
lib/rgss_db/model/rpg_maker_data/vx_ace/rgss/rect.rb
Overview
The rectangle class.
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
-
._load(serialized_string) ⇒ Rect
Creates a new instance using the given binary data.
-
.new_serialized(serialized_string) ⇒ Rect
Creates a new instance from a serialized string.
Instance Method Summary collapse
-
#_dump ⇒ String
Dumps this instance into a binary string.
-
#initialize(x = 0, y = 0, width = 0, height = 0) ⇒ Rect
constructor
Creates a new Rect object.
Methods included from RgssDb::JsonableConstructor
Methods included from RgssDb::Jsonable
Constructor Details
#initialize(x = 0, y = 0, width = 0, height = 0) ⇒ Rect
Creates a new Rect object.
The default values when no arguments are specified are (0, 0, 0, 0).
20 21 22 23 24 25 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 20 def initialize(x = 0, y = 0, width = 0, height = 0) @x = x @y = y @width = width @height = height end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
69 70 71 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 69 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
69 70 71 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 69 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
69 70 71 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 69 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
69 70 71 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 69 def y @y end |
Class Method Details
._load(serialized_string) ⇒ Rect
Creates a new instance using the given binary data
Note: needed for Marshal module support
48 49 50 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 48 def self._load(serialized_string) Rect.new_serialized(serialized_string) end |
.new_serialized(serialized_string) ⇒ Rect
Creates a new instance from a serialized string
Note: needed for Marshal module support
61 62 63 64 65 66 67 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 61 def self.new_serialized(serialized_string) # int32_t, int32_t, int32_t, int32_t x, y, width, height = serialized_string.unpack("llll") # Creates the instance Rect.new(x, y, width, height) end |
Instance Method Details
#_dump ⇒ String
Dumps this instance into a binary string
Note: needed for Marshal module support
34 35 36 37 |
# File 'lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb', line 34 def _dump(*) # int32_t, int32_t, int32_t, int32_t [@x, @y, @width, @height].pack("llll") end |