Parcourir la source

More tightening

smelc il y a 6 ans
Parent
commit
b2b34ae83d

+ 20 - 58
squidlib/src/main/java/squidpony/squidgrid/gui/gdx/AnimatedEntity.java

@@ -1,66 +1,28 @@
 package squidpony.squidgrid.gui.gdx;
 
-import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.scenes.scene2d.Actor;
-import com.badlogic.gdx.scenes.scene2d.ui.Label;
-import squidpony.squidgrid.Direction;
-
-import java.util.Collection;
 
 /**
- * A simple class that wraps an Actor with its grid position, animating state, and if it is a double-width Actor.
- * Created by Tommy Ettinger on 7/22/2015.
+ * A simple class that wraps an Actor with its grid position, animating state,
+ * and if it is a double-width Actor. Created by Tommy Ettinger on 7/22/2015.
  */
-public class AnimatedEntity {
-    public Actor actor;
-    public int gridX, gridY;
-    public boolean animating = false;
-    public boolean doubleWidth = false;
-    public AnimatedEntity(Actor actor, int x, int y)
-    {
-        this.actor = actor;
-        gridX = x;
-        gridY = y;
-    }
-    public AnimatedEntity(Actor actor, int x, int y, boolean doubleWidth)
-    {
-        this.actor = actor;
-        gridX = x;
-        gridY = y;
-        this.doubleWidth = doubleWidth;
-    }
-    public void setText(String text)
-    {
-        if(actor.getClass() == Label.class)
-        {
-            ((Label)actor).setText(text);
-        }
-    }
+public final class AnimatedEntity {
+
+	final Actor actor;
+	int gridX, gridY;
+	boolean animating = false;
+	boolean doubleWidth = false;
+
+	public AnimatedEntity(Actor actor, int x, int y) {
+		this.actor = actor;
+		gridX = x;
+		gridY = y;
+	}
 
-    /**
-     * Rotates this so that "up" points in the specified direction. Only some Actors can actually be rotated; Images
-     * can, for example, but Labels cannot. This method is most likely to be used with
-     * {@link TextCellFactory#makeDirectionMarker(Color)},
-     * {@link TextCellFactory#makeDirectionMarker(Collection, float, boolean)}, or one of the directionMarker methods
-     * in SquidPanel or SquidLayers, since those produce an Image (or {@link ColorChangeImage}) that can be sensibly
-     * rotated to indicate a direction over a cell.
-     * @param dir the direction that "up" for this should point toward
-     */
-    public void setDirection(Direction dir) {
-        actor.setRotation(directionToDegrees(dir));
-    }
-    static float directionToDegrees(Direction d)
-    {
-        switch (d)
-        {
-            case UP_LEFT: return 45f;
-            case LEFT: return 90f;
-            case DOWN_LEFT: return 135f;
-            case DOWN: return 180f;
-            case DOWN_RIGHT: return 225f;
-            case RIGHT: return 270f;
-            case UP_RIGHT: return 315f;
-            default: return 0f;
-        }
-    }
+	public AnimatedEntity(Actor actor, int x, int y, boolean doubleWidth) {
+		this.actor = actor;
+		gridX = x;
+		gridY = y;
+		this.doubleWidth = doubleWidth;
+	}
 }

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

@@ -29,7 +29,7 @@ import squidpony.squidmath.OrderedSet;
  *
  * @author Eben Howard - http://squidpony.com - howard@squidpony.com
  */
-public class SquidPanel extends Group implements ISquidPanel<Color> {
+public final class SquidPanel extends Group implements ISquidPanel<Color> {
 
 	protected int animationCount = 0;
 	protected final int cellWidth, cellHeight;