diff --git a/core/src/com/trs/game/Controller.java b/core/src/com/trs/game/Controller.java index 3113735..c867ef6 100644 --- a/core/src/com/trs/game/Controller.java +++ b/core/src/com/trs/game/Controller.java @@ -10,8 +10,10 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.utils.Timer; import com.trs.game.model.Model; +import com.trs.game.model.Wall; import com.trs.game.view.View; import com.trs.game.view.Button; import com.trs.game.view.Screen; @@ -70,6 +72,16 @@ public class Controller extends ApplicationAdapter implements InputProcessor { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); screen.render(batch,renderer,font); + + // MODEL DRAWING + if(screen.getId() == 1){ + renderer.begin(ShapeRenderer.ShapeType.Filled); + for(Wall wall : model.getWalls()){ + renderer.rect(wall.getRect().getX(), wall.getRect().getY(),0,0, wall.getRect().getWidth(), wall.getRect().getHeight(),1,1, (float)wall.getRotation()); + } + renderer.end(); + model.getMonster().drawMonster(renderer); + } } @Override diff --git a/core/src/com/trs/game/model/Model.java b/core/src/com/trs/game/model/Model.java index c8d8175..e924794 100644 --- a/core/src/com/trs/game/model/Model.java +++ b/core/src/com/trs/game/model/Model.java @@ -1,6 +1,8 @@ package com.trs.game.model; +import com.badlogic.gdx.math.Rectangle; + import java.util.ArrayList; public class Model { @@ -8,11 +10,20 @@ public class Model { private ArrayList walls; public Model(){ - monster = new Monster(); + monster = new Monster(250,150); walls = new ArrayList<>(); + walls.add(new PermWall(20,new Rectangle(250,250,50,25))); } public void timerStep(){ } + + public ArrayList getWalls(){ + return walls; + } + + public Monster getMonster(){ + return monster; + } } diff --git a/core/src/com/trs/game/model/Monster.java b/core/src/com/trs/game/model/Monster.java index af9a2db..28e6951 100644 --- a/core/src/com/trs/game/model/Monster.java +++ b/core/src/com/trs/game/model/Monster.java @@ -1,5 +1,7 @@ package com.trs.game.model; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.trs.game.StaticMath; public class Monster { @@ -16,6 +18,19 @@ public class Monster { public Monster(int xPos, int yPos){ this.xPos = xPos; this.yPos = yPos; + + } + + public void drawMonster(ShapeRenderer renderer){ + if(renderer.isDrawing()) renderer.end(); + renderer.begin(ShapeRenderer.ShapeType.Filled); + renderer.setColor(Color.BLACK); + renderer.rect(xPos, yPos, 50,50); + renderer.setColor(Color.RED); + renderer.rect(xPos + 10, yPos + 30, 5, 10); + renderer.rect(xPos + 35, yPos + 30, 5, 10); + renderer.setColor(Color.WHITE); + renderer.rect(xPos + 10, yPos + 10, 30, 10); } public void move(){ diff --git a/core/src/com/trs/game/model/PermWall.java b/core/src/com/trs/game/model/PermWall.java index 8f64ce0..9c4314f 100644 --- a/core/src/com/trs/game/model/PermWall.java +++ b/core/src/com/trs/game/model/PermWall.java @@ -32,4 +32,5 @@ public class PermWall implements Wall { public void setRect(Rectangle rect) { this.rect = rect; } + } diff --git a/core/src/com/trs/game/model/Wall.java b/core/src/com/trs/game/model/Wall.java index f57bde8..66d18fb 100644 --- a/core/src/com/trs/game/model/Wall.java +++ b/core/src/com/trs/game/model/Wall.java @@ -1,5 +1,9 @@ package com.trs.game.model; +import com.badlogic.gdx.math.Rectangle; + public interface Wall { public Wall timerStep(); + public Rectangle getRect(); + public double getRotation(); }