Class: Osb::Group
- Inherits:
-
Object
- Object
- Osb::Group
- Defined in:
- lib/osb/storyboard.rb
Overview
When designing storyboard, we often want to group storyboard elements that are used in a similar context (eg. a scene), so this class' purpose is only to act as a container. You can add every element directly to the Storyboard object, but we recommend you to split the project into multiple Group so it will be easier to manage. A Group can have multiple nested Groups in itself.
Instance Method Summary collapse
-
#<<(object) ⇒ self
Alias for #add.
- #add(object) ⇒ self
-
#initialize ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize ⇒ Group
Returns a new instance of Group.
78 79 80 |
# File 'lib/osb/storyboard.rb', line 78 def initialize @layers = Internal::LayerManager.new end |
Instance Method Details
#<<(object) ⇒ self
Alias for #add. Add a Sprite, Animation, Sample or Osb::Group to this group.
115 116 117 |
# File 'lib/osb/storyboard.rb', line 115 def <<(object) self.add(object) end |
#add(object) ⇒ self
Add an Sprite, Animation, Sample or Osb::Group to this group.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/osb/storyboard.rb', line 86 def add(object) Internal.assert_type!( object, [ Osb::Group, Osb::Sprite, Osb::Animation, Osb::Sample, Osb::Video, Osb::Background ], "object" ) case object when Osb::Sprite, Osb::Animation, Osb::Sample @layers.add(object) when Osb::Group @layers.concat(object) end return self end |