From 4c4602a0c9bf72b1238101baa9e37c9d2ce0b0c7 Mon Sep 17 00:00:00 2001 From: davesmith00000 Date: Tue, 12 Nov 2024 21:53:52 +0000 Subject: [PATCH] SubSystemContext should not export frame/services --- .../scala/indigoextras/subsystems/Automata.scala | 12 ++++++------ .../scala/indigoextras/subsystems/FPSCounter.scala | 6 +++--- .../indigo/shared/subsystems/SubSystemContext.scala | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/Automata.scala b/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/Automata.scala index a1d53c8e9..267f2d1e0 100644 --- a/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/Automata.scala +++ b/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/Automata.scala @@ -63,14 +63,14 @@ final case class Automata[Model]( case Spawn(key, position, lifeSpan, payload) if key == poolKey => val spawned = SpawnedAutomaton( - automaton.node.giveNode(state.totalSpawned, context.dice), + automaton.node.giveNode(state.totalSpawned, context.frame.dice), automaton.modifier, automaton.onCull, new AutomatonSeedValues( position, - context.time.running, + context.frame.time.running, lifeSpan.getOrElse(automaton.lifespan), - context.dice.roll, + context.frame.dice.roll, payload ) ) @@ -108,12 +108,12 @@ final case class Automata[Model]( case Update(key) if key == poolKey => val cullEvents = state.pool - .filterNot(_.isAlive(context.time.running)) + .filterNot(_.isAlive(context.frame.time.running)) .flatMap(sa => sa.onCull(sa.seedValues)) Outcome( state.copy( - pool = state.pool.filter(_.isAlive(context.time.running)) + pool = state.pool.filter(_.isAlive(context.frame.time.running)) ), Batch(cullEvents) ) @@ -122,7 +122,7 @@ final case class Automata[Model]( Outcome(state) def present(context: SubSystemContext[ReferenceData], state: AutomataState): Outcome[SceneUpdateFragment] = - val updated = Automata.renderNoLayer(state.pool, context.time) + val updated = Automata.renderNoLayer(state.pool, context.frame.time) Outcome( SceneUpdateFragment( diff --git a/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/FPSCounter.scala b/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/FPSCounter.scala index 98b3fe9bf..223925e6c 100644 --- a/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/FPSCounter.scala +++ b/indigo/indigo-extras/src/main/scala/indigoextras/subsystems/FPSCounter.scala @@ -60,11 +60,11 @@ final case class FPSCounter[Model]( model: FPSCounterState ): GlobalEvent => Outcome[FPSCounterState] = { case FrameTick => - if (context.time.running >= (model.lastInterval + Seconds(1))) + if (context.frame.time.running >= (model.lastInterval + Seconds(1))) Outcome( model.copy( fps = decideNextFps(model.frameCountSinceInterval), - lastInterval = context.time.running, + lastInterval = context.frame.time.running, frameCountSinceInterval = 0 ) ) @@ -90,7 +90,7 @@ final case class FPSCounter[Model]( .moveTo(model.position + 2) val size: Rectangle = - context.bounds.measureText(text) + context.services.bounds.measureText(text) val boxSize = ({ (s: Size) => diff --git a/indigo/indigo/src/main/scala/indigo/shared/subsystems/SubSystemContext.scala b/indigo/indigo/src/main/scala/indigo/shared/subsystems/SubSystemContext.scala index 6e72dee0e..6bba5511b 100644 --- a/indigo/indigo/src/main/scala/indigo/shared/subsystems/SubSystemContext.scala +++ b/indigo/indigo/src/main/scala/indigo/shared/subsystems/SubSystemContext.scala @@ -30,8 +30,6 @@ final case class SubSystemContext[ReferenceData]( frame: Context.Frame, services: Context.Services ): - export frame.* - export services.* def toContext: Context[Unit] = new Context[Unit]((), frame, services)