Add bool argument

This commit is contained in:
Aly 2020-07-02 11:10:49 -07:00
parent c95a30edd0
commit 33df0eb120
3 changed files with 9 additions and 4 deletions

View File

@ -20,6 +20,11 @@ object Argument {
fansc.Metadata.Number(pos, value)
)
}
implicit val booleanArg: Argument[Boolean] = new Argument[Boolean] {
override def encode(value: Boolean)(pos: fansc.Position): Vector[fansc.Metadata] = Vector(
fansc.Metadata.Bool(pos, value)
)
}
implicit val soundOptionsArg: Argument[SoundOptions] = new Argument[SoundOptions] {
override def encode(value: SoundOptions)(pos: fansc.Position): Vector[fansc.Metadata] = Vector(
fansc.Metadata.Bool(pos, value.loop),

View File

@ -389,7 +389,7 @@ object BlockDefinition {
override val ids: Vector[Obj] = Vector(Obj.archLower, Obj.archHigher)
}
case object Win extends BuiltIn[Unit] {
case object Win extends BuiltIn[Boolean] {
override val width: Int = 2
override val height: Int = 1
override val depth: Int = 2
@ -415,7 +415,7 @@ object BlockDefinition {
)
}
case object Lose extends BuiltIn[Unit] {
case object Lose extends BuiltIn[Boolean] {
override val width: Int = 2
override val height: Int = 1
override val depth: Int = 2

View File

@ -11,8 +11,8 @@ import tf.bug.fancadescodec.{Cartridge, Codecs, Position}
object Main extends IOApp {
override def run(args: List[String]): IO[ExitCode] = {
val winBlock = Block(Position(0, 0, 0), BlockDefinition.Win)
val loseBlock = Block(Position(0, 0, 3), BlockDefinition.Lose)
val winBlock = Block(Position(0, 0, 0), BlockDefinition.Win, true)
val loseBlock = Block(Position(0, 0, 3), BlockDefinition.Lose, true)
val loseAfter = Pin(loseBlock, BlockDefinition.Lose.after)
val winBefore = Pin(winBlock, BlockDefinition.Win.before)
val level = Level(