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 the elements directly to the Osb::Storyboard
object, but we recommend you to split the project into multiple Osb::Group
so it will be easier to manage.
Instance Method Summary collapse
-
#<<(object) ⇒ self
Add an
Osb::Sprite
,Osb::Animation
,Osb::Sample
orOsb::Group
to this group. -
#add(object) ⇒ self
Add an
Osb::Sprite
,Osb::Animation
,Osb::Sample
orOsb::Group
to this group. -
#initialize ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize ⇒ Group
Returns a new instance of Group.
77 78 79 |
# File 'lib/osb/storyboard.rb', line 77 def initialize @layers = Internal::LayerManager.new end |
Instance Method Details
#<<(object) ⇒ self
Add an Osb::Sprite
, Osb::Animation
, Osb::Sample
or Osb::Group
to this group. Alias for #add
.
113 114 115 |
# File 'lib/osb/storyboard.rb', line 113 def <<(object) self.add(object) end |
#add(object) ⇒ self
Add an Osb::Sprite
, Osb::Animation
, Osb::Sample
or Osb::Group
to this group.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/osb/storyboard.rb', line 85 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 |