Commit 0340aafa authored by h2b's avatar h2b

Event documentation completed.

parent 505c2b10
......@@ -68,10 +68,20 @@ Various factory methods are provided that construct grid layouts from a sample c
## Events
Since version 1.2.0 an event package is available that constitutes a high-level abstraction of input (e.g., keyboard or mouse) events.
Since version 1.2.0 an event package is available that constitutes a high-level abstraction of input (e.g., keyboard or mouse) events using actor event streams.
Such events, if triggered by the drivers, are published to the global event stream of that package and can be retrieved by subscribing to its `stream` object.
Also, there is a `Subscriber` actor that can be used to handle events. It's companion object defines a `ref` method with a `PartialFunction[Event, Unit]` as parameter that returns an actor reference.
So, for example, you just can write
Subscriber.ref {
case e: Event ⇒ println(e)
}
to print out all occurring events.
To get the triggering enabled, the `withEvents` factory methods of `World` or `Screen` have to be used.
## API
......
......@@ -20,13 +20,31 @@ package de.h2b.scala.lib.simgraf
import akka.actor.{ ActorSystem, Props }
/**
* This package constitutes a high-level abstraction of input (e.g., keyboard
* or mouse) events.
* This package constitutes a high-level abstraction of input (e.g.,
* keyboard or mouse) events using actor event streams.
*
* Such events, if triggered by the drivers, are published to the global
* event stream of this package and can be retrieved by subscribing to the
* `stream` object.
*
* Also, there is a `Subscriber` actor that can be used to handle events.
* It's companion object defines a `ref` method with a
* `PartialFunction[Event, Unit]` as parameter that returns an actor
* reference.
*
* So, for example, you just can write
*
* {{{
* Subscriber.ref {
* case e: Event ⇒ println(e)
* }
* }}}
*
* to print out all occurring events.
*
* To get the triggering enabled, the `withEvents` factory methods of
* `World` or `Screen` have to be used.
*
* @since 1.2.0
* @author h2b
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment