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
1000 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
import akka.actor.typed._
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[MyFxApp] }
} yield (app))(app => logger.info("Stopping FX Application"))
}
object UiModule {
def makePrimaryStage(
backend: AppTypes.HttpBackend,
actorSystem: ActorSystem[SpawnProtocol.Command]
) = {
new PrimaryStage {
scene = new DefaultUI().scene
}
}
}