Explorar el Código

Remove tests files

smelc hace 7 años
padre
commit
ad8dd81053

+ 0 - 5
.classpath

@@ -15,11 +15,6 @@
 			<attribute name="FROM_GRADLE_MODEL" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="src" path="squidlib/src/test/java">
-		<attributes>
-			<attribute name="FROM_GRADLE_MODEL" value="true"/>
-		</attributes>
-	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="/home/churlin/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.6/47d1e9b890e364ec28f128e9bb3b9a12a94c164/gdx-1.9.6.jar" sourcepath="/home/churlin/PERSONNEL/hgames/gdx-1.9.6-sources.jar"/>
 	<classpathentry kind="lib" path="/home/churlin/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-lwjgl/1.9.6/ee7c23636ee4a942d329579daecc3ec5e517fe4c/gdx-backend-lwjgl-1.9.6.jar" sourcepath="/home/churlin/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-lwjgl/1.9.6/54887b828ab0c6c55deae03b0cca70c31531bacd/gdx-backend-lwjgl-1.9.6-sources.jar"/>

+ 0 - 24
build.gradle

@@ -23,15 +23,6 @@ sourceSets {
 	    // which isn't useful anymore.
         }
     }
-    test {
-    	java {
-            srcDirs 'squidlib/src/test/java'
-            srcDirs 'squidlib-util/src/test/java'
-            srcDirs 'squidlib-util/src/test/resources'
-
-            // srcDirs 'squidlib-performance/src/main/java' <- requires org.openjdk
-    	}
-    }
 }
 
 // define 'gdxVersion' if not defined yet. This allows
