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.
 
 

43 lines
1.1 KiB

package wow.doge.mygame.game.subsystems.ui
import com.jme3.app.Application
import com.jayfella.jme.jfx.JavaFxUI
import scalafx.application.Platform
import monix.execution.CancelablePromise
import monix.bio.Task
import cats.effect.concurrent.Deferred
import scala.concurrent.duration._
import wow.doge.mygame.game.GameApp
object JFxUI {
def apply(app: GameApp) =
Task(JavaFxUI.initialize(app))
.executeOn(app.scheduler) >> Task.sleep(500.millis) >> Task(
JavaFxUI.getInstance()
)
// Task {
// Platform.runLater(() => {
// println("here jfx")
// JavaFxUI.initialize(app)
// println("here2 jfx2")
// val inst = JavaFxUI.getInstance()
// println(inst)
// })
// }
// Task.fromFuture {
// val p = CancelablePromise[JavaFxUI]()
// Platform.runLater(() => {
// println("here")
// JavaFxUI.initialize(app)
// println("here2")
// val inst = JavaFxUI.getInstance()
// println(inst)
// p.success(inst)
// })
// p.future
// }
// for {
// d <- Deferred[Task, JavaFxUI]
// _ <- Task(JavaFxUI.initialize(app))
// } yield ()
}