diff --git a/GameEngine/resources/GameEngineTest.model b/GameEngine/resources/GameEngineTest.model index fd85733..f1ee23b 100644 --- a/GameEngine/resources/GameEngineTest.model +++ b/GameEngine/resources/GameEngineTest.model @@ -1,92 +1,101 @@ init { -{ - "001": { - "transform": { - "rotation": { - "x": 0.0, - "y": 0.0, - "z": 0.0 +scene := { + "entities": { + "001": { + "transform": { + "rotation": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "position": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + } }, - "scale": { - "x": 1.0, - "y": 1.0, - "z": 1.0 - }, - "position": { - "x": 0.0, - "y": 0.0, - "z": 0.0 + "mesh": { + "sprite": "GameEngine/resources/enemy1.png", + "type": "sprite" } }, - "mesh": { - "sprite": GameEngine/resources/test.png, - "type": sprite - } - }, - "002": { - "transform": { - "rotation": { - "x": 0.0, - "y": 0.0, - "z": 0.0 + "002": { + "transform": { + "rotation": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "position": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + } }, - "scale": { - "x": 1.0, - "y": 1.0, - "z": 1.0 - }, - "position": { - "x": 0.0, - "y": 0.0, - "z": 0.0 + "mesh": { + "sprite": "GameEngine/resources/enemy1.png", + "type": "sprite" } - }, - "mesh": { - "sprite": GameEngine/resources/test.png, - "type": sprite } } } } -channel KeyEvent { - out state(curState:Int,keyEvent(nextState)) = nextState +native channel KeyEvent(kno:Int) { + out scene.keys.{kno:Int}.state(curState:Int,keyEvent(nextState)) = nextState } -channel SceneUpdateEvent { - out time(time:Long,updateEvent(dt:Long)) = (time+dt) +native channel SceneUpdateEvent { + out scene.time(time:Long,updateEvent(dt:Long)) = (time+dt) } -channel TimerEvent { - out count(count:Long,tick()) = (count+1) +native channel TimerEvent(tid:Str) { + out timers.{tid:Str}.count(count:Long,tick()) = (count+1) } -channel EntitySpriteUpdate { - in mesh(curMesh:Json,updateSprite(spritePath:Str)) = { - ""sprite"": spritePath, - ""type"": "sprite" +channel UpdateCameraPosition { + out scene.camera.transform.position(curPos:Json,updateCameraPosition(x:Double,y:Double,z:Double)) = { + "x": x, + "y": y, + "z": z } } -channel EntityScaleUpdate { - in scale(curScale:Json,updateScale(nextScale.{x},nextScale.{y},nextScale.{z})) = nextScale +native channel EntitySpriteUpdate(eid:Str) { + in scene.entities.{eid:Str}.mesh(curMesh:Json,updateSprite(spritePath:Str)) = { + "sprite": spritePath, + "type": "sprite" } -channel EntityPositionUpdate { - in position(curPos:Json,updatePosition(nextPos.{x},nextPos.{y},nextPos.{z})) = nextPos } -channel CameraProjectionUpdate { - in projection(curProj:Json,updateProjection(curProj,nextProj)) = nextProj +native channel EntityScaleUpdate(eid:Str) { + in scene.entities.{eid:Str}.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale } -channel TimersUpdated { +native channel EntityPositionUpdate(eid:Str) { + in scene.entities.{eid:Str}.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos +} +native channel CameraProjectionUpdate { + in scene.camera.projection(curProj:Json,updateProjection(curProj,nextProj)) = nextProj +} +native channel TimersUpdated { in timers(curTimers:Map,update(curTimers,nextTimers)) = nextTimers } -channel CameraPositionUpdate { - in position(curPos:Json,updatePosition(nextPos.{x},nextPos.{y},nextPos.{z})) = nextPos +native channel CameraPositionUpdate { + in scene.camera.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos } -channel SceneUpdate { +native channel SceneUpdate { in scene(curSc:Json,update(curSc,nextSc)) = nextSc } -channel CameraScaleUpdate { - in scale(curScale:Json,updateScale(nextScale.{x},nextScale.{y},nextScale.{z})) = nextScale +native channel CameraScaleUpdate { + in scene.camera.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale } -channel EntityRotationUpdate { - in rotation(curRot:Json,updateRotation(nextRot.{x},nextRot.{y},nextRot.{z})) = nextRot +native channel EntityRotationUpdate(eid:Str) { + in scene.entities.{eid:Str}.transform.rotation(curRot:Json,updateRotation(nextRot.x,nextRot.y,nextRot.z)) = nextRot } -channel CameraRotationUpdate { - in rotation(curRot:Json,updateRotation(nextRot.{x},nextRot.{y},nextRot.{z})) = nextRot +native channel CameraRotationUpdate { + in scene.camera.transform.rotation(curRot:Json,updateRotation(nextRot.x,nextRot.y,nextRot.z)) = nextRot }