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

  1. package wow.doge.mygame.game.subsystems.ui
  2. import com.jme3.app.Application
  3. import com.jayfella.jme.jfx.JavaFxUI
  4. import scalafx.application.Platform
  5. import monix.execution.CancelablePromise
  6. import monix.bio.Task
  7. import cats.effect.concurrent.Deferred
  8. import scala.concurrent.duration._
  9. import wow.doge.mygame.game.GameApp
  10. object JFxUI {
  11. def apply(app: GameApp) =
  12. Task(JavaFxUI.initialize(app))
  13. .executeOn(app.scheduler) >> Task.sleep(500.millis) >> Task(
  14. JavaFxUI.getInstance()
  15. )
  16. // Task {
  17. // Platform.runLater(() => {
  18. // println("here jfx")
  19. // JavaFxUI.initialize(app)
  20. // println("here2 jfx2")
  21. // val inst = JavaFxUI.getInstance()
  22. // println(inst)
  23. // })
  24. // }
  25. // Task.fromFuture {
  26. // val p = CancelablePromise[JavaFxUI]()
  27. // Platform.runLater(() => {
  28. // println("here")
  29. // JavaFxUI.initialize(app)
  30. // println("here2")
  31. // val inst = JavaFxUI.getInstance()
  32. // println(inst)
  33. // p.success(inst)
  34. // })
  35. // p.future
  36. // }
  37. // for {
  38. // d <- Deferred[Task, JavaFxUI]
  39. // _ <- Task(JavaFxUI.initialize(app))
  40. // } yield ()
  41. }