@Override
  public void draw(Coordinate coordinate, char character, Color color) {
    characterLocations.put(coordinate, new ColoredCharacter(character, color));

    if (!(coordinate.getX() < left
        || coordinate.getY() < top
        || coordinate.getX() > left + getDecoratedView().getWidth() - 1
        || coordinate.getY() > top + getDecoratedView().getHeight() - 1)) {
      Coordinate transformed = new Coordinate(coordinate.getX() - left, coordinate.getY() - top);
      getDecoratedView().draw(transformed, character, color);
    }
  }
Exemple #2
0
 public void draw(Coordinate coordinate, String string, Color color) {
   int currentX = coordinate.getX();
   int currentY = coordinate.getY();
   for (int i = 0; i < string.length(); i++) {
     if (string.charAt(i) == '\n') {
       currentX = coordinate.getX();
       currentY++;
     } else {
       draw(new Coordinate(currentX, currentY), string.charAt(i), color);
       currentX++;
     }
   }
 }