Parcourir la source

Delete useless stuff in SquidPanel

smelc il y a 6 ans
Parent
commit
ded60dfdb4

+ 0 - 23
squidlib-util/src/main/java/squidpony/panel/ISquidPanel.java

@@ -12,15 +12,6 @@ package squidpony.panel;
  */
 public interface ISquidPanel<T> {
 
-	/**
-	 * Puts the character {@code c} at {@code (x, y)}.
-	 * 
-	 * @param x
-	 * @param y
-	 * @param c
-	 */
-	void put(int x, int y, char c);
-
 	/**
 	 * Puts {@code color} at {@code (x, y)} (in the cell's entirety, i.e. in the
 	 * background).
@@ -82,18 +73,4 @@ public interface ISquidPanel<T> {
 	 */
 	boolean hasActiveAnimations();
 
-	/**
-	 * Sets the default foreground color.
-	 * 
-	 * @param color
-	 */
-	void setDefaultForeground(T color);
-
-	/**
-	 * @return The default foreground color (if none was set with
-	 *         {@link #setDefaultForeground(Object)}), or the last color set with
-	 *         {@link #setDefaultForeground(Object)}. Cannot be {@code null}.
-	 */
-	T getDefaultForegroundColor();
-
 }

+ 0 - 74
squidlib/src/main/java/squidpony/squidgrid/gui/gdx/SquidPanel.java

@@ -1,6 +1,5 @@
 package squidpony.squidgrid.gui.gdx;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 
 import com.badlogic.gdx.Gdx;
