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.

37 lines
997 B

  1. package nova.monadic_sfx.ui
  2. import akka.actor.typed._
  3. import cats.effect.Resource
  4. import com.softwaremill.macwire._
  5. import io.odin.Logger
  6. import monix.eval.Task
  7. import nova.monadic_sfx.AppTypes
  8. import nova.monadic_sfx.executors.Schedulers
  9. import nova.monadic_sfx.http.Requesters
  10. import scalafx.application.JFXApp
  11. import scalafx.application.JFXApp.PrimaryStage
  12. trait UiModule {
  13. def fxAppResource(
  14. logger: Logger[Task],
  15. backend: AppTypes.HttpBackend,
  16. actorSystem: ActorSystem[SpawnProtocol.Command],
  17. requesters: Requesters,
  18. schedulers: Schedulers
  19. ): Resource[Task, JFXApp] =
  20. Resource.make(for {
  21. _ <- logger.info("Creating FX Application")
  22. app <- Task { wire[MyFxAppOld] }
  23. } yield (app))(app => logger.info("Stopping FX Application"))
  24. }
  25. object UiModule {
  26. def makePrimaryStage(
  27. backend: AppTypes.HttpBackend,
  28. actorSystem: ActorSystem[SpawnProtocol.Command]
  29. ) = {
  30. new PrimaryStage {
  31. scene = DefaultUI.scene
  32. }
  33. }
  34. }