I can't continue this project on Linux.

This commit is contained in:
Aly 2020-07-01 17:52:22 -07:00
parent 4ab4b5ad68
commit ae6fd7b0c4
5 changed files with 76 additions and 0 deletions

View file

@ -11,6 +11,8 @@ lazy val core = (project in file("core")).settings(
"io.chrisdavenport" %% "fuuid" % "0.3.0", "io.chrisdavenport" %% "fuuid" % "0.3.0",
"tf.bug" %% "fancadescodec" % "0.1.1", "tf.bug" %% "fancadescodec" % "0.1.1",
"tf.bug" %% "fancadegraph" % "0.1.0", "tf.bug" %% "fancadegraph" % "0.1.0",
"org.scalameta" %% "munit" % "0.7.9" % Test,
), ),
testFrameworks += new TestFramework("munit.Framework"),
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full), addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full),
) )

View file

@ -0,0 +1,34 @@
package tf.bug.fancadetagless
import tf.bug.fancadegraph.Level
import tf.bug.fancadegraph.BlockDefinition
import tf.bug.fancadegraph.PinDefinition
import tf.bug.fancadegraph.Block
import tf.bug.fancadescodec.Position
import scalax.collection.Graph
sealed trait Fancade {
val pins: Vector[PinDefinition]
def render: Level
}
object Fancade {
final case class Capture[T](newBlock: BlockDefinition[T], args: T, pins: Vector[PinDefinition]) extends Fancade {
override def render: Level = {
Level(
Set(
Block(
Position(0, 0, 0),
newBlock,
args
)
),
Graph.empty
)
}
}
final case class Use(inputs: Vector[Fancade])
}

View file

@ -1,6 +1,7 @@
package tf.bug.fancadetagless package tf.bug.fancadetagless
import tf.bug.fancadetagless.Fanscript.{Position, ScreenSize} import tf.bug.fancadetagless.Fanscript.{Position, ScreenSize}
import tf.bug.fancadegraph.BlockDefinition
trait Fanscript[F[_]] { trait Fanscript[F[_]] {
@ -70,6 +71,24 @@ trait Fanscript[F[_]] {
object Fanscript { object Fanscript {
implicit object FanscriptFancade extends Fanscript[FancadeW] {
override def lift(value: Float): FancadeW[Float] =
Fancade.Capture(
BlockDefinition.NumberValue,
value,
BlockDefinition.NumberValue.output
)
override def win(stop: Boolean): FancadeW[Unit] =
Fancade.Capture(
BlockDefinition.Win,
stop,
BlockDefinition.Win.after
)
}
case class ScreenSize(width: Float, height: Float) case class ScreenSize(width: Float, height: Float)
case class Position(position: Vector3, rotation: Rotation) case class Position(position: Vector3, rotation: Rotation)
case class Raycast(hit: Boolean, position: Vector3, obj: Obj) case class Raycast(hit: Boolean, position: Vector3, obj: Obj)

View file

@ -0,0 +1,7 @@
package tf.bug
package object fancadetagless {
type FancadeW[A] = Fancade
}

View file

@ -0,0 +1,14 @@
package tf.bug.fancadetagless
import tf.bug.fancadegraph.BlockDefinition
class FancadeSuite extends munit.FunSuite {
test("A capture creates one block") {
val capture = Fancade.Capture[String](BlockDefinition.GetNumber, "hello", Vector(
BlockDefinition.GetNumber.output
))
}
}