summaryrefslogtreecommitdiff
path: root/src/main/scala/graphyx/actors/GUIActor.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/graphyx/actors/GUIActor.scala')
-rw-r--r--src/main/scala/graphyx/actors/GUIActor.scala36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/scala/graphyx/actors/GUIActor.scala b/src/main/scala/graphyx/actors/GUIActor.scala
new file mode 100644
index 0000000..cbfb1c2
--- /dev/null
+++ b/src/main/scala/graphyx/actors/GUIActor.scala
@@ -0,0 +1,36 @@
+/*
+ * Graphyx
+ * copyright (c) 2009 Jakob Odersky
+ * made available under the MIT License
+*/
+
+package graphyx.actors
+
+import akka.actor._
+import graphyx.graphics._
+
+class GUIActor extends Actor{
+ val container = new graphyx.gui.Container
+
+ override def preStart() = {
+ container.show()
+ println("GUI actor started.")
+ }
+
+ def receive = {
+ case s @ Scene(_) => container.update(s)
+ case other => println("Engine received unknown command: " + other)
+ }
+
+ override def postStop() = {
+ container.exitGUI()
+ println("GUI actor exited.")
+ }
+
+}
+
+object GUIActor {
+
+ def apply() = Props(classOf[GUIActor])
+
+}