Class: GamesAndRpgParadise::Graphics
- Inherits:
-
Object
- Object
- GamesAndRpgParadise::Graphics
- Defined in:
- lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics.rb,
lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics/game_over.rb,
lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics/score/placeholder.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#logic ⇒ Object
Returns the value of attribute logic.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Instance Method Summary collapse
- #add(key, graphic) ⇒ Object
-
#initialize(logic:) ⇒ Graphics
constructor
A new instance of Graphics.
- #update! ⇒ Object
Constructor Details
#initialize(logic:) ⇒ Graphics
Returns a new instance of Graphics.
12 13 14 15 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics.rb', line 12 def initialize(logic:) @objects = {} @logic = logic end |
Instance Attribute Details
#logic ⇒ Object
Returns the value of attribute logic.
9 10 11 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics.rb', line 9 def logic @logic end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
10 11 12 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics.rb', line 10 def objects @objects end |
Instance Method Details
#add(key, graphic) ⇒ Object
17 18 19 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics.rb', line 17 def add(key, graphic) @objects[key] = graphic end |
#update! ⇒ Object
21 22 23 24 25 26 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics.rb', line 21 def update! objects.each_pair { |id, object| next unless logic[id] && object.respond_to?(:update!) object.update!(logic[id]) } end |