From 48d8fc2efc91f5a02391fb1031e7a662509f5630 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Wed, 11 May 2016 22:45:02 +0200 Subject: Implement client --- .../epfl/xblast/simulation/GraphicalSimulation.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'test/ch/epfl') diff --git a/test/ch/epfl/xblast/simulation/GraphicalSimulation.java b/test/ch/epfl/xblast/simulation/GraphicalSimulation.java index 9329cc7..1d15fe5 100644 --- a/test/ch/epfl/xblast/simulation/GraphicalSimulation.java +++ b/test/ch/epfl/xblast/simulation/GraphicalSimulation.java @@ -12,11 +12,7 @@ import ch.epfl.xblast.server.painter.BoardPainter; import javax.swing.*; import java.awt.*; -import java.awt.event.KeyEvent; -import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.function.Consumer; /** @@ -31,19 +27,6 @@ public class GraphicalSimulation extends Simulation { private static final Consumer PLAYER_ACTION_CONSUMER = System.out::println; private static final PlayerID MAIN_PLAYER = PlayerID.PLAYER_1; - private static Map buildPlayerActionMap() { - Map playerActionMap = new HashMap<>(); - - playerActionMap.put(KeyEvent.VK_UP, PlayerAction.MOVE_N); - playerActionMap.put(KeyEvent.VK_RIGHT, PlayerAction.MOVE_E); - playerActionMap.put(KeyEvent.VK_DOWN, PlayerAction.MOVE_S); - playerActionMap.put(KeyEvent.VK_LEFT, PlayerAction.MOVE_W); - playerActionMap.put(KeyEvent.VK_SPACE, PlayerAction.DROP_BOMB); - playerActionMap.put(KeyEvent.VK_SHIFT, PlayerAction.STOP); - - return Collections.unmodifiableMap(playerActionMap); - } - private static ch.epfl.xblast.client.GameState translateToClientData(GameState gs) { List serializedGameState = GameStateSerializer.serialize(BOARD_PAINTER, gs); return GameStateDeserializer.deserialize(serializedGameState); @@ -61,7 +44,7 @@ public class GraphicalSimulation extends Simulation { } private void attachKeyboardHandler(Component comp) { - comp.addKeyListener(new KeyboardEventHandler(buildPlayerActionMap(), PLAYER_ACTION_CONSUMER)); + comp.addKeyListener(new KeyboardEventHandler(PLAYER_ACTION_CONSUMER)); comp.requestFocusInWindow(); } -- cgit v1.2.3