diff --git a/AlgebraicDataflowArchitectureModel/models/GameEngine.model b/AlgebraicDataflowArchitectureModel/models/GameEngine.model new file mode 100644 index 0000000..b8173e4 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/models/GameEngine.model @@ -0,0 +1,43 @@ +native channel SceneUpdateEvent { + out scene.time(time: Long, updateEvent(dt: Long)) = time + dt +} + +native channel KeyEvent(kno: Int) { + out scene.keys.{kno}.state(curState: Int, keyEvent(nextState)) = nextState +} + +native channel SceneUpdate { + in scene(curSc: Json, update(curSc, nextSc)) = nextSc +} + +native channel CameraPositionUpdate { + in scene.camera.transform.position(curPos: Json, updatePosition(x: Double, y: Double, z: Double)) = {"x": x, "y": y, "z": z} +} + +native channel CameraRotationUpdate { + in scene.camera.transform.rotation(curRot: Json, updateRotation(x: Double, y: Double, z: Double)) = {"x": x, "y": y, "z": z} +} + +native channel CameraScaleUpdate { + in scene.camera.transform.scale(curScale: Json, updateScale(x: Double, y: Double, z: Double)) = {"x": x, "y": y, "z": z} +} + +native channel CameraProjectionUpdate { + in scene.camera.projection(curProj: Json, updateProjection(curProj, nextProj)) = nextProj +} + +native channel EntityPositionUpdate(eid: Str) { + in scene.entities.{eid}.transform.position(curPos: Json, updatePosition(x: Double, y: Double, z: Double)) = {"x": x, "y": y, "z": z} +} + +native channel EntityRotationUpdate(eid: Str) { + in scene.entities.{eid}.transform.rotation(curRot: Json, updateRotation(x: Double, y: Double, z: Double)) = {"x": x, "y": y, "z": z} +} + +native channel EntityScaleUpdate(eid: Str) { + in scene.entities.{eid}.transform.scale(curScale: Json, updateScale(x: Double, y: Double, z: Double)) = {"x": x, "y": y, "z": z} +} + +native channel EntitySpriteUpdate(eid: Str) { + in scene.entities.{eid}.mesh(curMesh: Json, updateSprite(spritePath: Str)) = {"type": "sprite", "sprite": spritePath} +}