From 3a147161307dd8189243fba8d1c2283a6bba1122 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Thu, 1 Feb 2018 22:07:24 +0100 Subject: Clearing TODOs --- .../java/fr/umlv/java/wallj/block/RobotBlock.java | 2 +- src/main/java/fr/umlv/java/wallj/block/Stage.java | 43 --------------------- .../java/fr/umlv/java/wallj/context/Context.java | 1 - .../fr/umlv/java/wallj/context/InputHandler.java | 1 - .../fr/umlv/java/wallj/context/ScreenManager.java | 1 - .../java/wallj/controller/DisplayController.java | 12 ------ .../fr/umlv/java/wallj/event/ConfirmOrder.java | 1 - .../fr/umlv/java/wallj/event/GameOverEvent.java | 1 - .../wallj/controller/DisplayControllerTest.java | 44 ++++++++++++++++++++++ 9 files changed, 45 insertions(+), 61 deletions(-) delete mode 100644 src/main/java/fr/umlv/java/wallj/block/Stage.java delete mode 100644 src/main/java/fr/umlv/java/wallj/controller/DisplayController.java create mode 100644 src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java diff --git a/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java b/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java index c011f27..f5e2584 100644 --- a/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java +++ b/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java @@ -24,7 +24,6 @@ import java.util.List; */ public class RobotBlock extends Block { // TODO: define robot moving speed - private Vec2 pos; private List path = Collections.emptyList(); private PathFinder pathFinder; @@ -68,6 +67,7 @@ public class RobotBlock extends Block { private void move(Duration timeDelta) { // TODO: follow the current path + } private void paint(GraphicsContext graphicsContext) { diff --git a/src/main/java/fr/umlv/java/wallj/block/Stage.java b/src/main/java/fr/umlv/java/wallj/block/Stage.java deleted file mode 100644 index 5d2d07c..0000000 --- a/src/main/java/fr/umlv/java/wallj/block/Stage.java +++ /dev/null @@ -1,43 +0,0 @@ -package fr.umlv.java.wallj.block; - -import fr.umlv.java.wallj.board.Board; -import fr.umlv.java.wallj.context.Context; -import fr.umlv.java.wallj.event.Event; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -/** - * @author - */ -public class Stage { - //TODO Class Stage - private final Board currentBoard; - - public Stage(Board board) { - currentBoard = Objects.requireNonNull(board); - } - - /** - * @return the current board of the game - */ - public Board getCurrentBoard() { - return currentBoard; - } - - /** - * @param context the current context - * @return a list of new events to perform - */ - public List update(Context context) { - //TODO - return Collections.emptyList(); - } - - public boolean isCleared() { - // TODO - return false; - } - -} diff --git a/src/main/java/fr/umlv/java/wallj/context/Context.java b/src/main/java/fr/umlv/java/wallj/context/Context.java index a8796e5..bfb46bd 100644 --- a/src/main/java/fr/umlv/java/wallj/context/Context.java +++ b/src/main/java/fr/umlv/java/wallj/context/Context.java @@ -12,7 +12,6 @@ import java.util.Objects; * @author Adam NAILI */ public final class Context { - //TODO Class Context private final Game game; private final List events; private final GraphicsContext graphicsContext; diff --git a/src/main/java/fr/umlv/java/wallj/context/InputHandler.java b/src/main/java/fr/umlv/java/wallj/context/InputHandler.java index 2dcd512..b137061 100644 --- a/src/main/java/fr/umlv/java/wallj/context/InputHandler.java +++ b/src/main/java/fr/umlv/java/wallj/context/InputHandler.java @@ -22,7 +22,6 @@ import java.util.Objects; * @author Adam NAILI */ public final class InputHandler { - //TODO Class InputHandler private final ApplicationContext applicationContext; /** diff --git a/src/main/java/fr/umlv/java/wallj/context/ScreenManager.java b/src/main/java/fr/umlv/java/wallj/context/ScreenManager.java index 2f28ac9..1e73674 100644 --- a/src/main/java/fr/umlv/java/wallj/context/ScreenManager.java +++ b/src/main/java/fr/umlv/java/wallj/context/ScreenManager.java @@ -13,7 +13,6 @@ import java.util.Objects; * @author Adam NAILI */ public final class ScreenManager { - //TODO Class ScreenManager private final ApplicationContext applicationContext; private final Graphics2D graphics2D; diff --git a/src/main/java/fr/umlv/java/wallj/controller/DisplayController.java b/src/main/java/fr/umlv/java/wallj/controller/DisplayController.java deleted file mode 100644 index c970e1f..0000000 --- a/src/main/java/fr/umlv/java/wallj/controller/DisplayController.java +++ /dev/null @@ -1,12 +0,0 @@ -package fr.umlv.java.wallj.controller; - -import fr.umlv.java.wallj.block.Block; - -public abstract class DisplayController extends BlockController { - - DisplayController(Block block) { - super(block); - } - - //TODO -} diff --git a/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java b/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java index fae6d2f..a3e3525 100644 --- a/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java +++ b/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java @@ -6,5 +6,4 @@ package fr.umlv.java.wallj.event; * @author Adam NAILI */ public class ConfirmOrder implements InputEvent { - //TODO Class ConfirmOrder } diff --git a/src/main/java/fr/umlv/java/wallj/event/GameOverEvent.java b/src/main/java/fr/umlv/java/wallj/event/GameOverEvent.java index eeee927..93ec049 100644 --- a/src/main/java/fr/umlv/java/wallj/event/GameOverEvent.java +++ b/src/main/java/fr/umlv/java/wallj/event/GameOverEvent.java @@ -1,5 +1,4 @@ package fr.umlv.java.wallj.event; public final class GameOverEvent implements GameEvent { - // TODO } diff --git a/src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java b/src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java new file mode 100644 index 0000000..bcd4de9 --- /dev/null +++ b/src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java @@ -0,0 +1,44 @@ +package fr.umlv.java.wallj.controller; + +import fr.umlv.java.wallj.board.Board; +import fr.umlv.java.wallj.board.TileVec2; +import fr.umlv.java.wallj.context.Context; +import fr.umlv.java.wallj.context.Game; +import fr.umlv.java.wallj.context.ScreenManager; +import fr.umlv.java.wallj.block.Block; +import fr.umlv.java.wallj.block.BlockFactory; +import fr.umlv.java.wallj.block.BlockType; +import fr.umlv.zen5.Application; +import org.junit.jupiter.api.Test; + +import java.awt.*; +import java.util.Collections; +import java.util.LinkedList; + +public class DisplayControllerTest { + @Test + void TestDisplay() throws java.lang.InterruptedException { + + Application.run(Color.WHITE, applicationContext -> { + for (; ; ) { + applicationContext.renderFrame(graphics2D -> { + Board.Builder builder = new Board.Builder(51, 51); + TileVec2 t0 = TileVec2.of(50, 50); + builder.setBlockTypeAt(t0, BlockType.WALL); + LinkedList boards = new LinkedList<>(); + boards.add(builder.build()); + Game game = new Game(boards); + ScreenManager screenManager = new ScreenManager(applicationContext, graphics2D); + try { + Thread.sleep(50); + } catch (Exception e) { + System.exit(-1); + } + Context context = new Context(game, Collections.emptyList(), screenManager.clearScreen()); + Block block = BlockFactory.build(BlockType.BOMB, t0); + block.update(context); + }); + } + }); + } +} -- cgit v1.2.3