Beispiel #1
0
  private Region generateClosedDoorPane(int n, int e, int s, int w) {
    Region closedDoor = new Region();
    closedDoor.setPrefHeight(CELL_SIZE);
    closedDoor.setPrefWidth(CELL_SIZE);

    int north_gap = BORDER_WIDTH,
        east_gap = BORDER_WIDTH,
        south_gap = BORDER_WIDTH,
        west_gap = BORDER_WIDTH;

    if (n == 3) {
      north_gap = 0;
    }
    if (e == 3) {
      east_gap = 0;
    }
    if (s == 3) {
      south_gap = 0;
    }
    if (w == 3) {
      west_gap = 0;
    }

    Insets gap = new Insets(north_gap, east_gap, south_gap, west_gap);
    closedDoor.setBackground(
        new Background(new BackgroundFill(CLOSED_DOOR_COLOR, CornerRadii.EMPTY, gap)));

    return closedDoor;
  }
  public void setLayoutBounds(Bounds layoutBounds) {

    // Setup layoutX/layoutY on the image view and the region (1)
    region.setLayoutX(layoutBounds.getMinX());
    region.setLayoutY(layoutBounds.getMinY());
    region.setPrefWidth(layoutBounds.getWidth());
    region.setPrefHeight(layoutBounds.getHeight());
  }
Beispiel #3
0
  private Region generateFloorSurfacePane(int t, int n, int e, int s, int w) {
    Region floor = new Region();
    floor.setPrefHeight(CELL_SIZE);
    floor.setPrefWidth(CELL_SIZE);

    Color floorSurface = Color.web("fff");
    switch (t) {
      case (0):
        floorSurface = BARE_FLOOR_COLOR;
        break;
      case (1):
        floorSurface = LOW_PILE_COLOR;
        break;
      case (2):
        floorSurface = HIGH_PILE_COLOR;
        break;
      case (3):
        // TODO: replace with stair color
        floorSurface = Color.web("f00");
        break;
      default:
        System.out.println("Unsupported floor type");
        break;
    }

    int floor_n = 0, floor_e = 0, floor_s = 0, floor_w = 0;
    if (n > 0) {
      floor_n = BORDER_WIDTH;
    }
    if (e > 0) {
      floor_e = BORDER_WIDTH;
    }
    if (s > 0) {
      floor_s = BORDER_WIDTH;
    }
    if (w > 0) {
      floor_w = BORDER_WIDTH;
    }
    Insets floorGap = new Insets(floor_n, floor_e, floor_s, floor_w);
    floor.setBackground(
        new Background(new BackgroundFill(floorSurface, CornerRadii.EMPTY, floorGap)));

    return floor;
  }