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