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
37 lines
997 B
package nova.monadic_sfx.ui
|
|
|
|
import akka.actor.typed._
|
|
import cats.effect.Resource
|
|
import com.softwaremill.macwire._
|
|
import io.odin.Logger
|
|
import monix.eval.Task
|
|
import nova.monadic_sfx.AppTypes
|
|
import nova.monadic_sfx.executors.Schedulers
|
|
import nova.monadic_sfx.http.Requesters
|
|
import scalafx.application.JFXApp
|
|
import scalafx.application.JFXApp.PrimaryStage
|
|
|
|
trait UiModule {
|
|
def fxAppResource(
|
|
logger: Logger[Task],
|
|
backend: AppTypes.HttpBackend,
|
|
actorSystem: ActorSystem[SpawnProtocol.Command],
|
|
requesters: Requesters,
|
|
schedulers: Schedulers
|
|
): Resource[Task, JFXApp] =
|
|
Resource.make(for {
|
|
_ <- logger.info("Creating FX Application")
|
|
app <- Task { wire[MyFxAppOld] }
|
|
} yield (app))(app => logger.info("Stopping FX Application"))
|
|
}
|
|
|
|
object UiModule {
|
|
def makePrimaryStage(
|
|
backend: AppTypes.HttpBackend,
|
|
actorSystem: ActorSystem[SpawnProtocol.Command]
|
|
) = {
|
|
new PrimaryStage {
|
|
scene = DefaultUI.scene
|
|
}
|
|
}
|
|
}
|