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.
|
|
package wow.doge.mygame
import scala.concurrent.duration._
import akka.util.Timeout import cats.effect.ExitCode import cats.implicits._ import com.softwaremill.macwire._ import io.odin._ import io.odin.json.Formatter import io.odin.syntax._ import wow.doge.mygame.game.GameAppResource import _root_.monix.bio.BIOApp import _root_.monix.bio.Task import _root_.monix.bio.UIO import cats.effect.Resource import scalafx.scene.control.TextArea import wow.doge.mygame.utils.GenericConsoleStream
object Main extends BIOApp with MainModule { import java.util.logging.{Logger => JLogger, Level} JLogger.getLogger("").setLevel(Level.SEVERE) implicit val timeout = Timeout(1.second)
def appResource(consoleStream: GenericConsoleStream[TextArea]) = for { logger <- consoleLogger().withAsync(timeWindow = 1.milliseconds) |+| fileLogger( "application-log-1.log", Formatter.json ).withAsync(timeWindow = 1.milliseconds) jmeScheduler <- jMESchedulerResource actorSystem <- actorSystemResource2(logger) // consoleTextArea <- Resource.liftF(Task(new TextArea()))
// consoleStream <- wireWith(JFXConsoleStream.textAreaStream _)
gameApp <- { // new BulletAppState()
// bas.setThreadingType(Thr)
// gameAppResource(new StatsAppState())
wire[GameAppResource].get } _ <- Resource.liftF( new MainApp( logger, gameApp, actorSystem, jmeScheduler, schedulers, consoleStream )( timeout, actorSystem.scheduler ).program )
} yield ()
def run(args: List[String]): UIO[ExitCode] = {
lazy val consoleStream = GenericConsoleStream.textAreaStream() Console.withOut(consoleStream)( appResource(consoleStream) .use(_ => Task.unit) .onErrorHandle(_.printStackTrace()) .as(ExitCode.Success) ) } }
|