81 lines
3.6 KiB
Scala
81 lines
3.6 KiB
Scala
package tf.bug.fancadetagless
|
|
|
|
import tf.bug.fancadetagless.Fanscript.{Position, ScreenSize}
|
|
|
|
trait Fanscript[F[_]] {
|
|
|
|
def lift(value: Float): F[Float]
|
|
def lift(value: Vector3): F[Vector3]
|
|
def lift(value: Rotation): F[Rotation]
|
|
def lift(value: Boolean): F[Boolean]
|
|
|
|
def win(stop: Boolean): F[Unit]
|
|
def lose(stop: Boolean): F[Unit]
|
|
def setScore(score: F[Float]): F[Unit]
|
|
def setCamera(position: F[Vector3], rotation: F[Rotation], distance: F[Float]): F[Unit]
|
|
def setLight(position: F[Vector3], rotation: F[Rotation]): F[Unit]
|
|
def screenSize: F[Fanscript.ScreenSize]
|
|
def accelerometer: F[Vector3]
|
|
|
|
def getPosition(obj: F[Obj]): F[Fanscript.Position]
|
|
def setPosition(obj: F[Obj], position: F[Vector3], rotation: F[Rotation]): F[Unit]
|
|
def raycast(from: F[Vector3], to: F[Vector3]): F[Fanscript.Raycast]
|
|
def getSize(obj: F[Obj]): F[Fanscript.Size]
|
|
def setVisible(obj: F[Obj], visible: F[Boolean]): F[Unit]
|
|
def createObj(original: F[Obj]): F[Obj]
|
|
def destroyObj(obj: F[Obj]): F[Obj]
|
|
|
|
def playSound(loop: Boolean, sound: Nothing)(volume: F[Float], pitch: F[Float]): F[Float]
|
|
def stopSound(channel: F[Float]): F[Unit]
|
|
def volumePitch(channel: F[Float], volume: F[Float], pitch: F[Float]): F[Unit]
|
|
|
|
def addForce(obj: F[Obj], force: F[Vector3], applyAt: F[Vector3], torque: F[Vector3]): F[Unit]
|
|
def getVelocity(obj: F[Obj]): F[Fanscript.Velocity]
|
|
def setVelocity(obj: F[Obj], velocity: F[Vector3], spin: F[Vector3]): F[Unit]
|
|
def setLocked(obj: F[Obj], position: F[Vector3], rotation: F[Vector3]): F[Unit]
|
|
def setMass(obj: F[Obj], mass: F[Float]): F[Unit]
|
|
def setFriction(obj: F[Obj], friction: F[Float]): F[Unit]
|
|
def setBounciness(obj: F[Obj], bounciness: F[Float]): F[Unit]
|
|
def setGravity(gravity: F[Vector3]): F[Unit]
|
|
def addConstraint(base: F[Obj], part: F[Obj], pivot: F[Vector3]): F[Constraint]
|
|
def linearLimits(constraint: F[Constraint], lower: F[Vector3], upper: F[Vector3]): F[Unit]
|
|
def angularLimits(constraint: F[Constraint], lower: F[Vector3], upper: F[Vector3]): F[Unit]
|
|
def linearSpring(constraint: F[Constraint], stiffness: F[Vector3], damping: F[Vector3]): F[Unit]
|
|
def angularSpring(constraint: F[Constraint], stiffness: F[Vector3], damping: F[Vector3]): F[Unit]
|
|
def linearMotor(constraint: F[Constraint], speed: F[Vector3], force: F[Vector3]): F[Unit]
|
|
def angularMotor(constraint: F[Constraint], speed: F[Vector3], force: F[Vector3]): F[Unit]
|
|
|
|
def ifElse(cond: F[Boolean])(ifTrue: F[Unit])(ifFalse: F[Unit]): F[Unit]
|
|
def onPlay(onPlay: F[Unit]): F[Unit]
|
|
def onBoxArt(onBoxArt: F[Unit]): F[Unit]
|
|
def onTouch(onTouch: F[Fanscript.Touch] => F[Unit]): F[Unit]
|
|
|
|
def screenSizeWidth(screenSize: F[ScreenSize]): F[Float]
|
|
def screenSizeHeight(screenSize: F[ScreenSize]): F[Float]
|
|
|
|
def positionPosition(position: F[Position]): F[Vector3]
|
|
def positionRotation(position: F[Position]): F[Rotation]
|
|
|
|
def raycastHit(raycast: F[Fanscript.Raycast]): F[Boolean]
|
|
def raycastPosition(raycast: F[Fanscript.Raycast]): F[Vector3]
|
|
def raycastObj(raycast: F[Fanscript.Raycast]): F[Obj]
|
|
|
|
def sizeMin(size: F[Fanscript.Size]): F[Vector3]
|
|
def sizeMax(size: F[Fanscript.Size]): F[Vector3]
|
|
|
|
def velocityVelocity(velocity: F[Fanscript.Velocity]): F[Vector3]
|
|
def velocitySpin(velocity: F[Fanscript.Velocity]): F[Vector3]
|
|
|
|
}
|
|
|
|
object Fanscript {
|
|
|
|
case class ScreenSize(width: Float, height: Float)
|
|
case class Position(position: Vector3, rotation: Rotation)
|
|
case class Raycast(hit: Boolean, position: Vector3, obj: Obj)
|
|
case class Size(min: Vector3, max: Vector3)
|
|
case class Velocity(velocity: Vector3, spin: Vector3)
|
|
case class Touch(screenX: Float, screenY: Float)
|
|
|
|
}
|