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.

59 lines
1.9 KiB

  1. // package wow.doge.mygame.subsystems.events
  2. // import akka.actor.typed.ActorRef
  3. // import akka.actor.typed.SpawnProtocol
  4. // import wow.doge.mygame.implicits._
  5. // import akka.actor.typed.Props
  6. // import akka.actor.typed.LogOptions
  7. // import com.typesafe.scalalogging.{Logger => SLLogger}
  8. // import wow.doge.mygame.events.EventBus
  9. // import akka.actor.typed.scaladsl.Behaviors
  10. // import wow.doge.mygame.events.Events
  11. // import cats.effect.Resource
  12. // import monix.bio.Task
  13. // import akka.actor.typed.ActorSystem
  14. // import scala.concurrent.duration._
  15. // trait EventsModule2 {
  16. // def eventBusesResource(
  17. // spawnProtocol: ActorSystem[SpawnProtocol.Command],
  18. // eventBusLogger: com.typesafe.scalalogging.Logger = SLLogger[EventBus[_]]
  19. // ): Resource[
  20. // Task,
  21. // (
  22. // ActorRef[EventBus.Command[Events.Tick]],
  23. // ActorRef[EventBus.Command[Events.Movement.PlayerMovement]]
  24. // )
  25. // ] = {
  26. // def createEventBus[T](busName: String) =
  27. // spawnProtocol.askL(
  28. // SpawnProtocol.Spawn[EventBus.Command[T]](
  29. // Behaviors.logMessages(
  30. // logOptions = LogOptions().withLogger(eventBusLogger.underlying),
  31. // EventBus[T]()
  32. // ),
  33. // busName,
  34. // Props.empty,
  35. // _
  36. // )
  37. // )(1.second, spawnProtocol.scheduler)
  38. // Resource.liftF {
  39. // {
  40. // lazy val tickEventBusTask = createEventBus[Events.Tick]("tickEventBus")
  41. // lazy val playerMovementEventBusTask =
  42. // createEventBus[Events.Movement.PlayerMovement]("movementEventBus")
  43. // // val r = (tickEventBusTask, playerMovementEventBusTask)
  44. // // Task(r)
  45. // for {
  46. // tickEventBus <- tickEventBusTask
  47. // playerMovementEventBus <- playerMovementEventBusTask
  48. // } yield (tickEventBus, playerMovementEventBus)
  49. // }
  50. // }
  51. // }
  52. // }