@@ -34,7 +33,6 @@ public class SquidPanel extends Group implements ISquidPanel<Color> {
 
 	public float DEFAULT_ANIMATION_DURATION = 0.12F;
 	protected int animationCount = 0;
-	protected Color defaultForeground = Color.WHITE;
 	protected final int cellWidth, cellHeight;
 	protected int gridWidth, gridHeight, gridOffsetX = 0, gridOffsetY = 0;
 	protected final String[][] contents;
@@ -104,15 +102,6 @@ public class SquidPanel extends Group implements ISquidPanel<Color> {
 		animatedEntities = new OrderedSet<>();
 	}
 
-	/**
-	 * Places the given characters into the grid starting at 0,0.
-	 *
-	 * @param chars
-	 */
-	public void put(char[][] chars) {
-		put(0, 0, chars);
-	}
-
 	@Override
 	public void put(/* @Nullable */char[][] chars, Color[][] foregrounds) {
 		if (chars == null) {
@@ -127,10 +116,6 @@ public class SquidPanel extends Group implements ISquidPanel<Color> {
 			put(0, 0, chars, foregrounds);
 	}
 
-	public void put(int xOffset, int yOffset, char[][] chars) {
-		put(xOffset, yOffset, chars, defaultForeground);
-	}
-
 	public void put(int xOffset, int yOffset, char[][] chars, Color[][] foregrounds) {
 		for (int x = xOffset; x < xOffset + chars.length; x++) {
 			for (int y = yOffset; y < yOffset + chars[0].length; y++) {
@@ -141,50 +126,6 @@ public class SquidPanel extends Group implements ISquidPanel<Color> {
 		}
 	}
 
-	public void put(int xOffset, int yOffset, Color[][] foregrounds) {
-		for (int x = xOffset; x < xOffset + foregrounds.length; x++) {
-			for (int y = yOffset; y < yOffset + foregrounds[0].length; y++) {
-				if (x >= 0 && y >= 0 && x < gridWidth && y < gridHeight) {// check for valid input
-					put(x, y, '\0', foregrounds[x - xOffset][y - yOffset]);
-				}
-			}
-		}
-	}
-
-	public void put(int xOffset, int yOffset, int[][] indices, ArrayList<Color> palette) {
-		for (int x = xOffset; x < xOffset + indices.length; x++) {
-			for (int y = yOffset; y < yOffset + indices[0].length; y++) {
-				if (x >= 0 && y >= 0 && x < gridWidth && y < gridHeight) {// check for valid input
-					put(x, y, '\0', palette.get(indices[x - xOffset][y - yOffset]));
-				}
-			}
-		}
-	}
-
-	public void put(int xOffset, int yOffset, char[][] chars, Color foreground) {
-		for (int x = xOffset; x < xOffset + chars.length; x++) {
-			for (int y = yOffset; y < yOffset + chars[0].length; y++) {
-				if (x >= 0 && y >= 0 && x < gridWidth && y < gridHeight) {// check for valid input
-					put(x, y, chars[x - xOffset][y - yOffset], foreground);
-				}
-			}
-		}
-	}
-
-	/**
-	 * Erases the entire panel, leaving only a transparent space.
-	 */
-	public void erase() {
-		for (int i = 0; i < contents.length; i++) {
-			Arrays.fill(contents[i], "\0");
-			Arrays.fill(colors[i], Color.CLEAR);
-			/*
-			 * for (int j = 0; j < contents[i].length; j++) { contents[i][j] = "\0";
-			 * colors[i][j] = Color.CLEAR; }
-			 */
-		}
-	}
-
 	@Override
 	public void clear(int x, int y) {
 		put(x, y, Color.CLEAR);
@@ -195,11 +136,6 @@ public class SquidPanel extends Group implements ISquidPanel<Color> {
 		put(x, y, '\0', color);
 	}
 
-	@Override
-	public void put(int x, int y, char c) {
-		put(x, y, c, defaultForeground);
-	}
-
 	/**
 	 * Takes a unicode char for input.
 	 *
@@ -279,16 +215,6 @@ public class SquidPanel extends Group implements ISquidPanel<Color> {
 		ae.actor.draw(batch, parentAlpha);
 	}
 
-	@Override
-	public void setDefaultForeground(Color defaultForeground) {
-		this.defaultForeground = defaultForeground;
-	}
-
-	@Override
-	public Color getDefaultForegroundColor() {
-		return defaultForeground;
-	}
-
 	public AnimatedEntity getAnimatedEntityByCell(int x, int y) {
 		for (AnimatedEntity ae : animatedEntities) {
 			if (ae.gridX == x && ae.gridY == y)

+ 1 - 19
squidlib/src/main/java/squidpony/squidgrid/gui/gdx/SquidPanelBuilder.java

@@ -34,12 +34,6 @@ public abstract class SquidPanelBuilder extends IPanelBuilder.Skeleton {
 
 	protected final int fontOffset;
 
-	/**
-	 * The color passed to {@link SquidPanel#setDefaultForeground(Color)} when
-	 * building a new panel, if non-{@code null}.
-	 */
-	protected /* @Nullable */ Color defaultForegroundColor;
-
 	/**
 	 * @param smallestFont
 	 *            The smallest font size available.
@@ -112,10 +106,7 @@ public abstract class SquidPanelBuilder extends IPanelBuilder.Skeleton {
 
 		assert tcf != null;
 
-		final SquidPanel result = new SquidPanel(hCells, vCells, tcf, 0f, 0f);
-		if (defaultForegroundColor != null)
-			result.setDefaultForeground(defaultForegroundColor);
-		return result;
+		return new SquidPanel(hCells, vCells, tcf, 0f, 0f);
 	}
 
 	/**
@@ -174,15 +165,6 @@ public abstract class SquidPanelBuilder extends IPanelBuilder.Skeleton {
 		return sz % 2 == 0 && smallestFont <= sz && sz <= largestFont;
 	}
 
-	/**
-	 * @param c
-	 *            The default foreground color that freshly created panels will
-	 *            have. Can be {@code null} to use {@link SquidPanel}'s default.
-	 */
-	public void setDefaultForegroundColor(/* @Nullable */Color c) {
-		this.defaultForegroundColor = c;
-	}
-
 	/**
 	 * @param sz
 	 * @return The name of the file where the font of size {@code sz} lives.