Permalink
Browse files

oops, actually add the facades

  • Loading branch information...
1 parent ea7436e commit 8f7caaebbcfc018f495708aae1ec6ca0c87baa1a @bgoodspeed committed Nov 7, 2010
@@ -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
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class EventHookFacade < Rubygame::EventHook
+end
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class KeyPressTriggerFacade < Rubygame::EventTriggers::KeyPressTrigger
+end
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class KeyPressedFacade < Rubygame::Events::KeyPressed
+end
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class KeyReleaseTriggerFacade < Rubygame::EventTriggers::KeyReleaseTrigger
+end
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class MethodActionFacade < Rubygame::EventActions::MethodAction
+end
@@ -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
@@ -0,0 +1,5 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+class TickTriggerFacade < Rubygame::EventTriggers::TickTrigger
+end
@@ -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

0 comments on commit 8f7caae

Please sign in to comment.