summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2008-12-23 12:38:56 (GMT)
committer Jaromil <jaromil@dyne.org>2008-12-23 12:38:56 (GMT)
commit25b3f1e1f0fbf521415ce537821a8eb211c9c058 (patch)
tree62b62b20476f7d2fe1e25b566e459427729261db
parent1ecc07b294c344bfd2f0bdc47aa4b8e67ea5a31b (diff)
controller (callback) examples refined
-rw-r--r--freej/python/controller.src28
-rw-r--r--freej/ruby/controller.src11
2 files changed, 33 insertions, 6 deletions
diff --git a/freej/python/controller.src b/freej/python/controller.src
index b9c25b4..25de8e4 100644
--- a/freej/python/controller.src
+++ b/freej/python/controller.src
@@ -1,6 +1,32 @@
+import threading
+import freej
+cx = freej.Context()
+cx.init(400,300,0,0)
-TODO: still missing
+class Frame(freej.TriggerController):
+ def __init__(self, *args):
+ super(Frame, self).__init__(*args)
+# to be removed (bugfix of activate in controller)
+ def activate(self):
+ self.active = True
+
+
+ def dispatch(self):
+ print "dispatch callback activated"
+
+# please note the following return: is needed
+# at the end of the function, else Ruby will
+# return an exception and bail out
+
+ return 1
+
+
+f = Frame()
+cx.register_controller(f)
+
+th = threading.Thread(target = cx.start , name = "freej")
+th.start();
diff --git a/freej/ruby/controller.src b/freej/ruby/controller.src
index 6d459f5..52eeff2 100644
--- a/freej/ruby/controller.src
+++ b/freej/ruby/controller.src
@@ -4,18 +4,19 @@ require 'Freej'
cx = Freej::Context.new
cx.init(400,300,0,0)
-class Frame < Freej::TriggerCtrl
+class Frame < Freej::TriggerController
-def dispatch
+ def dispatch
- puts("dispatch callback activated")
+ puts("dispatch callback activated")
# please note the following return: is needed
# at the end of the function, else Ruby will
# return an exception and bail out
- return(1)
-end
+ return(1)
+
+ end
end
f = Frame.new