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.
 
 

36 lines
998 B

package wow.doge.mygame.game
import cats.effect.Resource
import com.jme3.app.StatsAppState
import com.jme3.system.AppSettings
import io.odin.Logger
import monix.bio.Task
import monix.execution.Scheduler
import wow.doge.mygame.executors.Schedulers
class GameAppResource(
logger: Logger[Task],
jmeScheduler: Scheduler,
schedulers: Schedulers
) {
def get: Resource[Task, GameApp] =
Resource.make(
for {
_ <- logger.info("Creating game app")
appExt <- Task(new SimpleAppExt(schedulers, new StatsAppState()))
app <- Task {
val settings = new AppSettings(true)
settings.setVSync(true)
/**
* disables the launcher
* We'll be making our own launcher anyway
*/
appExt.setShowSettings(false)
appExt.setSettings(settings)
// JMERunner.runner = app
new GameApp(logger, appExt)
}
} yield (app)
)(_ => logger.info("Closing game app"))
}