diff --git a/frontend/core/src/com/gameware/game/GameWare.java b/frontend/core/src/com/gameware/game/GameWare.java index a9278adf9b0caec45501ab7f72c8b7eb5c3b714f..7e1fa7d594f549e937692e7611c090aa070de902 100644 --- a/frontend/core/src/com/gameware/game/GameWare.java +++ b/frontend/core/src/com/gameware/game/GameWare.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonReader; @@ -27,9 +28,10 @@ import java.util.Map; /* GameWare is the main class, it is the first class to be created. It is called from the AndroidLauncher. - It extends LibGDX's ApplicationAdapter, and the render method delegates to the GameStateManager. + It extends LibGDX's ApplicationAdapter, and the render method (regarded as the game loop) + delegates to the GameStateManager. - Patterns: Singleton, Delegation + Patterns: Singleton, Delegation, Game Loop */ public class GameWare extends ApplicationAdapter { @@ -89,6 +91,8 @@ public class GameWare extends ApplicationAdapter { @Override public void render () { +// Game loop + // Clearing the screen Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); diff --git a/frontend/core/src/com/gameware/game/models/ModelInterface.java b/frontend/core/src/com/gameware/game/models/ModelInterface.java index b164ece17fa74443008549443190865934cca3fe..0646df75a3883433b373e2c1cf10b39635c74e41 100644 --- a/frontend/core/src/com/gameware/game/models/ModelInterface.java +++ b/frontend/core/src/com/gameware/game/models/ModelInterface.java @@ -3,9 +3,8 @@ package com.gameware.game.models; /* Data model interface for converting json objects to Java objects - Patterns: Interface pattern, pipe-and-filter pattern + Patterns: Pipe-and-filter - Implementation of the interface from the Interface pattern. When implemented the class must be a model, in other words a data oriented java object. Data models used for the filters input/output ports in the QueryIntermediate's pipe-and-filter implementation. diff --git a/frontend/core/src/com/gameware/game/sprites/Sprite.java b/frontend/core/src/com/gameware/game/sprites/Sprite.java index e966b46895e1392fe01a3e6c6c34613b36676da0..1660c0c5912d976966d0fe1bc5e6ec3d5e877e4e 100644 --- a/frontend/core/src/com/gameware/game/sprites/Sprite.java +++ b/frontend/core/src/com/gameware/game/sprites/Sprite.java @@ -7,7 +7,7 @@ import com.badlogic.gdx.math.Vector3; Abstract super class/union for game-sprites. Super class instead of interface because of necessary variables all sprites needs to have - Patterns: Union + Patterns: Union, Update method */ public abstract class Sprite { diff --git a/frontend/core/src/com/gameware/game/states/GameStateManager.java b/frontend/core/src/com/gameware/game/states/GameStateManager.java index 41dbc8711208c2feb10f61c303e35507ec0d02d8..b99e0097996021d9e15f1b4b44c07afe313a962e 100644 --- a/frontend/core/src/com/gameware/game/states/GameStateManager.java +++ b/frontend/core/src/com/gameware/game/states/GameStateManager.java @@ -7,7 +7,7 @@ import java.util.Stack; /* GameStateManager keeps track of which state is the current one. Delegates to the correct state. - Patterns: State, Delegation + Patterns: State, Delegation, Update method */ public class GameStateManager { @@ -40,6 +40,7 @@ public class GameStateManager { states.push(state); } +// Update method (delegates to current state) public void update(float dt){ states.peek().update(dt); } diff --git a/frontend/core/src/com/gameware/game/states/State.java b/frontend/core/src/com/gameware/game/states/State.java index 8526ec4e041147566b93e242921c63f1d68dad02..b638e8ee386e80e7ac17fb7411a41978e9f49d1c 100644 --- a/frontend/core/src/com/gameware/game/states/State.java +++ b/frontend/core/src/com/gameware/game/states/State.java @@ -11,9 +11,9 @@ import com.gameware.game.GameWare; State is the super class/union of all the states in the application. A state has their own logic and rendering. State contains common variables between - MenuStateUnion and PlayStateUnion. + MenuStateUnion and PlayStateUnion. All states must have their own update method. - Patterns: State, Union Design + Patterns: State, Union Design, Update method */ public abstract class State { @@ -45,6 +45,7 @@ public abstract class State { // Abstract state methods protected abstract void handleInput(); +// Requires all states to have the update method public abstract void update(float dt); public abstract void render(SpriteBatch sb);