Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
611 B

  1. package wow.doge.mygame.utils
  2. import akka.actor.typed.Props
  3. import akka.util.Timeout
  4. import akka.actor.typed.Scheduler
  5. import akka.actor.typed.ActorRef
  6. import akka.actor.typed.SpawnProtocol
  7. import akka.actor.typed.Behavior
  8. import wow.doge.mygame.implicits._
  9. object AkkaUtils {
  10. def spawnActorL[T](
  11. spawnProtocol: ActorRef[SpawnProtocol.Command],
  12. actorName: String,
  13. behavior: Behavior[T]
  14. )(implicit timeout: Timeout, scheduler: Scheduler) =
  15. spawnProtocol.askL[ActorRef[T]](
  16. SpawnProtocol.Spawn(
  17. behavior,
  18. actorName,
  19. Props.empty,
  20. _
  21. )
  22. )
  23. }