Execute on called at one place instead of many

This commit is contained in:
Rohan Sircar 2021-01-10 12:36:04 +05:30
parent 6ccbf7e11d
commit 978215b510
3 changed files with 44 additions and 53 deletions

View File

@ -101,7 +101,10 @@ class MainApp(
bulletAppState <- Task(new BulletAppState())
_ <- Task(stateManager.attach(bulletAppState))
_ <- logger.info("Initializing console stream")
_ <- wire[MainAppDelegate].init(gameApp.scheduler)
_ <-
wire[MainAppDelegate]
.init(gameApp.scheduler)
.executeOn(gameApp.scheduler)
} yield gameAppFib
}
@ -165,7 +168,6 @@ class MainAppDelegate(
rootNode,
bulletAppState.physicsSpace
)
.executeOn(appScheduler)
_ <- createPlayerController(appScheduler)
.absorbWith(e => DummyException("boom"))
.onErrorRestart(3)
@ -240,22 +242,11 @@ class MainAppDelegate(
def createTestNpc(
appScheduler: monix.execution.Scheduler,
npcName: String
) =
// : IO[PlayerController.Error, Unit] =
{
) = {
val initialPos = ImVector3f(50, 5, 0)
// val modelPath = os.rel / "Models" / "Jaime" / "Jaime.j3o"
val npcPhysicsControl = new BetterCharacterControl(1.5f, 6f, 1f)
// (1f, 2.1f, 10f)
.withJumpForce(ImVector3f(0, 5f, 0))
// val npcMovementActor = AkkaUtils.spawnActorL2(
// new NpcMovementActor2.Props(
// initialPos,
// tickEventBus,
// npcPhysicsControl
// ).behavior,
// s"${npcName}-npcMovementActor"
// )
val mbNpcNode = PlayerController.Defaults.defaultNpcNode(
assetManager,
initialPos,

View File

@ -93,7 +93,7 @@ object GameApp {
def resource(
logger: Logger[Task],
jmeScheduler: Scheduler,
jmeThread: Scheduler,
schedulers: Schedulers
) =
Resource.make(
@ -112,7 +112,7 @@ object GameApp {
app.setSettings(settings)
}
gameApp <- Task(new GameApp(logger, app))
fib <- gameApp.start.executeOn(jmeScheduler).start
fib <- gameApp.start.executeOn(jmeThread).start
_ <- Task.fromCancelablePromise(startSignal)
} yield gameApp -> fib
)(_._2.cancel)

View File

@ -96,7 +96,7 @@ object PlayerController {
}
} yield ())
.onErrorHandleWith(e => IO.raiseError(GenericError(e.getMessage())))
.executeOn(appScheduler)
// .executeOn(appScheduler)
}
def apply(