this.mode = GuiSimulatorMode.SLICK_COMPONENT_DRAGDROP;
}
@Override
public void update(GameContainer gc, int delta) throws SlickException {
final Input input = gc.getInput();
final Point2d mouseClickedPointPosition = new Point2d(input.getMouseX(), input.getMouseY());
if (input.isKeyPressed(Input.KEY_S)) {
simulator.setSimulating(true);
} else if (input.isKeyPressed(Input.KEY_Q)) {
simulator.setSimulating(false);
}
// SETTING MODE
if (input.isKeyPressed(Input.KEY_F2)) {
this.mode = GuiSimulatorMode.REDIRECT_ROBOTS_TO_POINT;
} else if (input.isKeyPressed(Input.KEY_F1)) {
this.mode = GuiSimulatorMode.SLICK_COMPONENT_DRAGDROP;
deselectAllSelectableSlickComponents();
}
if (input.isKeyDown(Input.KEY_RIGHT)) {
simulator.setSimulatorSpeed(simulator.getSimulatorSpeed() + 5);
} else if (input.isKeyDown(Input.KEY_LEFT)) {
simulator.setSimulatorSpeed(simulator.getSimulatorSpeed() - 5);
}
// INTERPRETE MODE
if (mode == GuiSimulatorMode.REDIRECT_ROBOTS_TO_POINT) {
if (input.isMouseButtonDown(0)) {
redirectRobotsToPoint(mouseClickedPointPosition);
}
} else if (mode == GuiSimulatorMode.SLICK_COMPONENT_DRAGDROP || mode == GuiSimulatorMode.ROBOT_DRAGDROP_ROTATION) {
interpreteDragAndDropMode(input, mouseClickedPointPosition);
}