Class: Rubygoo::RubygameAppAdapter
- Inherits:
-
Object
- Object
- Rubygoo::RubygameAppAdapter
- Defined in:
- lib/rubygoo/adapters/rubygame_app_adapter.rb
Instance Method Summary collapse
- #draw(target) ⇒ Object
-
#initialize(app) ⇒ RubygameAppAdapter
constructor
A new instance of RubygameAppAdapter.
-
#on_event(event) ⇒ Object
TODO convert keys?!?.
- #update(time) ⇒ Object
Constructor Details
#initialize(app) ⇒ RubygameAppAdapter
Returns a new instance of RubygameAppAdapter.
10 11 12 |
# File 'lib/rubygoo/adapters/rubygame_app_adapter.rb', line 10 def initialize(app) @app = app end |
Instance Method Details
#draw(target) ⇒ Object
18 19 20 |
# File 'lib/rubygoo/adapters/rubygame_app_adapter.rb', line 18 def draw(target) @app.draw target end |
#on_event(event) ⇒ Object
TODO convert keys?!?
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rubygoo/adapters/rubygame_app_adapter.rb', line 23 def on_event(event) case event when KeyUpEvent @app.on_event GooEvent.new(:key_released, { :key => event.key, :mods => event.mods, :string => event.string}) when KeyDownEvent @app.on_event GooEvent.new(:key_pressed, { :key => event.key, :mods => event.mods, :string => event.string}) when MouseUpEvent @app.on_event GooEvent.new(:mouse_up, { :x => event.pos[0], :y => event.pos[1], :button => event.}) when MouseDownEvent @app.on_event GooEvent.new(:mouse_down, { :x => event.pos[0], :y => event.pos[1], :button => event.}) when MouseMotionEvent @app.on_event GooEvent.new(:mouse_motion, { :x => event.pos[0], :y => event.pos[1]}) end end |
#update(time) ⇒ Object
14 15 16 |
# File 'lib/rubygoo/adapters/rubygame_app_adapter.rb', line 14 def update(time) @app.update time end |