@@ -39,21 +30,6 @@ sourceSets {
 // 'gdxVersion' itself, and yet be able to build SquidLib standalone too.
 def gdxVersion = System.getenv("gdxVersion") ?: "1.9.6" // As in pom.xml
 
-// In this section you declare the dependencies for your production and test code
 dependencies {
 	compile "com.badlogicgames.gdx:gdx:$gdxVersion"
-
-	testCompile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
-	testCompile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
-	testCompile 'junit:junit:4.12'
-}
-
-// Execute with 'gradle everythingDemo' (add --info to get debug info)
-task(everythingDemo, type: JavaExec) {
-    main = 'squidpony.gdx.examples.desktop.EverythingDemoLauncher'
-    // smelC: It would be nice to automatically add the three following
-    // lines to any 'JavaExec' task, but I could not find how to do it.
-    classpath(sourceSets.test.runtimeClasspath,project.assetsDir)
-    standardInput = System.in
-    ignoreExitValue = true
 }

+ 0 - 521
squidlib/src/test/java/squidpony/gdx/examples/CoveredPathDemo.java

@@ -1,521 +0,0 @@
-package squidpony.gdx.examples;
-
-import com.badlogic.gdx.ApplicationAdapter;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.SpriteBatch;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.utils.viewport.ScreenViewport;
-import squidpony.squidai.DijkstraMap;
-import squidpony.squidai.Technique;
-import squidpony.squidai.Threat;
-import squidpony.squidgrid.FOVCache;
-import squidpony.squidgrid.Radius;
-import squidpony.squidgrid.gui.gdx.*;
-import squidpony.squidgrid.mapping.DungeonGenerator;
-import squidpony.squidgrid.mapping.DungeonUtility;
-import squidpony.squidgrid.mapping.SerpentMapGenerator;
-import squidpony.squidmath.*;
-
-import java.util.*;
-
-public class CoveredPathDemo extends ApplicationAdapter {
-    private enum Phase {MOVE_ANIM, ATTACK_ANIM}
-    private static class Creature
-    {
-        public AnimatedEntity entity;
-        public int health;
-        public DijkstraMap dijkstra;
-        public ArrayList<Coord> previousPositions;
-
-        public Creature(AnimatedEntity ae, int hp, DijkstraMap dijkstraMap)
-        {
-            entity = ae;
-            health = hp;
-            dijkstra = dijkstraMap;
-            previousPositions = new ArrayList<>(16);
-        }
-    }
-    SpriteBatch batch;
-
-    private Phase phase = Phase.ATTACK_ANIM;
-    private RNG rng;
-    private LightRNG lrng;
-    private SquidLayers display;
-    private DungeonGenerator dungeonGen;
-    private char[][] bareDungeon, lineDungeon, decoDungeon;
-    private double[][] res;
-    private int[][] colors, bgColors, lights;
-    private int width, height;
-    private int cellWidth, cellHeight;
-    private int numMonsters = 25;
-    private Radius radiusKind = Radius.DIAMOND;
-
-    private SquidInput input;
-    private static final Color bgColor = SColor.DARK_SLATE_GRAY;
-    private ArrayList<Creature> teamRed, teamBlue;
-    private OrderedSet<Coord> redPlaces, bluePlaces;
-    private OrderedSet<Threat> redThreats, blueThreats;
-    private DijkstraMap getToRed, getToBlue;
-    private Stage stage;
-    private int framesWithoutAnimation = 0, moveLength = 6;
-    private ArrayList<Coord> awaitedMoves;
-    private int scheduledMoves = 0, whichIdx = 0;
-    private boolean blueTurn = false;
-    private double frames = 0.0;
-    boolean late = false;
-
-    private FOVCache cache;
-    @Override
-    public void create () {
-        batch = new SpriteBatch();
-        width = 60;
-        height = 50;
-        cellWidth = 6;
-        cellHeight = 12;
-        display = new SquidLayers(width, height, cellWidth, cellHeight, DefaultResources.narrowName);
-        display.setAnimationDuration(0.09f);
-        display.addExtraLayer();
-        stage = new Stage(new ScreenViewport(), batch);
-
-        lrng = new LightRNG(0x1337BEEF);
-        rng = new RNG(lrng);
-
-        dungeonGen = new DungeonGenerator(width, height, rng);
-//        dungeonGen.addWater(10);
-        //dungeonGen.addDoors(15, true);
-        dungeonGen.addBoulders(25);
-        SerpentMapGenerator serpent = new SerpentMapGenerator(width, height, rng);
-        serpent.putWalledBoxRoomCarvers(1);
-        // change the TilesetType to lots of different choices to see what dungeon works best.
-        dungeonGen.generate(serpent.generate());
-        bareDungeon = dungeonGen.getBareDungeon();
-        decoDungeon = dungeonGen.getDungeon();
-        cache = new FOVCache(bareDungeon, 9, radiusKind);
-        lineDungeon = DungeonUtility.hashesToLines(decoDungeon);
-        // it's more efficient to get random floors from a packed set containing only (compressed) floor positions.
-        short[] placement = CoordPacker.pack(bareDungeon, '.');
-
-        teamRed = new ArrayList<>(numMonsters);
-        teamBlue = new ArrayList<>(numMonsters);
-
-        redPlaces = new OrderedSet<>(numMonsters);
-        bluePlaces = new OrderedSet<>(numMonsters);
-
-        redThreats = new OrderedSet<>(numMonsters);
-        blueThreats = new OrderedSet<>(numMonsters);
-        for(int i = 0; i < numMonsters; i++)
-        {
-            Coord monPos = dungeonGen.utility.randomCell(placement);
-            placement = CoordPacker.removePacked(placement, monPos.x, monPos.y);
-
-            teamRed.add(new Creature(display.animateActor(monPos.x, monPos.y, "9", 11), 9,
-                    new DijkstraMap(bareDungeon, DijkstraMap.Measurement.MANHATTAN, rng)));
-            redPlaces.add(monPos);
-            redThreats.add(new Threat(monPos, 0, 1));
-
-            Coord monPosBlue = dungeonGen.utility.randomCell(placement);
-            placement = CoordPacker.removePacked(placement, monPosBlue.x, monPosBlue.y);
-
-            teamBlue.add(new Creature(display.animateActor(monPosBlue.x, monPosBlue.y, "9", 25), 9,
-                    new DijkstraMap(bareDungeon, DijkstraMap.Measurement.MANHATTAN, rng)));
-            bluePlaces.add(monPosBlue);
-            blueThreats.add(new Threat(monPosBlue, 3, 5));
-        }
-        res = DungeonUtility.generateResistances(bareDungeon);
-
-        getToRed = new DijkstraMap(bareDungeon, DijkstraMap.Measurement.MANHATTAN);
-        getToRed.rng = rng;
-        getToBlue = new DijkstraMap(bareDungeon, DijkstraMap.Measurement.MANHATTAN);
-        getToBlue.rng = rng;
-
-        awaitedMoves = new ArrayList<>(10);
-        colors = DungeonUtility.generatePaletteIndices(decoDungeon);
-        bgColors = DungeonUtility.generateBGPaletteIndices(decoDungeon);
-        lights = DungeonUtility.generateLightnessModifiers(decoDungeon, frames);
-
-        // just quit if we get a Q.
-        input = new SquidInput(new SquidInput.KeyHandler() {
-            @Override
-            public void handle(char key, boolean alt, boolean ctrl, boolean shift) {
-                switch (key)
-                {
-                    case 'Q':
-                    case 'q':
-                    case SquidInput.ESCAPE:
-                    {
-                        Gdx.app.exit();
-                    }
-                    break;
-                    default:
-                        scheduledMoves++;
-                }
-            }
-        });
-        // ABSOLUTELY NEEDED TO HANDLE INPUT
-        // and then add display, our one visual component, to the list of things that act in Stage.
-        display.setPosition(0, 0);
-        stage.addActor(display);
-        cache.awaitCache();
-        Gdx.input.setInputProcessor(input);
-
-
-    }
-
-    /**
-     * Move a unit toward a good position to attack, but don't attack in this method.
-     * @param idx the index of the unit in the appropriate ordered Map.
-     */
-    private void startMove(int idx) {
-//        if(health <= 0) return;
-        int i = 0, myMin, myMax;
-        DijkstraMap whichDijkstra = null;
-        Technique whichTech;
-        Set<Coord> whichFoes, whichAllies;
-        OrderedSet<Threat> whichThreats;
-        AnimatedEntity ae = null;
-        int health = 0;
-        Coord user = null;
-        if(blueTurn) {
-            whichFoes = redPlaces;
-            whichAllies = bluePlaces;
-            whichThreats = redThreats;
-            myMin = 3;
-            myMax = 5;
-
-            Creature entry = teamBlue.get(idx);
-            ae = entry.entity;
-            health = entry.health;
-            whichDijkstra = entry.dijkstra;
-            user = Coord.get(ae.gridX, ae.gridY);
-            entry.previousPositions.add(user);
-        }
-        else {
-            whichFoes = bluePlaces;
-            whichAllies = redPlaces;
-            whichThreats = blueThreats;
-            myMin = 0;
-            myMax = 1;
-            Creature entry = teamRed.get(idx);
-            ae = entry.entity;
-            health = entry.health;
-            whichDijkstra = entry.dijkstra;
-            user = Coord.get(ae.gridX, ae.gridY);
-            entry.previousPositions.add(user);
-        }
-        if(whichDijkstra == null || health <= 0) {
-            phase = Phase.MOVE_ANIM;
-            return;
-        }
-        whichAllies.remove(user);
-        /*for(Coord p : whichFoes)
-        {
-            AnimatedEntity foe = display.getAnimatedEntityByCell(p.x, p.y);
-            if(los.isReachable(res, user.x, user.y, p.x, p.y) && foe != null && whichEnemyTeam.get(foe) != null && whichEnemyTeam.get(foe) > 0)
-            {
-                visibleTargets.add(p);
-            }
-        }*/
-        ArrayList<Coord> path = whichDijkstra.findCoveredAttackPath(moveLength, myMin, myMax, 1.0, cache, true, whichFoes,
-                whichAllies, whichThreats, user, whichFoes.toArray(new Coord[whichFoes.size()]));
-        /*
-        System.out.println("User at (" + user.x + "," + user.y + ") using " +
-                whichTech.name);
-        */
-        /*
-        boolean anyFound = false;
-
-        for (int yy = 0; yy < height; yy++) {
-            for (int xx = 0; xx < width; xx++) {
-                System.out.print((whichDijkstra.targetMap[xx][yy] == null) ? "." : "@");
-                anyFound = (whichDijkstra.targetMap[xx][yy] != null) ? true : anyFound;
-            }
-            System.out.println();
-        }*/
-        if(path.isEmpty())
-            path.add(user);
-        awaitedMoves = new ArrayList<>(path);
-    }
-
-    public void move(AnimatedEntity ae, int newX, int newY) {
-        display.slide(ae, newX, newY);
-        phase = Phase.MOVE_ANIM;
-
-    }
-
-    // check if a monster's movement would overlap with another monster.
-    @SuppressWarnings("unused")
-	private boolean checkOverlap(AnimatedEntity ae, int x, int y)
-    {
-        for(Creature mon : teamRed)
-        {
-            if(mon.entity.gridX == x && mon.entity.gridY == y && !mon.entity.equals(ae))
-                return true;
-        }
-        for(Creature mon : teamBlue)
-        {
-            if(mon.entity.gridX == x && mon.entity.gridY == y && !mon.entity.equals(ae))
-                return true;
-        }
-        return false;
-    }
-
-    private void postMove(int idx) {
-
-        int i = 0, myMax, myMin;
-        OrderedSet<Coord> whichFoes, whichAllies, visibleTargets = new OrderedSet<>(8);
-        AnimatedEntity ae = null;
-        int health = 0;
-        Coord user = null;
-        DijkstraMap dijkstra = null;
-        ArrayList<Coord> previous = null;
-        Color whichTint = Color.WHITE;
-        ArrayList<Creature> whichEnemyTeam;
-        OrderedSet<Threat> myThreats, enemyThreats;
-        if (blueTurn) {
-            whichFoes = redPlaces;
-            whichAllies = bluePlaces;
-            whichTint = Color.CYAN;
-            whichEnemyTeam = teamRed;
-            myThreats = blueThreats;
-            enemyThreats = redThreats;
-            myMin = 3;
-            myMax = 5;
-            Creature entry = teamBlue.get(idx);
-            ae = entry.entity;
-            health = entry.health;
-            dijkstra = entry.dijkstra;
-            previous = entry.previousPositions;
-            user = Coord.get(ae.gridX, ae.gridY);
-        } else {
-            whichFoes = bluePlaces;
-            whichAllies = redPlaces;
-            whichTint = Color.RED;
-            whichEnemyTeam = teamBlue;
-            myThreats = redThreats;
-            enemyThreats = blueThreats;
-            myMin = 0;
-            myMax = 1;
-
-            Creature entry = teamRed.get(idx);
-            ae = entry.entity;
-            health = entry.health;
-            dijkstra = entry.dijkstra;
-            previous = entry.previousPositions;
-            user = Coord.get(ae.gridX, ae.gridY);
-        }
-        myThreats.getAt(idx).position = user;
-
-        if (health <= 0 || dijkstra == null) {
-            myThreats.getAt(idx).reach.maxDistance = 0;
-            myThreats.getAt(idx).reach.minDistance = 0;
-            phase = Phase.ATTACK_ANIM;
-            return;
-        }
-        dijkstra.deteriorate(previous);
-        for(Creature creature : whichEnemyTeam)
-        {
-            if(cache.queryLOS(user.x, user.y, creature.entity.gridX, creature.entity.gridY) &&
-                    creature.health > 0 &&
-                    radiusKind.radius(user.x, user.y, creature.entity.gridX, creature.entity.gridY) <= myMax &&
-                    radiusKind.radius(user.x, user.y, creature.entity.gridX, creature.entity.gridY) >= myMin)
-            {
-                visibleTargets.add(Coord.get(creature.entity.gridX, creature.entity.gridY));
-            }
-        }
-        Coord targetCell = null;
-        for(Coord vt : visibleTargets)
-        {
-            targetCell = vt;
-            break;
-        }
-
-        if(targetCell != null) {
-            whichTint.a = 0.5f;
-            int successfulKill = -1, ix = 0;
-            display.tint(targetCell.x, targetCell.y, whichTint, 0, display.getAnimationDuration());
-            for (Creature mon : whichEnemyTeam) {
-                if (mon.entity.gridX == targetCell.x && mon.entity.gridY == targetCell.y) {
-                    int currentHealth = Math.max(mon.health - 3, 0);
-                    mon.health = currentHealth;
-                    if (currentHealth <= 0) {
-                        successfulKill = ix;
-                    }
-                    mon.entity.setText(Integer.toString(currentHealth));
-                }
-                ix++;
-            }
-            if (successfulKill >= 0 && successfulKill < enemyThreats.size()) {
-                Threat succ = enemyThreats.getAt(successfulKill);
-                enemyThreats.remove(succ);
-                Coord deadPos = succ.position;
-                AnimatedEntity deadAE = whichEnemyTeam.get(successfulKill).entity;
-                display.removeAnimatedEntity(deadAE);
-                whichFoes.remove(deadPos);
-            }
-
-        }
-        /*
-        else
-        {
-
-            System.out.println("NO ATTACK POSITION: User at (" + user.x + "," + user.y + ") using " +
-                    whichTech.name);
-
-            display.tint(user.x * 2    , user.y, highlightColor, 0, display.getAnimationDuration() * 3);
-            display.tint(user.x * 2 + 1, user.y, highlightColor, 0, display.getAnimationDuration() * 3);
-        }
-        */
-        whichAllies.add(user);
-
-        phase = Phase.ATTACK_ANIM;
-    }
-    public void putMap()
-    {
-        lights = DungeonUtility.generateLightnessModifiers(decoDungeon, frames);
-        for (int i = 0; i < width; i++) {
-            for (int j = 0; j < height; j++) {
-                display.put(i, j, lineDungeon[i][j], colors[i][j], bgColors[i][j], lights[i][j]);
-            }
-        }
-    }
-    @Override
-    public void render () {
-        // standard clear the background routine for libGDX
-        Gdx.gl.glClearColor(bgColor.r / 255.0f, bgColor.g / 255.0f, bgColor.b / 255.0f, 1.0f);
-        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-        // not sure if this is always needed...
-        Gdx.gl.glEnable(GL20.GL_BLEND);
-        frames  += Gdx.graphics.getDeltaTime() * 15;
-        stage.act();
-        boolean blueWins = false, redWins = false;
-        for(Creature blueHealth : teamBlue)
-        {
-            if(blueHealth.health > 0) {
-                redWins = false;
-                break;
-            }
-            redWins = true;
-        }
-        for(Creature redHealth : teamRed)
-        {
-            if(redHealth.health > 0) {
-                blueWins = false;
-                break;
-            }
-            blueWins = true;
-        }
-        if (blueWins) {
-            // still need to display the map, then write over it with a message.
-            putMap();
-            display.putBoxedString(width / 2 - 11, height / 2 - 1, "  BLUE TEAM WINS!  ");
-            display.putBoxedString(width / 2 - 11, height / 2 + 5, "     q to quit.    ");
-
-            // because we return early, we still need to draw.
-            stage.draw();
-            // q still needs to quit.
-            if(input.hasNext())
-                input.next();
-            return;
-        }
-        else if(redWins)
-        {
-            putMap();
-            display.putBoxedString(width / 2 - 11, height / 2 - 1, "   RED TEAM WINS!  ");
-            display.putBoxedString(width / 2 - 11, height / 2 + 5, "     q to quit.    ");
-
-            // because we return early, we still need to draw.
-            stage.draw();
-            // q still needs to quit.
-            if(input.hasNext())
-                input.next();
-            return;
-        }
-        int i = 0;
-        AnimatedEntity ae = null;
-        if(blueTurn) {
-            Creature entry = teamBlue.get(whichIdx);
-            ae = entry.entity;
-
-        }
-        else {
-            Creature entry = teamRed.get(whichIdx);
-            ae = entry.entity;
-        }
-
-        // need to display the map every frame, since we clear the screen to avoid artifacts.
-        putMap();
-        // if we are waiting for the player's input and get input, process it.
-        if(input.hasNext()) {
-            input.next();
-        }
-        if(!awaitedMoves.isEmpty())
-        {
-            if(ae == null) {
-                awaitedMoves.clear();
-            }
-            // extremely similar to the block below that also checks if animations are done
-            // this doesn't check for input, but instead processes and removes Points from awaitedMoves.
-            else if(!display.hasActiveAnimations()) {
-                ++framesWithoutAnimation;
-                if (framesWithoutAnimation >= 3) {
-                    framesWithoutAnimation = 0;
-                    Coord m = awaitedMoves.remove(0);
-                    move(ae, m.x, m.y);
-                }
-            }
-        }
-        // if the previous blocks didn't happen, and there are no active animations, then either change the phase
-        // (because with no animations running the last phase must have ended), or start a new animation soon.
-        else if(!display.hasActiveAnimations()) {
-            ++framesWithoutAnimation;
-            if (framesWithoutAnimation >= 6) {// && scheduledMoves > 0) {
-                //System.out.println("frames: " + framesWithoutAnimation + "scheduled: " + scheduledMoves);
-                framesWithoutAnimation = 0;
-                switch (phase) {
-                    case ATTACK_ANIM: {
-                        phase = Phase.MOVE_ANIM;
-                        blueTurn = !blueTurn;
-                        if(!blueTurn)
-                        {
-                            if(whichIdx + 1 >= numMonsters)
-                                late = true;
-                            whichIdx = (whichIdx + 1) % numMonsters;
-                        }
-                        startMove(whichIdx);
-                    }
-                    break;
-                    case MOVE_ANIM: {
-                        //scheduledMoves = Math.max(scheduledMoves - 1, 0);
-                        postMove(whichIdx);
-                    }
-                }
-            }
-        }
-        // if we do have an animation running, then how many frames have passed with no animation needs resetting
-        else
-        {
-            framesWithoutAnimation = 0;
-        }
-
-        // stage has its own batch and must be explicitly told to draw(). this also causes it to act().
-        stage.draw();
-
-        // disolay does not draw all AnimatedEntities by default.
-        batch.begin();
-        for(AnimatedEntity mon : display.getAnimatedEntities(0)) {
-            display.drawActor(batch, 1.0f, mon, 0);
-        }
-        for(AnimatedEntity mon : display.getAnimatedEntities(2)) {
-            display.drawActor(batch, 1.0f, mon, 2);
-        }
-        /*
-        for(AnimatedEntity mon : teamBlue.keySet()) {
-                display.drawActor(batch, 1.0f, mon);
-        }*/
-        // batch must end if it began.
-        batch.end();
-    }
-}
-

+ 0 - 151
squidlib/src/test/java/squidpony/gdx/examples/ImageDemo.java

@@ -1,151 +0,0 @@
-package squidpony.gdx.examples;
-
-import com.badlogic.gdx.ApplicationAdapter;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.SpriteBatch;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.utils.viewport.ScreenViewport;
-import squidpony.squidgrid.gui.gdx.*;
-import squidpony.squidgrid.mapping.DungeonGenerator;
-import squidpony.squidgrid.mapping.DungeonUtility;
-import squidpony.squidgrid.mapping.styled.TilesetType;
-import squidpony.squidmath.Coord;
-import squidpony.squidmath.LightRNG;
-import squidpony.squidmath.RNG;
-
-import java.util.HashMap;
-
-public class ImageDemo extends ApplicationAdapter {
-    SpriteBatch batch;
-
-    private RNG rng;
-    private LightRNG lrng;
-    private SquidLayers display;
-    private DungeonGenerator dungeonGen;
-    private char[][] bareDungeon, lineDungeon;
-    private int[][] colors, bgColors, lights;
-    private int width, height;
-    private int cellWidth, cellHeight;
-    private SquidInput input;
-    private double counter;
-    private static final Color bgColor = SColor.DARK_SLATE_GRAY;
-    private HashMap<Coord, AnimatedEntity> creatures;
-    private Stage stage;
-    @Override
-    public void create () {
-        batch = new SpriteBatch();
-        width = 30;
-        height = 20;
-        cellWidth = 18;
-        cellHeight = 36;
-        display = new SquidLayers(width * 2, height, cellWidth, cellHeight, DefaultResources.narrowNameExtraLarge);
-        display.setAnimationDuration(0.03f);
-        stage = new Stage(new ScreenViewport(), batch);
-
-        counter = 0;
-        lrng = new LightRNG(0x1337BEEF);
-        rng = new RNG(lrng);
-
-        dungeonGen = new DungeonGenerator(width, height, rng);
-        dungeonGen.addWater(10);
-        dungeonGen.addDoors(15, true);
-
-        // change the TilesetType to lots of different choices to see what dungeon works best.
-        bareDungeon = dungeonGen.generate(TilesetType.DEFAULT_DUNGEON);
-        bareDungeon = DungeonUtility.closeDoors(bareDungeon);
-        lineDungeon = DungeonUtility.doubleWidth(DungeonUtility.hashesToLines(bareDungeon));
-        char[][] placement = DungeonUtility.closeDoors(bareDungeon);
-        Coord pl = dungeonGen.utility.randomFloor(placement);
-        placement[pl.x][pl.y] = '@';
-        int numMonsters = 15;
-        creatures = new HashMap<>(numMonsters);
-        for(int i = 0; i < numMonsters; i++)
-        {
-            Coord monPos = dungeonGen.utility.randomFloor(placement);
-            placement[monPos.x][monPos.y] = 'M';
-            if(rng.nextBoolean())
-                creatures.put(monPos, display.animateActor(monPos.x, monPos.y, "M!", 11, true));
-            else
-                creatures.put(monPos, display.animateActor(monPos.x, monPos.y, DefaultResources.getTentacle(), true, false));
-        }
-        colors = DungeonUtility.generatePaletteIndices(bareDungeon);
-        bgColors = DungeonUtility.generateBGPaletteIndices(bareDungeon);
-        lights = DungeonUtility.generateLightnessModifiers(bareDungeon, counter);
-
-        input = new SquidInput(new SquidInput.KeyHandler() {
-            @Override
-            public void handle(char key, boolean alt, boolean ctrl, boolean shift) {
-                switch (key)
-                {
-                    case 'Q':
-                    case 'q':
-                    case SquidInput.ESCAPE:
-                    {
-                        Gdx.app.exit();
-                    }
-                }
-            }
-        });
-        // ABSOLUTELY NEEDED TO HANDLE INPUT
-        Gdx.input.setInputProcessor(input);
-        // and then add display, our one visual component, to the list of things that act in Stage.
-        display.setPosition(0, 0);
-        stage.addActor(display);
-
-    }
-    public void putMap()
-    {
-        for (int i = 0; i < width * 2; i++) {
-            for (int j = 0; j < height; j++) {
-                // if we see it now, we remember the cell and show a lit cell based on the fovmap value (between 0.0
-                // and 1.0), with 1.0 being almost pure white at +115 lightness and 0.0 being rather dark at -85.
-                display.put(i, j, lineDungeon[i][j], colors[i/2][j], bgColors[i/2][j],
-                        lights[i/2][j] + 10);
-                // if we don't see it now, but did earlier, use a very dark background, but lighter than black.
-
-            }
-        }
-    }
-    @Override
-    public void render () {
-        // standard clear the background routine for libGDX
-        Gdx.gl.glClearColor(bgColor.r / 255.0f, bgColor.g / 255.0f, bgColor.b / 255.0f, 1.0f);
-        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-        // not sure if this is always needed...
-        Gdx.gl.glEnable(GL20.GL_BLEND);
-
-        // used as the z-axis when generating Simplex noise to make water seem to "move"
-        counter += Gdx.graphics.getDeltaTime() * 15;
-        // this does the standard lighting for walls, floors, etc. but also uses counter to do the Simplex noise thing.
-        lights = DungeonUtility.generateLightnessModifiers(bareDungeon, counter);
-
-        // need to display the map every frame, since we clear the screen to avoid artifacts.
-        putMap();
-        // if the user clicked, we have a list of moves to perform.
-
-        // if we are waiting for the player's input and get input, process it.
-        if(input.hasNext()) {
-            input.next();
-        }
-
-        // stage has its own batch and must be explicitly told to draw(). this also causes it to act().
-        stage.draw();
-
-        // disolay does not draw all AnimatedEntities by default, since FOV often changes how they need to be drawn.
-        batch.begin();
-        // the player needs to get drawn every frame, of course.
-        for(AnimatedEntity mon : creatures.values()) {
-            display.drawActor(batch, 1.0f, mon);
-        }
-        // batch must end if it began.
-        batch.end();
-    }
-
-    @Override
-	public void resize(int width, int height) {
-		super.resize(width, height);
-		input.getMouse().reinitialize((float) width / this.width, (float) height / this.height);
-	}
-}

+ 0 - 549
squidlib/src/test/java/squidpony/gdx/examples/SquidAIDemo.java

@@ -1,549 +0,0 @@
-package squidpony.gdx.examples;
-
-import com.badlogic.gdx.ApplicationAdapter;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.SpriteBatch;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.utils.Array;
-import com.badlogic.gdx.utils.IntArray;
-import com.badlogic.gdx.utils.viewport.ScreenViewport;
-import squidpony.squidai.*;
-import squidpony.squidgrid.FOVCache;
-import squidpony.squidgrid.LOS;
-import squidpony.squidgrid.Radius;
-import squidpony.squidgrid.gui.gdx.*;
-import squidpony.squidgrid.mapping.DungeonGenerator;
-import squidpony.squidgrid.mapping.DungeonUtility;
-import squidpony.squidgrid.mapping.styled.TilesetType;
-import squidpony.squidmath.*;
-
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Set;
-
-public class SquidAIDemo extends ApplicationAdapter {
-    private enum Phase {MOVE_ANIM, ATTACK_ANIM}
-    SpriteBatch batch;
-
-    private Phase phase = Phase.ATTACK_ANIM;
-    private RNG rng;
-    private LightRNG lrng;
-    private SquidLayers display;
-    private DungeonGenerator dungeonGen;
-    private char[][] bareDungeon, lineDungeon;
-    private double[][] res;
-    private int[][] colors, bgColors, lights;
-    private LOS los;
-    private int width, height;
-    private int cellWidth, cellHeight;
-    private int numMonsters = 16;
-
-    private SquidInput input;
-    private static final Color bgColor = SColor.DARK_SLATE_GRAY;
-    private Array<AnimatedEntity> teamRed, teamBlue;
-    private IntArray redHealth, blueHealth;
-    //private OrderedMap<AnimatedEntity, Integer> teamRed, teamBlue;
-    private OrderedSet<Coord> redPlaces, bluePlaces;
-    private Technique redCone, redCloud, blueBlast, blueBeam;
-    private DijkstraMap getToRed, getToBlue;
-    private Stage stage;
-    private int framesWithoutAnimation = 0, moveLength = 5;
-    private ArrayList<Coord> awaitedMoves;
-    private int redIdx = 0, blueIdx = 0;
-    private boolean blueTurn = false;
-
-    private FOVCache cache;
-    @Override
-    public void create () {
-        batch = new SpriteBatch();
-        width = 40;
-        height = 40;
-        cellWidth = 6;
-        cellHeight = 12;
-        display = new SquidLayers(width * 2, height, cellWidth, cellHeight, DefaultResources.narrowName);
-        display.setAnimationDuration(0.35f);
-        stage = new Stage(new ScreenViewport(), batch);
-
-        lrng = new LightRNG(0x1337BEEF);
-        rng = new RNG(lrng);
-
-        dungeonGen = new DungeonGenerator(width, height, rng);
-//        dungeonGen.addWater(10);
-        //dungeonGen.addDoors(15, true);
-
-        // change the TilesetType to lots of different choices to see what dungeon works best.
-        bareDungeon = dungeonGen.generate(TilesetType.ROUND_ROOMS_DIAGONAL_CORRIDORS);
-        cache = new FOVCache(bareDungeon, 9, Radius.CIRCLE);
-        bareDungeon = DungeonUtility.closeDoors(bareDungeon);
-        lineDungeon = DungeonUtility.doubleWidth(DungeonUtility.hashesToLines(bareDungeon));
-        // it's more efficient to get random floors from a packed set containing only (compressed) floor positions.
-        short[] placement = CoordPacker.pack(bareDungeon, '.');
-
-
-        teamRed = new Array<>(numMonsters);
-        teamBlue = new Array<>(numMonsters);
-
-        redHealth = new IntArray(numMonsters);
-        blueHealth = new IntArray(numMonsters);
-
-        redPlaces = new OrderedSet<>(numMonsters);
-        bluePlaces = new OrderedSet<>(numMonsters);
-        for(int i = 0; i < numMonsters; i++)
-        {
-            Coord monPos = dungeonGen.utility.randomCell(placement);
-            placement = CoordPacker.removePacked(placement, monPos.x, monPos.y);
-
-            teamRed.add(display.animateActor(monPos.x, monPos.y, "50", 11, true));
-            redHealth.add(50);
-            redPlaces.add(monPos);
-
-            Coord monPosBlue = dungeonGen.utility.randomCell(placement);
-            placement = CoordPacker.removePacked(placement, monPosBlue.x, monPosBlue.y);
-
-            teamBlue.add(display.animateActor(monPosBlue.x, monPosBlue.y, "50", 25, true));
-            blueHealth.add(50);
-            bluePlaces.add(monPosBlue);
-        }
-        // your choice of FOV matters here.
-        los = new LOS(LOS.BRESENHAM);
-        res = DungeonUtility.generateResistances(bareDungeon);
-
-        ConeAOE cone = new ConeAOE(Coord.get(0, 0), 9, 0, 60, Radius.CIRCLE);
-        cone.setMinRange(1);
-        cone.setMaxRange(2);
-        cone.setMetric(Radius.SQUARE);
-
-        redCone = new Technique("Burning Breath", cone);
-        redCone.setMap(bareDungeon);
-
-        BlastAOE blast = new BlastAOE(Coord.get(0, 0), 3, Radius.CIRCLE);
-        blast.setMinRange(3);
-        blast.setMaxRange(5);
-        blast.setMetric(Radius.CIRCLE);
-
-        blueBlast = new Technique("Winter Orb", blast);
-        blueBlast.setMap(bareDungeon);
-
-        CloudAOE cloud = new CloudAOE(Coord.get(0, 0), 20, Radius.DIAMOND);
-        cloud.setMinRange(4);
-        cloud.setMaxRange(7);
-        cloud.setMetric(Radius.CIRCLE);
-
-        redCloud = new Technique("Acid Mist", cloud);
-        redCloud.setMap(bareDungeon);
-
-        BeamAOE beam = new BeamAOE(Coord.get(0, 0), 0.0, 8, 1, Radius.DIAMOND);
-        beam.setMinRange(2);
-        beam.setMaxRange(8);
-        beam.setMetric(Radius.CIRCLE);
-        blueBeam = new Technique("Atomic Death Ray", beam);
-        blueBeam.setMap(bareDungeon);
-
-
-        getToRed = new DijkstraMap(bareDungeon, DijkstraMap.Measurement.EUCLIDEAN);
-        getToRed.rng = rng;
-        getToBlue = new DijkstraMap(bareDungeon, DijkstraMap.Measurement.EUCLIDEAN);
-        getToBlue.rng = rng;
-
-        dijkstraAlert();
-
-        awaitedMoves = new ArrayList<>(10);
-        colors = DungeonUtility.generatePaletteIndices(bareDungeon);
-        bgColors = DungeonUtility.generateBGPaletteIndices(bareDungeon);
-        lights = DungeonUtility.generateLightnessModifiers(bareDungeon);
-
-        // just quit if we get a Q.
-        input = new SquidInput(new SquidInput.KeyHandler() {
-            @Override
-            public void handle(char key, boolean alt, boolean ctrl, boolean shift) {
-                switch (key)
-                {
-                    case 'Q':
-                    case 'q':
-                    case SquidInput.ESCAPE:
-                    {
-                        Gdx.app.exit();
-                    }
-                }
-            }
-        });
-        // ABSOLUTELY NEEDED TO HANDLE INPUT
-        // and then add display, our one visual component, to the list of things that act in Stage.
-        display.setPosition(0, 0);
-        stage.addActor(display);
-        cache.awaitCache();
-        blast.setCache(cache);
-        cone.setCache(cache);
-        Gdx.input.setInputProcessor(input);
-
-
-    }
-
-    private void dijkstraAlert()
-    {
-        /*
-        getToBlue.clearGoals();
-        getToBlue.resetMap();
-        getToRed.clearGoals();
-        getToRed.resetMap();
-        ArrayList<AnimatedEntity> redCopy = new ArrayList<AnimatedEntity>(teamRed.size());
-        redCopy.addAll(teamRed.keySet());
-        BLUE_LOOP:
-        for(AnimatedEntity blue : teamBlue.keySet())
-        {
-            for(AnimatedEntity red : redCopy)
-            {
-                if(los.isReachable(res, blue.gridX, blue.gridY, red.gridX, red.gridY, Radius.CIRCLE))
-                {
-                    getToBlue.setGoal(blue.gridX, blue.gridY);
-                    getToRed.setGoal(red.gridX, red.gridY);
-
-                    redCopy.remove(red);
-
-                    continue BLUE_LOOP;
-                }
-            }
-        }
-        getToBlue.scan(redPlaces);
-        getToRed.scan(bluePlaces);
-        */
-    }
-
-    /**
-     * Move a unit toward a good position to attack, but don't attack in this method.
-     * @param idx the index of the unit in the appropriate ordered Map.
-     */
-    private void startMove(int idx) {
-//        if(health <= 0) return;
-        int i = 0;
-        DijkstraMap whichDijkstra;
-        Technique whichTech;
-        Set<Coord> whichFoes, whichAllies = new OrderedSet<>(8);
-        AnimatedEntity ae = null;
-        int health = 0;
-        Coord user = null;
-        if(blueTurn)
-        {
-            whichDijkstra = getToRed;
-            whichTech = (idx % 2 == 0) ? blueBeam : blueBlast;
-            whichFoes = redPlaces;
-            whichAllies = bluePlaces;
-            ae = teamBlue.get(idx);
-            health = blueHealth.get(idx);
-            if(ae == null || health <= 0) {
-                phase = Phase.MOVE_ANIM;
-                return;
-            }
-            user = Coord.get(ae.gridX, ae.gridY);
-        }
-        else
-        {
-            whichDijkstra = getToBlue;
-            whichTech = (idx % 2 == 0) ? redCloud : redCone;
-            whichFoes = bluePlaces;
-            whichAllies = redPlaces;
-            ae = teamRed.get(idx);
-            health = redHealth.get(idx);
-            if(ae == null || health <= 0) {
-                phase = Phase.MOVE_ANIM;
-                return;
-            }
-            user = Coord.get(ae.gridX, ae.gridY);
-        }
-        whichAllies.remove(user);
-        /*for(Coord p : whichFoes)
-        {
-            AnimatedEntity foe = display.getAnimatedEntityByCell(p.x, p.y);
-            if(los.isReachable(res, user.x, user.y, p.x, p.y) && foe != null && whichEnemyTeam.get(foe) != null && whichEnemyTeam.get(foe) > 0)
-            {
-                visibleTargets.add(p);
-            }
-        }*/
-        ArrayList<Coord> path = whichDijkstra.findTechniquePath(moveLength, whichTech, bareDungeon, (LOS)null, whichFoes, whichAllies, user, whichFoes);
-        if(path.isEmpty())
-            path = whichDijkstra.findPath(moveLength, whichFoes, whichAllies, user, whichFoes.toArray(new Coord[whichFoes.size()]));
-        /*
-        System.out.println("User at (" + user.x + "," + user.y + ") using " +
-                whichTech.name);
-        */
-        /*
-        boolean anyFound = false;
-
-        for (int yy = 0; yy < height; yy++) {
-            for (int xx = 0; xx < width; xx++) {
-                System.out.print((whichDijkstra.targetMap[xx][yy] == null) ? "." : "@");
-                anyFound = (whichDijkstra.targetMap[xx][yy] != null) ? true : anyFound;
-            }
-            System.out.println();
-        }*/
-        awaitedMoves = new ArrayList<>(path);
-    }
-
-    public void move(AnimatedEntity ae, int newX, int newY) {
-        display.slide(ae, newX, newY, 2, 0.075f);
-        phase = Phase.MOVE_ANIM;
-
-    }
-
-    // check if a monster's movement would overlap with another monster.
-    @SuppressWarnings("unused")
-	private boolean checkOverlap(AnimatedEntity ae, int x, int y)
-    {
-        for(AnimatedEntity mon : teamRed)
-        {
-            if(mon.gridX == x && mon.gridY == y && !mon.equals(ae))
-                return true;
-        }
-        for(AnimatedEntity mon : teamBlue)
-        {
-            if(mon.gridX == x && mon.gridY == y && !mon.equals(ae))
-                return true;
-        }
-        return false;
-    }
-
-    private void postMove(int idx) {
-
-        int i = 0;
-        Technique whichTech;
-        Set<Coord> whichFoes, whichAllies, visibleTargets = new OrderedSet<>(8);
-        AnimatedEntity ae = null;
-        int health = 0;
-        Coord user = null;
-        Color whichTint = Color.WHITE;
-        Array<AnimatedEntity> whichEnemyTeam;
-        IntArray whichEnemyHealth;
-        OrderedMap<Coord, Double> effects;
-        if (blueTurn) {
-            whichTech = (idx % 2 == 0) ? blueBeam : blueBlast;
-            whichFoes = redPlaces;
-            whichAllies = bluePlaces;
-            whichTint = Color.CYAN;
-            whichEnemyTeam = teamRed;
-            whichEnemyHealth = redHealth;
-            ae = teamBlue.get(idx);
-            health = blueHealth.get(idx);
-            if (ae == null || health <= 0) {
-                phase = Phase.ATTACK_ANIM;
-                return;
-            }
-            user = Coord.get(ae.gridX, ae.gridY);
-        } else {
-            whichTech = (idx % 2 == 0) ? redCloud : redCone;
-            whichFoes = bluePlaces;
-            whichAllies = redPlaces;
-            whichTint = Color.RED;
-            whichEnemyTeam = teamBlue;
-            whichEnemyHealth = blueHealth;
-            ae = teamRed.get(idx);
-            health = redHealth.get(idx);
-            if (ae == null || health <= 0) {
-                phase = Phase.ATTACK_ANIM;
-                return;
-            }
-            user = Coord.get(ae.gridX, ae.gridY);
-        }
-        for(Coord p : whichFoes)
-        {
-            AnimatedEntity foe = display.getAnimatedEntityByCell(p.x, p.y);
-            int foeIdx;
-            if(los.isReachable(res, user.x, user.y, p.x, p.y) && foe != null && (foeIdx = whichEnemyTeam.indexOf(foe, true)) >= 0
-                    && whichEnemyHealth.get(foeIdx) > 0)
-            {
-                visibleTargets.add(p);
-            }
-        }
-
-        OrderedMap<Coord, ArrayList<Coord>> ideal = whichTech.idealLocations(user, visibleTargets, whichAllies);
-        Coord targetCell = null;
-        if(!ideal.isEmpty()) targetCell = ideal.firstKey();
-
-        if(targetCell != null)
-        {
-            effects = whichTech.apply(user, targetCell);
-
-            for(Map.Entry<Coord, Double> power : effects.entrySet())
-            {
-                Double strength = (idx % 2 == 0) ? rng.nextDouble() : power.getValue();
-                whichTint.a = strength.floatValue();
-                display.tint(power.getKey().x * 2    , power.getKey().y, whichTint, 0, display.getAnimationDuration());
-                display.tint(power.getKey().x * 2 + 1, power.getKey().y, whichTint, 0, display.getAnimationDuration());
-                AnimatedEntity tgt;
-                for(int tgtIdx = 0; tgtIdx < whichEnemyTeam.size; tgtIdx++)
-                {
-                    tgt = whichEnemyTeam.get(tgtIdx);
-                    if(tgt.gridX == power.getKey().x && tgt.gridY == power.getKey().y)
-                    {
-                        int currentHealth = Math.max(whichEnemyHealth.get(tgtIdx) - (int) (15 * strength), 0);
-                        whichEnemyTeam.set(tgtIdx, tgt);
-                        whichEnemyHealth.set(tgtIdx, currentHealth);
-                        tgt.setText(Integer.toString(currentHealth));
-                    }
-                }
-            }
-        }
-        /*
-        else
-        {
-
-            System.out.println("NO ATTACK POSITION: User at (" + user.x + "," + user.y + ") using " +
-                    whichTech.name);
-
-            display.tint(user.x * 2    , user.y, highlightColor, 0, display.getAnimationDuration() * 3);
-            display.tint(user.x * 2 + 1, user.y, highlightColor, 0, display.getAnimationDuration() * 3);
-        }
-        */
-        whichAllies.add(user);
-        phase = Phase.ATTACK_ANIM;
-    }
-    public void putMap()
-    {
-        for (int i = 0; i < width; i++) {
-            for (int j = 0; j < height; j++) {
-                display.put(i * 2, j, lineDungeon[i * 2][j], colors[i][j], bgColors[i][j], lights[i][j]);
-                display.put(i * 2 + 1, j, lineDungeon[i * 2 + 1][j], colors[i][j], bgColors[i][j], lights[i][j]);
-            }
-        }
-    }
-    @Override
-    public void render () {
-        // standard clear the background routine for libGDX
-        Gdx.gl.glClearColor(bgColor.r / 255.0f, bgColor.g / 255.0f, bgColor.b / 255.0f, 1.0f);
-        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-        // not sure if this is always needed...
-        Gdx.gl.glEnable(GL20.GL_BLEND);
-
-        stage.act();
-        boolean blueWins = false, redWins = false;
-        for(int bh = 0; bh < blueHealth.size; bh++)
-        {
-            if(blueHealth.get(bh) > 0) {
-                redWins = false;
-                break;
-            }redWins = true;
-        }
-        for(int rh = 0; rh < redHealth.size; rh++)
-        {
-            if(redHealth.get(rh) > 0) {
-                blueWins = false;
-                break;
-            }blueWins = true;
-        }
-        if (blueWins) {
-            // still need to display the map, then write over it with a message.
-            putMap();
-            display.putBoxedString(width / 2 - 11, height / 2 - 1, "  BLUE TEAM WINS!  ");
-            display.putBoxedString(width / 2 - 11, height / 2 + 5, "     q to quit.    ");
-
-            // because we return early, we still need to draw.
-            stage.draw();
-            // q still needs to quit.
-            if(input.hasNext())
-                input.next();
-            return;
-        }
-        else if(redWins)
-        {
-            putMap();
-            display.putBoxedString(width / 2 - 11, height / 2 - 1, "   RED TEAM WINS!  ");
-            display.putBoxedString(width / 2 - 11, height / 2 + 5, "     q to quit.    ");
-
-            // because we return early, we still need to draw.
-            stage.draw();
-            // q still needs to quit.
-            if(input.hasNext())
-                input.next();
-            return;
-        }
-        int i = 0;
-        AnimatedEntity ae = null;
-        int whichIdx = 0;
-        if(blueTurn) {
-            whichIdx = blueIdx;
-            ae = teamBlue.get(blueIdx);
-        }
-        else
-        {
-            whichIdx = redIdx;
-            ae = teamRed.get(redIdx);
-        }
-
-        // need to display the map every frame, since we clear the screen to avoid artifacts.
-        putMap();
-        // if we are waiting for the player's input and get input, process it.
-        if(input.hasNext()) {
-            input.next();
-        }
-        // if the user clicked, we have a list of moves to perform.
-        if(!awaitedMoves.isEmpty())
-        {
-            if(ae == null) {
-                awaitedMoves.clear();
-            }
-            // extremely similar to the block below that also checks if animations are done
-            // this doesn't check for input, but instead processes and removes Points from awaitedMoves.
-            else if(!display.hasActiveAnimations()) {
-                ++framesWithoutAnimation;
-                if (framesWithoutAnimation >= 2) {
-                    framesWithoutAnimation = 0;
-                    Coord m = awaitedMoves.remove(0);
-                    move(ae, m.x, m.y);
-                }
-            }
-        }
-        // if the previous blocks didn't happen, and there are no active animations, then either change the phase
-        // (because with no animations running the last phase must have ended), or start a new animation soon.
-        else if(!display.hasActiveAnimations()) {
-            ++framesWithoutAnimation;
-            if (framesWithoutAnimation >= 2) {
-                framesWithoutAnimation = 0;
-                switch (phase) {
-                    case ATTACK_ANIM: {
-                        phase = Phase.MOVE_ANIM;
-                        blueTurn = !blueTurn;
-                        if(!blueTurn)
-                        {
-                            whichIdx = (whichIdx + 1) % numMonsters;
-                            redIdx = (redIdx + 1) % numMonsters;
-                            blueIdx = (blueIdx + 1) % numMonsters;
-                        }
-                        dijkstraAlert();
-                        startMove(whichIdx);
-                    }
-                    break;
-                    case MOVE_ANIM: {
-                        postMove(whichIdx);
-                    }
-                }
-            }
-        }
-        // if we do have an animation running, then how many frames have passed with no animation needs resetting
-        else
-        {
-            framesWithoutAnimation = 0;
-        }
-
-        // stage has its own batch and must be explicitly told to draw(). this also causes it to act().
-        stage.draw();
-
-        OrderedSet<AnimatedEntity> entities = display.getAnimatedEntities(0);
-        // display does not draw all AnimatedEntities by default.
-        batch.begin();
-        for (int j = 0; j < entities.size(); j++) {
-            display.drawActor(batch, 1.0f, entities.getAt(j), 0);
-        }
-        entities = display.getAnimatedEntities(2);
-        for (int j = 0; j < entities.size(); j++) {
-            display.drawActor(batch, 1.0f, entities.getAt(j), 2);
-        }
-        /*
-        for(AnimatedEntity mon : teamBlue.keySet()) {
-                display.drawActor(batch, 1.0f, mon);
-        }*/
-        // batch must end if it began.
-        batch.end();
-    }
-}
-

+ 0 - 214
squidlib/src/test/java/squidpony/gdx/examples/WorldMapDemo.java

@@ -1,214 +0,0 @@
-package squidpony.gdx.examples;
-
-import com.badlogic.gdx.ApplicationAdapter;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.SpriteBatch;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.utils.viewport.ScreenViewport;
-import com.badlogic.gdx.utils.viewport.Viewport;
-import squidpony.squidgrid.gui.gdx.SColor;
-import squidpony.squidgrid.gui.gdx.SquidColorCenter;
-import squidpony.squidgrid.gui.gdx.SquidInput;
-import squidpony.squidgrid.gui.gdx.SquidPanel;
-import squidpony.squidgrid.mapping.MetsaMapFactory;
-import squidpony.squidmath.Coord;
-
-import java.util.List;
-
-public class WorldMapDemo extends ApplicationAdapter {
-    private MetsaMapFactory mapFactory;
-
-    private SpriteBatch batch;
-    private SquidColorCenter colorFactory;
-    private SquidPanel display;
-    private int width, height;
-    private int cellWidth, cellHeight;
-    private SquidInput input;
-    private static final SColor bgColor = SColor.DARK_SLATE_GRAY;
-    private Stage stage;
-    private Viewport view;
-
-    private final SColor CITY_COLOR = new SColor(0xFF9944);
-
-    //COLORORDER
-/*
-     0 = deepsea
-     1 = beach
-     2 = low
-     3 = high
-     4 = mountain
-     5 = snowcap
-     6 = lowsea
-     */
-    private final SColor[] colors = new SColor[]{SColor.DENIM, SColor.PEACH, SColor.PALE_YOUNG_GREEN_ONION,
-            SColor.FOREST_GREEN, SColor.SLATE_GRAY, SColor.ALICE_BLUE, SColor.AZUL};
-    private final SColor[] polarcolors = colors;
-    //            new SColor[]{SColor.DARK_SLATE_GRAY, SColor.SCHOOL_BUS_YELLOW, SColor.YELLOW_GREEN,
-//        SColor.GREEN_BAMBOO, SColorFactory.lighter(SColor.LIGHT_BLUE_SILK), SColor.ALICE_BLUE, SColor.AZUL};
-    private final SColor[] desertcolors = colors;
-//            new SColor[]{SColor.DARK_SLATE_GRAY, SColor.SCHOOL_BUS_YELLOW, SColor.YELLOW_GREEN,
-//        SColor.GREEN_BAMBOO, SColorFactory.lighter(SColor.LIGHT_BLUE_SILK), SColor.ALICE_BLUE, SColor.AZUL};
-
-    private double highn = 0;
-    private int[][] biomeMap;
-    private double[][] map;
-    private List<Coord> cities;
-    @Override
-    public void create () {
-        batch = new SpriteBatch();
-        width = 240;
-        height = 120;
-        cellWidth = 5;
-        cellHeight = 5;
-        display = new SquidPanel(width, height, cellWidth, cellHeight);
-        colorFactory = new SquidColorCenter();
-        mapFactory = new MetsaMapFactory(width, height);
-        map = mapFactory.getHeightMap();
-        biomeMap = mapFactory.makeBiomeMap();
-        mapFactory.makeWeightedMap();
-        highn = mapFactory.getMaxPeak();
-        cities = mapFactory.getCities();
-
-        view = new ScreenViewport();
-        stage = new Stage(view, batch);
-
-        input = new SquidInput(new SquidInput.KeyHandler() {
-            @Override
-            public void handle(char key, boolean alt, boolean ctrl, boolean shift) {
-                switch (key)
-                {
-                    case 'Q':
-                    case 'q':
-                    case SquidInput.ESCAPE:
-                    {
-                        Gdx.app.exit();
-                    }
-                }
-            }
-        });
-        // ABSOLUTELY NEEDED TO HANDLE INPUT
-        Gdx.input.setInputProcessor(input);
-        // and then add display, our one visual component, to the list of things that act in Stage.
-        display.setPosition(0, 0);
-        stage.addActor(display);
-
-        Gdx.graphics.setContinuousRendering(false);
-        Gdx.graphics.requestRendering();
-    }
-    public void putMap()
-    {
-        display.clear();
-        double n;
-        for (int x = 0; x < width; x++) {
-            for (int y = 0; y < height; y++) {
-                n = map[x][y];
-                SColor[] curcolor = colors;
-                if (biomeMap[x][y] == 1 || biomeMap[x][y] == 3) {
-                    curcolor = polarcolors;
-                }
-                if (biomeMap[x][y] == 2) {
-                    curcolor = desertcolors;
-                }
-                Color color = curcolor[6];
-                if (n > MetsaMapFactory.SEA_LEVEL) {
-                    color = curcolor[1];
-                }
-                if (n > MetsaMapFactory.BEACH_LEVEL) {
-                    color = curcolor[2];
-                }
-                if (n > MetsaMapFactory.PLAINS_LEVEL) {
-                    color = curcolor[3];
-                }
-                if (n > MetsaMapFactory.MOUNTAIN_LEVEL) {
-                    color = curcolor[4];
-                }
-                if (n > MetsaMapFactory.SNOW_LEVEL) {
-                    color = curcolor[5];
-                }
-
-                //Polar ice
-                if (n < MetsaMapFactory.DEEP_SEA_LEVEL) {
-                    if (biomeMap[x][y] == 3) {
-                        color = polarcolors[0];
-                    } else {
-                        color = colors[0];
-                    }
-                }
-
-//                use alpha to blend
-                if (n > 0) {
-                    color = colorFactory.lerp(color, SColor.ALICE_BLUE, (float)Math.pow(n / highn, 2) / 2f);//high stuff gets lighter
-                    color = colorFactory.lerp(color, SColor.DARK_BLUE_DYE, (float)(0.2 - n * n));//low stuff gets darker
-
-                    int shadow = mapFactory.getShadow(x, y, map);
-                    if (n > MetsaMapFactory.SNOW_LEVEL && (biomeMap[x][y] == 1 || biomeMap[x][y] == 3)) {//SNOWAREA VOLCANO CASE
-                        if (shadow == -1) {//shadow side INVERSE
-//                            color = SColorFactory.blend(color, new SColor(0, 0, 90), 0.2);
-                            color = colorFactory.lerp(color, SColor.DENIM, (float)(0.2 * n / 2));
-                        }
-                        if (shadow == 1) {//sun side INVERSE
-//                            color = SColorFactory.blend(color, new SColor(255, 255, 0), 0.1);
-                            color = colorFactory.lerp(color, SColor.BRASS, (float)(0.1 * n / 2));
-                        }
-                    } else {
-                        if (shadow == 1) { //shadow side
-//                            color = SColorFactory.blend(color, new SColor(0, 0, 90), 0.2);
-                            color = colorFactory.lerp(color, SColor.ONANDO, (float)(0.2 * n / 2));
-                        }
-                        if (shadow == -1) {//sun side
-//                            color = SColorFactory.blend(color, new SColor(220, 220, 100), 0.2);
-                            color = colorFactory.lerp(color, SColor.YELLOW, (float)(0.2 * n / 2));
-                        }
-                    }
-                }
-                display.put(x, y, color);
-            }
-        }
-
-        for (Coord city : cities) {
-            display.put(city.x, city.y, '@', CITY_COLOR);
-        }
-
-    }
-    @Override
-    public void render () {
-        // standard clear the background routine for libGDX
-        Gdx.gl.glClearColor(bgColor.r / 255.0f, bgColor.g / 255.0f, bgColor.b / 255.0f, 1.0f);
-        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-        // not sure if this is always needed...
-        Gdx.gl.glEnable(GL20.GL_BLEND);
-        view.apply(true);
-        // need to display the map every frame, since we clear the screen to avoid artifacts.
-        putMap();
-        // if the user clicked, we have a list of moves to perform.
-
-        // if we are waiting for the player's input and get input, process it.
-        if(input.hasNext()) {
-            input.next();
-        }
-
-        // stage has its own batch and must be explicitly told to draw(). this also causes it to act().
-        stage.draw();
-    }
-
-    @Override
-	public void resize(int width, int height) {
-		super.resize(width, height);
-        this.width = width / cellWidth;
-        this.height = height / cellHeight;
-        view.update(width, height, true);
-        mapFactory.regenerateHeightMap(this.width, this.height);
-        map = mapFactory.getHeightMap();
-        biomeMap = mapFactory.makeBiomeMap();
-        mapFactory.makeWeightedMap();
-        highn = mapFactory.getMaxPeak();
-        cities = mapFactory.getCities();
-        display = new SquidPanel(this.width, this.height, cellWidth, cellHeight);
-        display.setPosition(0,0);
-        stage.clear();
-        stage.addActor(display);
-        Gdx.graphics.requestRendering();
-	}
-}

+ 0 - 306
squidlib/src/test/java/squidpony/gdx/examples/ZoneDemo.java

@@ -1,306 +0,0 @@
-package squidpony.gdx.examples;
-
-import com.badlogic.gdx.ApplicationAdapter;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.SpriteBatch;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
-import com.badlogic.gdx.utils.viewport.StretchViewport;
-
-import squidpony.ColoredStringList;
-import squidpony.GwtCompatibility;
-import squidpony.squidai.ZOI;
-import squidpony.squidgrid.Direction;
-import squidpony.squidgrid.Radius;
-import squidpony.squidgrid.gui.gdx.*;
-import squidpony.squidgrid.mapping.DungeonGenerator;
-import squidpony.squidgrid.mapping.DungeonUtility;
-import squidpony.squidgrid.mapping.OrganicMapGenerator;
-import squidpony.squidgrid.mapping.SerpentMapGenerator;
-import squidpony.squidmath.Coord;
-import squidpony.squidmath.CoordPacker;
-import squidpony.squidmath.RNG;
-
-public class ZoneDemo extends ApplicationAdapter {
-    SpriteBatch batch;
-
-    private RNG rng;
-    private SquidLayers display;
-    private DungeonGenerator dungeonGen;
-    private char[][] bareDungeon, lineDungeon;
-    private int[][] lights;
-    private Color[][] bgColors;
-    private Color[] influenceColors;
-    private float[] influenceH, influenceS, influenceV;
-    private ZOI zoi;
-    private short[][] packedInfluences;
-    private int width, height, screenWidth, screenHeight;
-    private int cellWidth, cellHeight;
-    private Coord[] centers, shiftedCenters;
-    private AnimatedEntity[] centerEntities;
-    private SquidInput input;
-    private static final Color bgColor = SColor.DARK_SLATE_GRAY, textColor = SColor.SLATE_GRAY;
-    private Stage stage;
-    private SquidColorCenter colorCenter;
-    private TextPanel<Color> current;
-    private int INTERNAL_ZOOM = 1;
-    @Override
-    public void create () {
-        batch = new SpriteBatch();
-        width = 80;
-        height = 50;
-
-        cellWidth = 16 * INTERNAL_ZOOM;
-        cellHeight = 16 * INTERNAL_ZOOM;
-        TextCellFactory tcf = DefaultResources.getStretchableFont().addSwap('.', ' ');
-        display = new SquidLayers(width, height, cellWidth, cellHeight, tcf);
-        //tcf.setSmoothingMultiplier(2f / (INTERNAL_ZOOM + 1f));
-        screenWidth = width * cellWidth;
-        screenHeight = height * cellHeight;
-        display.setAnimationDuration(0.2f);
-        display.setTextSize(cellWidth, cellHeight + INTERNAL_ZOOM);
-        stage = new Stage(new StretchViewport(screenWidth, screenHeight), batch);
-
-        rng = new RNG(0xBABABADAL);
-
-        dungeonGen = new DungeonGenerator(width, height, rng);
-//        dungeonGen.addWater(10);
-        //dungeonGen.addDoors(15, true);
-        SerpentMapGenerator serpent = new SerpentMapGenerator(width, height, rng, 0.4);
-        serpent.putBoxRoomCarvers(2);
-        serpent.putWalledBoxRoomCarvers(2);
-        serpent.putWalledRoundRoomCarvers(2);
-        serpent.putCaveCarvers(4);
-        OrganicMapGenerator organic = new OrganicMapGenerator(0.55, 0.65, width, height, rng);
-        bareDungeon = dungeonGen.generate(organic.generate());
-        //bareDungeon = DungeonUtility.closeDoors(bareDungeon);
-
-        //lineDungeon = DungeonUtility.doubleWidth(DungeonUtility.hashesToLines(bareDungeon));
-        lineDungeon = DungeonUtility.hashesToLines(bareDungeon);
-
-        //ArrayList<Coord> temp = PoissonDisk.sampleMap(bareDungeon, 8.0f, rng, '#', '+', '/');
-
-        //centers = temp.toArray(new Coord[temp.size()]);
-        //shiftedCenters = temp.toArray(new Coord[temp.size()]);
-
-        centers = CoordPacker.apartPacked(CoordPacker.pack(bareDungeon, '.'), 8);
-        shiftedCenters = GwtCompatibility.cloneCoords(centers);
-        colorCenter = DefaultResources.getSCC();
-        influenceH = new float[centers.length];
-        influenceS = new float[centers.length];
-        influenceV = new float[centers.length];
-        influenceColors = new Color[centers.length];
-        centerEntities = new AnimatedEntity[centers.length];
-        for (int i = 0; i < centers.length; i++) {
-            float hue = i * 1.0f / centers.length, sat = rng.nextFloat() * 0.2f + 0.8f,
-                    val = rng.nextFloat() * 0.3f + 0.7f;
-            influenceH[i] = hue;
-            influenceS[i] = sat;
-            influenceV[i] = val;
-            influenceColors[i] = colorCenter.getHSV(hue, sat, val);
-            centerEntities[i] = display.animateActor(centers[i].x, centers[i].y, '@',
-                    colorCenter.getHSV(hue, sat - 0.3f, val - 0.4f), false); //, true);
-        }
-        zoi = new ZOI(centers, bareDungeon, Radius.DIAMOND);
-        packedInfluences = zoi.calculate();
-
-        bgColors = new Color[width][height];
-        recolorZones();
-        lights = DungeonUtility.generateLightnessModifiers(bareDungeon);
-
-        // just quit if we get a Q.
-        input = new SquidInput(new SquidInput.KeyHandler() {
-
-            @Override
-            public void handle(char key, boolean alt, boolean ctrl, boolean shift) {
-                switch (key)
-                {
-                    case 'Q':
-                    case 'q':
-                    case SquidInput.ESCAPE:
-                    {
-                        Gdx.app.exit();
-					    break;
-                    }
-				case 'M': /* Convenient when switching US/French layouts as I do (smelC) */
-				case '?': {
-                    if (current == null)
-                        buildCurrentTextPanel(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
-                    else
-                        disposeCurrentTextPanel();
-					break;
-				}
-                }
-            }
-
-        });
-        // ABSOLUTELY NEEDED TO HANDLE INPUT
-        // and then add display, our one visual component, to the list of things that act in Stage.
-        display.setPosition(0, 0);
-        stage.addActor(display);
-        Gdx.input.setInputProcessor(input);
-    }
-
-    public void move() {
-        for (int i = 0; i < centers.length; i++) {
-            AnimatedEntity ae = centerEntities[i];
-            Direction[] dirs = new Direction[4];
-            rng.shuffle(Direction.CARDINALS, dirs);
-            for (int j = 0; j < dirs.length; j++) {
-                int newX = ae.gridX + dirs[j].deltaX, newY = ae.gridY + dirs[j].deltaY;
-                if (bareDungeon[newX][newY] != '#' &&
-                        Radius.DIAMOND.radius(centers[i].x, centers[i].y,
-                                newX, newY) <= 4.0) {
-                    display.slide(ae, newX, newY);
-                    shiftedCenters[i] = Coord.get(newX, newY);
-                    break;
-                }
-            }
-        }
-        //recolorZones();
-        //phase = Phase.MOVE_ANIM;
-
-    }
-    public void recolorZones()
-    {
-        zoi = new ZOI(shiftedCenters, bareDungeon, Radius.DIAMOND);
-        packedInfluences = zoi.calculate();
-        Coord c;
-        int inf0;
-        for (int y = 0; y < height; y++) {
-            for (int x = 0; x < width; x++) {
-                c = Coord.get(x, y);
-                int[] inf = zoi.nearestInfluences(packedInfluences, c);
-                if(inf.length == 0) {
-                    bgColors[x][y] = bgColor;
-                }
-                else if(inf.length == 1)
-                {
-                    bgColors[x][y] = influenceColors[inf[0]];
-                }
-                else
-                {
-                    inf0 = inf[0];
-                    float hue = influenceH[inf0] + 1f,
-                            sat = influenceS[inf0],
-                            val = influenceV[inf0];
-                    //if(hue < 0.5) hue += 1f;
-                    for (int i = 1; i < inf.length; i++) {
-                        //if(tempHue < 0.5) tempHue += 1f;
-                        hue += influenceH[inf[i]] + 1f;
-                        sat += influenceS[inf[i]];
-                        val += influenceV[inf[i]];
-                    }
-                    bgColors[x][y] = colorCenter.getHSV((hue / inf.length) % 1.0f, sat / inf.length, val / inf.length);
-                }
-            }
-        }
-    }
-
-    private void postMove() {
-        recolorZones();
-    }
-    public void putMap()
-    {
-        for (int j = 0; j < height; j++) {
-            for (int i = 0; i < width; i++) {
-                display.put(i, j, lineDungeon[i][j], textColor, bgColors[i][j], lights[i][j]);
-                //display.put(i * 2, j, lineDungeon[i * 2][j], textColor, bgColors[i][j], lights[i][j]);
-                //display.put(i * 2 + 1, j, lineDungeon[i * 2 + 1][j], textColor, bgColors[i][j], lights[i][j]);
-            }
-        }
-        display.putString(2, 0, String.valueOf(Gdx.graphics.getFramesPerSecond()));
-    }
-    @Override
-    public void render () {
-        // standard clear the background routine for libGDX
-        Gdx.gl.glClearColor(bgColor.r / 255.0f, bgColor.g / 255.0f, bgColor.b / 255.0f, 1.0f);
-        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-        // not sure if this is always needed...
-        Gdx.gl.glEnable(GL20.GL_BLEND);
-
-        stage.act();
-
-        // need to display the map every frame, since we clear the screen to avoid artifacts.
-        putMap();
-        // if we are waiting for the player's input and get input, process it.
-        if(input.hasNext()) {
-            input.next();
-        }
-
-        if(!display.hasActiveAnimations()) {
-            move();
-            postMove();
-        }
-
-        // stage has its own batch and must be explicitly told to draw(). this also causes it to act().
-        stage.getViewport().apply(true);
-        stage.draw();
-        stage.act();
-        // display does not draw all AnimatedEntities by default.
-        batch.begin();
-        for(AnimatedEntity mon : display.getAnimatedEntities(2)) {
-            display.drawActor(batch, 1.0f, mon);
-        }
-        // batch must end if it began.
-        batch.end();
-    }
-
-    @Override
-    public void resize(int width, int height) {
-        super.resize(width, height);
-        stage.getViewport().update(width, height, true);
-    }
-
-    private void buildCurrentTextPanel(int newWidth, int newHeight) {
-        current = new TextPanel<Color>(new GDXMarkup(), //DefaultResources.getLargeFont());
-                //new TextCellFactory().fontDistanceField("Gentium-distance.fnt", "Gentium-distance.png")
-                //new TextCellFactory().fontDistanceField("Noto-Sans-distance.fnt", "Noto-Sans-distance.png")
-                //        .setSmoothingMultiplier(0.4f).height(30).width(7)
-                DefaultResources.getStretchablePrintFont().width(7 * INTERNAL_ZOOM).height(30 * INTERNAL_ZOOM));
-        current.backgroundColor = colorCenter.get(30, 30, 30);
-        final ColoredStringList<Color> text = new ColoredStringList<Color>();
-        text.addColoredText("SquidLib ", colorCenter.get(255, 0, 0));
-        text.addText("is brought to you by Tommy Ettinger, Eben Howard, smelC, and others");
-        /* Jump a line */
-        text.addEmptyLine();
-        text.addText("If you wanna contribute, visit ");
-        text.addColoredText("https://github.com/SquidPony/SquidLib", colorCenter.get(29, 0, 253));
-        /* // useful during debugging
-        char[] big = new char[50];
-        Arrays.fill(big, 'A');
-        buf.append(new String(big), Color.RED);
-        text.add(buf);
-        Arrays.fill(big, 'B');
-        text.add(IColoredString.Impl.<Color> create(new String(big), Color.GREEN));
-        Arrays.fill(big, 'C');
-        text.add(IColoredString.Impl.<Color> create(new String(big), Color.BLUE));
-        Arrays.fill(big, 'D');
-        text.add(IColoredString.Impl.<Color> create(new String(big), Color.YELLOW));
-        */
-        /*
-    	 * To have scrollbars, we would need to provide textures
-    	 */
-        final float panelWidth = screenWidth / 2f;
-        final float panelHeight = screenHeight / 2f;
-        final ScrollPane sp = current.getScrollPane();
-        current.init(panelWidth, panelHeight, text);
-        final float x = (screenWidth - panelWidth) / 2f;
-        final float y = (screenHeight - panelHeight) / 2f;
-        sp.setPosition(x, y);
-        stage.setKeyboardFocus(sp);
-        stage.setScrollFocus(sp);
-        stage.addActor(sp);
-    }
-
-    private void disposeCurrentTextPanel() {
-        current.dispose();
-        stage.getActors().removeValue(current.getScrollPane(), true);
-        stage.setKeyboardFocus(null);
-        stage.setScrollFocus(null);
-        current = null;
-    }
-
-}

+ 0 - 19
squidlib/src/test/java/squidpony/gdx/examples/desktop/CoveredPathDemoLauncher.java

@@ -1,19 +0,0 @@
-package squidpony.gdx.examples.desktop;
-
-import com.badlogic.gdx.Files;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import squidpony.gdx.examples.CoveredPathDemo;
-
-public class CoveredPathDemoLauncher {
-	public static void main (String[] arg) {
-		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
-		config.title = "SquidLib GDX Covered Pathfinding Demo";
-		config.width = 60 * 6;
-		config.height = 50 * 12;
-		config.addIcon("Tentacle-16.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-32.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-128.png", Files.FileType.Classpath);
-		new LwjglApplication(new CoveredPathDemo(), config);
-	}
-}

+ 0 - 19
squidlib/src/test/java/squidpony/gdx/examples/desktop/ImageDemoLauncher.java

@@ -1,19 +0,0 @@
-package squidpony.gdx.examples.desktop;
-
-import com.badlogic.gdx.Files;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import squidpony.gdx.examples.ImageDemo;
-
-public class ImageDemoLauncher {
-	public static void main (String[] arg) {
-		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
-		config.title = "SquidLib GDX Image Demo";
-		config.width = 30 * 2 * 18;
-		config.height = 20 * 36;
-		config.addIcon("Tentacle-16.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-32.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-128.png", Files.FileType.Classpath);
-		new LwjglApplication(new ImageDemo(), config);
-	}
-}

+ 0 - 19
squidlib/src/test/java/squidpony/gdx/examples/desktop/SquidAIDemoLauncher.java

@@ -1,19 +0,0 @@
-package squidpony.gdx.examples.desktop;
-
-import com.badlogic.gdx.Files;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import squidpony.gdx.examples.SquidAIDemo;
-
-public class SquidAIDemoLauncher {
-	public static void main (String[] arg) {
-		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
-		config.title = "SquidLib GDX AI Demo";
-		config.width = 40 * 2 * 6;
-		config.height = 40 * 12;
-		config.addIcon("Tentacle-16.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-32.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-128.png", Files.FileType.Classpath);
-		new LwjglApplication(new SquidAIDemo(), config);
-	}
-}

+ 0 - 19
squidlib/src/test/java/squidpony/gdx/examples/desktop/WorldMapDemoLauncher.java

@@ -1,19 +0,0 @@
-package squidpony.gdx.examples.desktop;
-
-import com.badlogic.gdx.Files;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import squidpony.gdx.examples.WorldMapDemo;
-
-public class WorldMapDemoLauncher {
-	public static void main (String[] arg) {
-		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
-		config.title = "SquidLib GDX World Map Demo";
-		config.width = 1200;
-		config.height = 600;
-		config.addIcon("Tentacle-16.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-32.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-128.png", Files.FileType.Classpath);
-		new LwjglApplication(new WorldMapDemo(), config);
-	}
-}

+ 0 - 21
squidlib/src/test/java/squidpony/gdx/examples/desktop/ZoneDemoLauncher.java

@@ -1,21 +0,0 @@
-package squidpony.gdx.examples.desktop;
-
-import com.badlogic.gdx.Files;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import squidpony.gdx.examples.ZoneDemo;
-
-public class ZoneDemoLauncher {
-	public static void main (String[] arg) {
-		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
-		config.title = "SquidLib GDX Zone Demo";
-		config.width = 80 * 16;
-		config.height = 50 * 16;
-		config.addIcon("Tentacle-16.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-32.png", Files.FileType.Classpath);
-		config.addIcon("Tentacle-128.png", Files.FileType.Classpath);
-		config.vSyncEnabled = false;
-        config.foregroundFPS = 0;
-		new LwjglApplication(new ZoneDemo(), config);
-	}
-}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1703
squidlib/src/test/java/squidpony/gdx/tests/HashVisualizer.java


+ 0 - 188
squidlib/src/test/java/squidpony/gdx/tests/IconsTest.java

@@ -1,188 +0,0 @@
-package squidpony.gdx.tests;
-
-import com.badlogic.gdx.ApplicationAdapter;
-import com.badlogic.gdx.Files;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.SpriteBatch;
-import com.badlogic.gdx.graphics.g2d.TextureAtlas;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.utils.Array;
-import com.badlogic.gdx.utils.viewport.StretchViewport;
-import squidpony.squidgrid.Direction;
-import squidpony.squidgrid.SpatialMap;
-import squidpony.squidgrid.gui.gdx.*;
-import squidpony.squidgrid.mapping.DungeonGenerator;
-import squidpony.squidgrid.mapping.DungeonUtility;
-import squidpony.squidmath.Coord;
-import squidpony.squidmath.CoordPacker;
-import squidpony.squidmath.SquidID;
-import squidpony.squidmath.StatefulRNG;
-
-import java.util.ArrayList;
-
-/**
- * Created by Tommy Ettinger on 4/6/2016.
- */
-public class IconsTest extends ApplicationAdapter{
-    int gridWidth, gridHeight, cellWidth, cellHeight;
-    SquidLayers layers;
-    char[][] map, displayedMap;
-    int[][] indicesFG, indicesBG;
-    StatefulRNG rng;
-    Stage stage;
-    SpriteBatch batch;
-    ArrayList<Color> colors;
-    Coord[] points;
-    double[][] resMap;
-    float ctr = 0;
-    TextureAtlas atlas;
-    SpatialMap<SquidID, AnimatedEntity> things;
-    Array<TextureAtlas.AtlasRegion> regions;
-    int totalRegions;
-    long seed;
-    @Override
-    public void create() {
-        super.create();
-        rng = new StatefulRNG(0x9876543210L);
-        atlas = DefaultResources.getIconAtlas();
-        regions = atlas.getRegions();
-        totalRegions = regions.size;
-        gridWidth = 50;
-        gridHeight = 25;
-        cellWidth = 32;
-        cellHeight = 32;
-        layers = new SquidLayers(gridWidth, gridHeight, cellWidth, cellHeight,
-                DefaultResources.getStretchableSquareFont());
-        layers.setTextSize(cellWidth, cellHeight+1);
-        //colors = DefaultResources.getSCC().rainbow(0.2f, 1.0f, 144);
-        /*
-        colors = DefaultResources.getSCC().zigzagGradient(Color.DARK_GRAY, Color.LIGHT_GRAY, 200);
-        colors.addAll(DefaultResources.getSCC().zigzagGradient(Color.LIGHT_GRAY, Color.DARK_GRAY, 200));
-        */
-        colors = DefaultResources.getSCC().rainbow(100);
-        layers.setLightingColor(Color.WHITE);
-        //PacMazeGenerator maze = new PacMazeGenerator(gridWidth, gridHeight, rng);
-        //OrganicMapGenerator org = new OrganicMapGenerator(gridWidth, gridHeight, rng);
-        DungeonGenerator gen = new DungeonGenerator(gridWidth, gridHeight, rng);
-        map = gen.generate();
-        displayedMap = DungeonUtility.hashesToLines(map);
-        indicesBG = DungeonUtility.generateBGPaletteIndices(map);
-        indicesFG = DungeonUtility.generatePaletteIndices(map);
-        resMap = DungeonUtility.generateResistances(map);
-        short[] packed = CoordPacker.pack(gen.getBareDungeon(), '.');
-        points = CoordPacker.fractionPacked(packed, 7);
-
-        seed = rng.getState();
-        things = new SpatialMap<SquidID, AnimatedEntity>(points.length);
-        AnimatedEntity ent;
-        for (int i = 0; i < points.length; i++) {
-            ent = layers.animateActor(points[i].x, points[i].y, regions.get(rng.nextInt(totalRegions)),
-                    i, colors);
-            things.add(points[i], new SquidID(), ent);
-            ent.actor.setUserObject(i);
-        }
-
-        batch = new SpriteBatch();
-        stage = new Stage(new StretchViewport(gridWidth * cellWidth, gridHeight * cellHeight), batch);
-        stage.addActor(layers);
-    }
-
-    @Override
-    public void resize(int width, int height) {
-        super.resize(width, height);
-    }
-
-    @Override
-    public void resume() {
-        super.resume();
-        atlas = DefaultResources.getIconAtlas();
-        regions = atlas.getRegions();
-        totalRegions = regions.size;
-        rng.setState(seed);
-        things = new SpatialMap<SquidID, AnimatedEntity>(points.length);
-        AnimatedEntity ent;
-        for (int i = 0; i < points.length; i++) {
-            ent = layers.animateActor(points[i].x, points[i].y, regions.get(rng.nextInt(totalRegions)),
-                    i, colors);
-            things.add(points[i], new SquidID(), ent);
-            ent.actor.setUserObject(i);
-        }
-    }
-
-    @Override
-    public void pause() {
-        super.pause();
-    }
-
-    @Override
-    public void render() {
-        super.render();
-        Gdx.gl.glClearColor(0f, 0f, 0f, 1.0f);
-        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-        ctr += Gdx.graphics.getDeltaTime();
-        if(ctr > 0.05) {
-            Coord pt;
-            AnimatedEntity ent;
-            Integer uo;
-            for (int i = 0; i < points.length; i++) {
-                pt = points[i];
-                ent = things.get(pt);
-                if(ent == null || ent.actor == null)
-                    continue;
-                uo =  ((Integer) (ent.actor.getUserObject()) + 1) % colors.size();
-                ent.actor.setUserObject(uo);
-                ent.actor.setColor(colors.get(uo));
-            }
-        }
-        SquidPanel panel = layers.getForegroundLayer();
-        if(ctr > 0.4) {
-            ctr -= 0.4;
-            Direction[] dirs = new Direction[4];
-            Coord alter, pt;
-            AnimatedEntity ent;
-            for (int i = 0; i < points.length; i++) {
-                pt = points[i];
-                rng.shuffle(Direction.CARDINALS, dirs);
-                for (Direction d : dirs) {
-                    alter = pt.translate(d);
-                    if (map[alter.x][alter.y] == '.' && !things.containsPosition(alter)) {
-                        points[i] = alter;
-                        ent = things.get(pt);
-                        ent.gridX = alter.x;
-                        ent.gridY = alter.y;
-                        ent.actor.setPosition(panel.adjustX(ent.gridX, false), panel.adjustY(ent.gridY));
-                        things.positionalModify(pt, ent);
-                        things.move(pt, alter);
-                        break;
-                    }
-                }
-            }
-
-        }
-
-        layers.put(0, 0, displayedMap, indicesFG, indicesBG);
-        stage.draw();
-        batch.begin();
-        for(AnimatedEntity ae : things)
-        {
-            layers.drawActor(batch, 1f, ae);
-        }
-        batch.end();
-
-    }
-
-    public static void main (String[] arg) {
-        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
-        config.title = "SquidLib Test: Icons";
-        config.width = 60 * 24;
-        config.height = 40 * 24;
-        config.addIcon("Tentacle-16.png", Files.FileType.Internal);
-        config.addIcon("Tentacle-32.png", Files.FileType.Internal);
-        config.addIcon("Tentacle-128.png", Files.FileType.Internal);
-        new LwjglApplication(new IconsTest(), config);
-    }
-}

+ 0 - 166
squidlib/src/test/java/squidpony/gdx/tests/SquidLayersTest.java

@@ -1,166 +0,0 @@
-package squidpony.gdx.tests;
-
-import com.badlogic.gdx.ApplicationAdapter;
-import com.badlogic.gdx.Files;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.SpriteBatch;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.utils.viewport.StretchViewport;
-import squidpony.squidgrid.Direction;
-import squidpony.squidgrid.FOV;
-import squidpony.squidgrid.Radius;
-import squidpony.squidgrid.gui.gdx.*;
-import squidpony.squidgrid.mapping.DungeonGenerator;
-import squidpony.squidgrid.mapping.DungeonUtility;
-import squidpony.squidgrid.mapping.OrganicMapGenerator;
-import squidpony.squidmath.Coord;
-import squidpony.squidmath.GreasedRegion;
-import squidpony.squidmath.StatefulRNG;
-
-import java.util.ArrayList;
-
-/**
- * Created by Tommy Ettinger on 4/6/2016.
- */
-public class SquidLayersTest extends ApplicationAdapter{
-    int gridWidth, gridHeight, cellWidth, cellHeight;
-    SquidLayers layers;
-    char[][] map, displayedMap;
-    int[][] indicesFG, indicesBG, lightness;
-    FOV fov;
-    TextCellFactory tcf;
-    StatefulRNG rng;
-    Stage stage;
-    SpriteBatch batch;
-    ArrayList<Color> colors, mColors;
-    int colorIndex = 0;
-    Coord[] points;
-    AnimatedEntity[] markers;
-    double[][] resMap;
-    float ctr = 0;
-    @Override
-    public void create() {
-        super.create();
-        rng = new StatefulRNG(0x9876543210L);
-        gridWidth = 120;
-        gridHeight = 50;
-        cellWidth = 8;
-        cellHeight = 17;
-        layers = new SquidLayers(gridWidth, gridHeight, cellWidth, cellHeight,
-                DefaultResources.getStretchableFont());
-        layers.setTextSize(cellWidth, cellHeight+1);
-        //colors = DefaultResources.getSCC().rainbow(0.2f, 1.0f, 144);
-        colors = DefaultResources.getSCC().loopingGradient(SColor.ATOMIC_TANGERINE, SColor.CRIMSON, 100);
-        mColors = DefaultResources.getSCC().loopingGradient(SColor.ALICE_BLUE, SColor.MAGIC_MINT, 123);
-        //colors.addAll(DefaultResources.getSCC().zigzagGradient(Color.MAGENTA, Color.RED, 200));
-        layers.setLightingColor(colors.get(colorIndex));
-        fov = new FOV(FOV.SHADOW);
-        //PacMazeGenerator maze = new PacMazeGenerator(gridWidth, gridHeight, rng);
-        OrganicMapGenerator org = new OrganicMapGenerator(gridWidth, gridHeight, rng);
-        DungeonGenerator gen = new DungeonGenerator(gridWidth, gridHeight, rng);
-        map = gen.generate(org.generate());
-        displayedMap = DungeonUtility.hashesToLines(map);
-        indicesBG = DungeonUtility.generateBGPaletteIndices(map);
-        indicesFG = DungeonUtility.generatePaletteIndices(map);
-        resMap = DungeonUtility.generateResistances(map);
-        GreasedRegion packed = new GreasedRegion(gen.getBareDungeon(), '.');
-        points = packed.randomPortion(rng, 10);
-        markers = new AnimatedEntity[points.length];
-        lightness = new int[gridWidth][gridHeight];
-        double[][] lit;
-        Coord pt;
-        for(int c = 0; c < points.length; c++)
-        {
-            pt = points[c];
-            lit = fov.calculateFOV(resMap, pt.x, pt.y, 11, Radius.CIRCLE);
-            for (int x = 0; x < gridWidth; x++) {
-                for (int y = 0; y < gridHeight; y++) {
-                    if(lit[x][y] > 0.0)
-                        lightness[x][y] += (int)(lit[x][y] * 200);
-                }
-            }
-            markers[c] = layers.directionMarker(pt.x, pt.y, mColors, 4f, 2, false);
-        }
-        for (int x = 0; x < gridWidth; x++) {
-            for (int y = 0; y < gridHeight; y++) {
-                lightness[x][y] -= 40;
-            }
-        }
-        batch = new SpriteBatch();
-        stage = new Stage(new StretchViewport(gridWidth * cellWidth, gridHeight * cellHeight), batch);
-        stage.addActor(layers);
-    }
-
-    @Override
-    public void resize(int width, int height) {
-        super.resize(width, height);
-    }
-
-    @Override
-    public void render() {
-        super.render();
-        Gdx.gl.glClearColor(0f, 0f, 0f, 1.0f);
-        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-        ctr += Gdx.graphics.getDeltaTime();
-        if(ctr > 0.3)
-            layers.setLightingColor(colors.get(colorIndex = (colorIndex + 1) % colors.size()));
-        if(ctr > 0.6) {
-            ctr -= 0.6;
-            lightness = new int[gridWidth][gridHeight];
-            double[][] lit;
-            Direction[] dirs = new Direction[4];
-            Coord alter;
-            for (int i = 0; i < points.length; i++) {
-                Coord pt = points[i];
-                rng.shuffle(Direction.CARDINALS, dirs);
-                for (Direction d : dirs) {
-                    alter = pt.translate(d);
-                    if (map[alter.x][alter.y] == '.') {
-                        pt = alter;
-                        points[i] = pt;
-                        markers[i].setDirection(d);
-                        layers.slide(markers[i], alter.x, alter.y, 2, 0.25f);
-                        break;
-                    }
-                }
-                lit = fov.calculateFOV(resMap, pt.x, pt.y, 7, Radius.CIRCLE);
-                for (int x = 0; x < gridWidth; x++) {
-                    for (int y = 0; y < gridHeight; y++) {
-                        if (lit[x][y] > 0.0)
-                            lightness[x][y] += (int) (lit[x][y] * 200);
-                    }
-                }
-            }
-            for (int x = 0; x < gridWidth; x++) {
-                for (int y = 0; y < gridHeight; y++) {
-                    lightness[x][y] -= 40;
-                }
-            }
-        }
-
-        layers.put(0, 0, displayedMap, indicesFG, indicesBG, lightness);
-        stage.draw();
-        stage.act();
-        int aeLen = layers.getForegroundLayer().animatedEntities.size();
-        batch.begin();
-        for (int i = 0; i < aeLen; i++) {
-            layers.drawActor(batch, 1f, layers.getForegroundLayer().animatedEntities.getAt(i), 2);
-        }
-        batch.end();
-    }
-
-    public static void main (String[] arg) {
-        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
-        config.title = "SquidLib Test: SquidLayers";
-        config.width = 120 * 8;
-        config.height = 50 * 17;
-        config.addIcon("Tentacle-16.png", Files.FileType.Internal);
-        config.addIcon("Tentacle-32.png", Files.FileType.Internal);
-        config.addIcon("Tentacle-128.png", Files.FileType.Internal);
-        new LwjglApplication(new SquidLayersTest(), config);
-    }
-}