diff --git a/core/src/sagittarius/model/Arrow.java b/core/src/sagittarius/model/Arrow.java index 8c71f26..808e75a 100644 --- a/core/src/sagittarius/model/Arrow.java +++ b/core/src/sagittarius/model/Arrow.java @@ -88,14 +88,14 @@ public class Arrow extends Actor { * Updates the physical attributes of the Arrow, * must be called in the main update loop. * - * @param deltaTime time elapsed between 2 frames. + * @param dt time elapsed between 2 frames. */ - public void update(float deltaTime) { + public void update(float dt) { if (this.active) { verifyActivity(); - integrationVerlet(deltaTime); - this.TTL -= deltaTime; + integrationVerlet(dt); + this.TTL -= dt; this.angle = this.velocity.angleDeg(); } else { this.position = crash.position.cpy().add(offset); @@ -107,20 +107,20 @@ public class Arrow extends Actor { * according to its physical attributes * using the Verlet integration scheme. * - * @param deltaTime time difference used in the integration. + * @param dt time difference used in the integration. * @see https://gamedev.stackexchange.com/a/41917. */ - private void integrationVerlet(float deltaTime) { + private void integrationVerlet(float dt) { this.acceleration = this.force.cpy(); - this.position.x += deltaTime * ( this.velocity.x + deltaTime * this.acceleration.x / 2 ); - this.position.y += deltaTime * ( this.velocity.y + deltaTime * this.acceleration.y / 2 ); + this.position.x += dt * ( this.velocity.x + dt * this.acceleration.x / 2 ); + this.position.y += dt * ( this.velocity.y + dt * this.acceleration.y / 2 ); this.force = computeForce(); - this.velocity.x += deltaTime * ( this.acceleration.x + this.force.x ) / 2; - this.velocity.y += deltaTime * ( this.acceleration.y + this.force.y ) / 2; + this.velocity.x += dt * ( this.acceleration.x + this.force.x ) / 2; + this.velocity.y += dt * ( this.acceleration.y + this.force.y ) / 2; } // ---------- GRAPHICAL METHODs ---------- diff --git a/core/src/sagittarius/model/Bow.java b/core/src/sagittarius/model/Bow.java index 6bfa5f4..700bd5f 100644 --- a/core/src/sagittarius/model/Bow.java +++ b/core/src/sagittarius/model/Bow.java @@ -34,7 +34,7 @@ class Bow extends Actor { // ---------- METHODs ---------- @Override - public void act(float deltaTime) { + public void act(float dt) { if (Gdx.input.isButtonJustPressed(Buttons.LEFT) && !pressed) { this.anchor = Sagittarius.worldCursor.cpy(); diff --git a/core/src/sagittarius/model/Moon.java b/core/src/sagittarius/model/Moon.java index 3019878..51b92df 100644 --- a/core/src/sagittarius/model/Moon.java +++ b/core/src/sagittarius/model/Moon.java @@ -20,7 +20,7 @@ public class Moon extends Planet { // ---------- METHODs ---------- @Override - public void act(float deltaTime) { + public void act(float dt) { this.rotateBy(10.0f / this.altitude); diff --git a/core/src/sagittarius/model/Player.java b/core/src/sagittarius/model/Player.java index 61c5267..6eb5a68 100644 --- a/core/src/sagittarius/model/Player.java +++ b/core/src/sagittarius/model/Player.java @@ -41,13 +41,13 @@ public class Player extends Actor { } @Override - public void act(float deltaTime) { - super.act(deltaTime); + public void act(float dt) { + super.act(dt); this.setX(home.getX() + this.home.getRadius()*MathUtils.cosDeg(this.getRotation())); this.setY(home.getY() + this.home.getRadius()*MathUtils.cosDeg(this.getRotation())); - //this.bow.act(deltaTime); + //this.bow.act(dt); } /** diff --git a/core/src/sagittarius/view/BaseScreen.java b/core/src/sagittarius/view/BaseScreen.java index 6f7e852..cdfd053 100644 --- a/core/src/sagittarius/view/BaseScreen.java +++ b/core/src/sagittarius/view/BaseScreen.java @@ -22,7 +22,7 @@ public abstract class BaseScreen implements Screen { @Override public void render(float dt) { - // update actors + // update Stages uiStage.act(dt); mainStage.act(dt); @@ -43,8 +43,10 @@ public abstract class BaseScreen implements Screen { mainStage.dispose(); } - // methods required by Screen interface - @Override public void resize(int width, int height) {} + @Override public void resize(int width, int height) { + mainStage.getViewport().update(width, height, true); + } + @Override public void pause() {} @Override public void resume(){} @Override public void show() {} diff --git a/core/src/sagittarius/view/StartScreen.java b/core/src/sagittarius/view/StartScreen.java index 2b834fa..2b2f4e1 100644 --- a/core/src/sagittarius/view/StartScreen.java +++ b/core/src/sagittarius/view/StartScreen.java @@ -50,14 +50,10 @@ public class StartScreen extends BaseScreen { } @Override - public void update(float deltaTime) { + public void update(float dt) { // } - public void resize(int width, int height) { - mainStage.getViewport().update(width, height, true); - } - @Override public void dispose() { VisUI.dispose();