diff --git a/AlgebraicDataflowArchitectureModel/.classpath b/AlgebraicDataflowArchitectureModel/.classpath index 3e99697..3d939f1 100644 --- a/AlgebraicDataflowArchitectureModel/.classpath +++ b/AlgebraicDataflowArchitectureModel/.classpath @@ -1,12 +1,14 @@ + + - + diff --git a/AlgebraicDataflowArchitectureModel/models/GameEngine.model b/AlgebraicDataflowArchitectureModel/models/GameEngine.model index 1e23e9b..8c6f525 100644 --- a/AlgebraicDataflowArchitectureModel/models/GameEngine.model +++ b/AlgebraicDataflowArchitectureModel/models/GameEngine.model @@ -1,6 +1,7 @@ init { enemy := { "position": {"x": 0.0, "y": 0.0, "z": 0.0}, + "rotation": {"x": 0.0, "y": 0.0, "z": 0.0}, "id": "001" } } @@ -9,10 +10,6 @@ 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 } @@ -49,6 +46,10 @@ in scene.entities.{eid}.mesh(curMesh: Json, updateSprite(spritePath: Str)) = {"type": "sprite", "sprite": spritePath} } +native channel KeyEvent(kno: Int) { + out scene.keys.{kno}.state(curState: Int, keyEvent(nextState)) = nextState +} + native channel TimersUpdated { in timers(curTimers: Map, update(curTimers, nextTimers)) = nextTimers } @@ -86,11 +87,18 @@ channel UpdateEnemy(tid: Str) { in timers.{tid}.count(curCount: Long, updateEnemy(nextCount)) = nextCount - out enemy.position(curPos: Json, updateEnemy(nextCount)) = {"x": curPos.x, "y": curPos.y + 1, "z": curPos.z} + out enemy.position(curPos: Json, updateEnemy(nextCount)) = {"x": curPos.x, "y": curPos.y + 5, "z": curPos.z} + out enemy.rotation(curRot: Json, updateEnemy(nextCount)) = {"x": curRot.x, "y": curRot.y, "z": curRot.z + 5} } -channel ViewEnemy { - in enemy.position(curPos: Json, viewEnemy(nextPos, nextId)) = nextPos - in enemy.id(curId: Str, viewEnemy(nextPos, nextId)) = nextId - out scene.entities.{nextId}.transform.position(curPos: Json, viewEnemy(nextPos, nextId)) = nextPos +channel MoveEnemy { + in enemy.position(curPos: Json, moveEnemy(nextPos, nextRot, nextId)) = nextPos + in enemy.id(curId: Str, moveEnemy(nextPos, nextRot, nextId)) = nextId + out scene.entities.{nextId}.transform.position(curPos: Json, moveEnemy(nextPos, nextRot, nextId)) = nextPos +} + +channel RotateEnemy { + in enemy.rotation(curRot: Json, rotateEnemy(nextPos, nextRot, nextId)) = nextRot + in enemy.id(curId: Str, rotateEnemy(nextPos, nextRot, nextId)) = nextId + out scene.entities.{nextId}.transform.rotation(curRot: Json, rotateEnemy(nextPos, nextRot, nextId)) = nextRot } diff --git a/AlgebraicDataflowArchitectureModel/src/application/simulator/actions/ShowGameSimulatorAction.java b/AlgebraicDataflowArchitectureModel/src/application/simulator/actions/ShowGameSimulatorAction.java index 97373e8..5a99f90 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/simulator/actions/ShowGameSimulatorAction.java +++ b/AlgebraicDataflowArchitectureModel/src/application/simulator/actions/ShowGameSimulatorAction.java @@ -20,11 +20,10 @@ @Override public void actionPerformed(ActionEvent e) { - Window window = Window.get(); Thread game = new Thread() { @Override public void run() { - window.init(); + Window window = Window.get(); GameEnginePresenter presenter = new GameEnginePresenter(window.getScene(), simulator); TimerService timerService = new TimerService(simulator); window.run(); diff --git a/AlgebraicDataflowArchitectureModel/src/models/algebra/Term.java b/AlgebraicDataflowArchitectureModel/src/models/algebra/Term.java index 3398f18..cfef320 100644 --- a/AlgebraicDataflowArchitectureModel/src/models/algebra/Term.java +++ b/AlgebraicDataflowArchitectureModel/src/models/algebra/Term.java @@ -194,8 +194,8 @@ } } if (!bReduced) return this; - Term newTerm = new Term(symbol, newChildren); - newTerm.setType(type); + Term newTerm = (Term) this.clone(); + newTerm.children = newChildren; return newTerm; } } diff --git a/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java b/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java index bb90111..0f5b6c6 100644 --- a/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java +++ b/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java @@ -253,7 +253,7 @@ nextEvents.add(nextEvent); } } - if (invDependency.size() == 0) { + if (nextEvents.size() == 0) { Event nextEvent = new Event(channel, inResPath, nextSystemState.getResource(inResId)); nextEvent.setMessage(nextEvent.updateDependingParameters(resourceStateValueProvider)); nextEvents.add(nextEvent);