packages feed

mischief-live-0.1.0.0: examples/simple/main/Main.hs

module Main where

import Common (Health (Health))
import Data.Text qualified as T
import Mischief.ECS
import Mischief.Live

main :: IO ()
main = do
  app <- newApp
  attachLive "./mischief-live/examples/simple/live" ["Live.hs"] def app
  addPlugin @P app
  runApp app

data P

instance Plugin P where
  init =
    schedule @Update $ systems (update, showHealth)

update :: System ()
update = do
  unwrap =<< live "Live" "y"

showHealth :: System ()
showHealth = info . T.show =<< res @Health