Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

oops, actually add the facades

  • Loading branch information...
commit 8f7caaebbcfc018f495708aae1ec6ca0c87baa1a 1 parent ea7436e
@bgoodspeed authored
View
6 lib/facades/event_handler_facade.rb
@@ -0,0 +1,6 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class EventHandlerFacade < Rubygame::EventHandler
+ include Rubygame::EventHandler::HasEventHandler
+end
View
5 lib/facades/event_hook_facade.rb
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class EventHookFacade < Rubygame::EventHook
+end
View
5 lib/facades/key_press_trigger_facade.rb
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class KeyPressTriggerFacade < Rubygame::EventTriggers::KeyPressTrigger
+end
View
5 lib/facades/key_pressed_facade.rb
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class KeyPressedFacade < Rubygame::Events::KeyPressed
+end
View
5 lib/facades/key_release_trigger_facade.rb
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class KeyReleaseTriggerFacade < Rubygame::EventTriggers::KeyReleaseTrigger
+end
View
5 lib/facades/method_action_facade.rb
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class MethodActionFacade < Rubygame::EventActions::MethodAction
+end
View
9 lib/facades/quit_requested_facade.rb
@@ -0,0 +1,9 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class QuitRequestedFacade < Rubygame::Events::QuitRequested
+
+ def self.quit_request_type
+ Rubygame::Events::QuitRequested
+ end
+end
View
5 lib/facades/tick_trigger_facade.rb
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class TickTriggerFacade < Rubygame::EventTriggers::TickTrigger
+end
View
40 lib/factories/trigger_factory.rb
@@ -0,0 +1,40 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class TriggerFactory
+ def initialize
+
+ end
+ def make_event_handler
+ EventHandlerFacade.new
+ end
+ def make_tick_trigger
+ TickTriggerFacade.new
+ end
+ def make_key_press_trigger(key=nil)
+ KeyPressTriggerFacade.new(key)
+ end
+ def make_key_release_trigger
+ KeyReleaseTriggerFacade.new
+ end
+
+ def make_method_action(target)
+ MethodActionFacade.new(target)
+ end
+
+ def map_trigger_type(trigger_type)
+ conf = {}
+ conf[:tick] = make_tick_trigger
+ conf[:key_press] = make_key_press_trigger
+ conf[:key_release] = make_key_release_trigger
+
+ conf[trigger_type]
+ end
+
+ def make_event_hook(owner, trigger_type, action_target)
+ EventHookFacade.new(:owner => owner, :trigger => map_trigger_type(trigger_type), :action => make_method_action(action_target) )
+ end
+ def make_key_press_event_hook(owner, key, action_target)
+ EventHookFacade.new(:owner => owner, :trigger => make_key_press_trigger(key), :action => make_method_action(action_target) )
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.