summaryrefslogtreecommitdiff
path: root/src/main/scala/graphyx/actors/GUIActor.scala
blob: cbfb1c208ea0580a3692bf0e2856999ee24cc298 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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])

}