Sletter ubrukt kode og omstruktuerer klasser

Fjerner AppTest.java
Fjerner HelloWorld.java
Fjerner GameBoard.java
Flytter alle filer fra inf112.skeleton.app til inf112.fiasko.roborally
Flytter IDrawableGame og Game til en egen pakke
Flytter IDrawableObject og DrawableObject til en egen pakke
Flytter GameTexture til en egen pakke
This commit is contained in:
2020-02-04 17:52:17 +01:00
parent d73e027e51
commit 2d40d9fd21
12 changed files with 27 additions and 144 deletions

View File

@ -0,0 +1,50 @@
package inf112.fiasko.roborally.game;
import inf112.fiasko.roborally.abstractions.GameTexture;
import inf112.fiasko.roborally.objects.DrawableObject;
import inf112.fiasko.roborally.objects.IDrawableObject;
import java.util.ArrayList;
import java.util.List;
/**
* This class represent a game which is drawable using libgdx
*/
public class Game implements IDrawableGame {
private final int TILE_SIZE = 64;
private final int TILE_NUMBER = 12;
private final int BOARD_WIDTH = TILE_SIZE * TILE_NUMBER;
private final int BOARD_HEIGHT = TILE_SIZE * TILE_NUMBER;
/**
* Instantiates a new Game object
*/
public Game () {
}
@Override
public int getWidth() {
return BOARD_WIDTH;
}
@Override
public int getHeight() {
return BOARD_HEIGHT;
}
@Override
public List<IDrawableObject> objectsToRender() {
List<IDrawableObject> list = new ArrayList<>();
for (int i = 0; i < 12; i++) {
for (int j = 0; j < 12; j++) {
DrawableObject tileObj = new DrawableObject(i * 64, j * 64, GameTexture.TILE);
list.add(tileObj);
}
}
DrawableObject roboObj = new DrawableObject(128,128, GameTexture.ROBOT);
list.add(roboObj);
return list;
}
}

View File

@ -0,0 +1,30 @@
package inf112.fiasko.roborally.game;
import inf112.fiasko.roborally.objects.IDrawableObject;
import java.util.List;
/**
* This interface describes a game drawable using libgdx
*/
public interface IDrawableGame {
/**
* Gets the screen width of the game
* @return A positive integer
*/
int getWidth();
/**
* Gets the screen height of the game
* @return A positive integer
*/
int getHeight();
/**
* Gets a list of objects which are to be rendered
* @return A list of drawable objects in the order they are to be drawn
*/
List<IDrawableObject> objectsToRender();
}