Skip to content

Commit 5cc593a

Browse files
committed
Fading works!
I needed to get rid of the post callback, and move the player, the viewer, and its light immediately upon moving.
1 parent 14bf3d2 commit 5cc593a

File tree

3 files changed

+37
-41
lines changed

3 files changed

+37
-41
lines changed

SquidSquad/DungeonDemo/core/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ dependencies {
1010
// implementation "com.squidpony:SquidPath:$squidSquadVersion"
1111
// implementation "com.squidpony:SquidText:$squidSquadVersion"
1212
// implementation "com.squidpony:SquidGlyph:$squidSquadVersion"
13-
implementation "com.github.yellowstonegames.squidsquad:squidcore:$squidSquadVersion"
14-
implementation "com.github.yellowstonegames.squidsquad:squidgrid:$squidSquadVersion"
15-
implementation "com.github.yellowstonegames.squidsquad:squidplace:$squidSquadVersion"
16-
implementation "com.github.yellowstonegames.squidsquad:squidpath:$squidSquadVersion"
17-
implementation "com.github.yellowstonegames.squidsquad:squidtext:$squidSquadVersion"
18-
implementation "com.github.yellowstonegames.squidsquad:squidglyph:$squidSquadVersion"
13+
implementation "com.github.yellowstonegames.SquidSquad:squidcore:$squidSquadVersion"
14+
implementation "com.github.yellowstonegames.SquidSquad:squidgrid:$squidSquadVersion"
15+
implementation "com.github.yellowstonegames.SquidSquad:squidplace:$squidSquadVersion"
16+
implementation "com.github.yellowstonegames.SquidSquad:squidpath:$squidSquadVersion"
17+
implementation "com.github.yellowstonegames.SquidSquad:squidtext:$squidSquadVersion"
18+
implementation "com.github.yellowstonegames.SquidSquad:squidglyph:$squidSquadVersion"
1919
}

SquidSquad/DungeonDemo/core/src/main/java/com/github/yellowstonegames/DungeonDemo.java

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public class DungeonDemo extends ApplicationAdapter {
7070
private final ObjectDeque<Coord> nextMovePositions = new ObjectDeque<>(200);
7171
private Coord cursor = Coord.get(-1, -1);
7272
private final Vector2 pos = new Vector2();
73-
private Runnable post;
7473

7574
public static final int SHOWN_WIDTH = 40;
7675
public static final int SHOWN_HEIGHT = 25;
@@ -128,14 +127,6 @@ public void create() {
128127

129128
playerGlyph = new GlyphActor(buffer.charAt(buffer.length()-1), "[red orange]", gg.getFont());
130129
gg.addActor(playerGlyph);
131-
post = () -> {
132-
Coord next = Coord.get(Math.round(playerGlyph.getX()), Math.round(playerGlyph.getY()));
133-
vision.moveViewer(player, next);
134-
// we can move the player's light now that we know there is no light for an enemy at next.
135-
vision.lighting.moveLight(player, next);
136-
player = next;
137-
vision.finishChanges();
138-
};
139130

140131
dungeonProcessor = new DungeonProcessor(PLACE_WIDTH, PLACE_HEIGHT, random);
141132
dungeonProcessor.addWater(DungeonProcessor.ALL, 30);
@@ -219,7 +210,10 @@ public void move(Direction way){
219210

220211
final Coord next = Coord.get(Math.round(playerGlyph.getX() + way.deltaX), Math.round(playerGlyph.getY() + way.deltaY));
221212
if(next.isWithin(PLACE_WIDTH, PLACE_HEIGHT) && barePlaceMap[next.x][next.y] == '.') {
222-
playerGlyph.addAction(MoreActions.slideTo(next.x, next.y, 0.2f, post));
213+
playerGlyph.addAction(MoreActions.slideTo(next.x, next.y, 0.2f));
214+
vision.moveViewer(player, next);
215+
vision.lighting.moveLight(player, next);
216+
player = next;
223217
}
224218
else{
225219
// if(MathUtils.randomBoolean())
@@ -230,10 +224,11 @@ public void move(Direction way){
230224
// .append(new GridAction.CloudAction(gg, 1.5f, inView, next, 5).useToxicColors()).conclude(post));
231225
// playerGlyph.addAction(MoreActions.bump(way, 0.3f).append(MoreActions.wiggle(0.125f, 0.2f)));
232226
playerGlyph.addAction(MoreActions.bump(way, 0.3f));
233-
gg.burst((playerGlyph.getX() + next.x) * 0.5f, (playerGlyph.getY() + next.y) * 0.5f, 1.5f, 7, ',', 0x992200FF, 0x99220000, 0f, 120f, 1f);
227+
gg.burst((playerGlyph.getX() + next.x) * 0.5f, (playerGlyph.getY() + next.y) * 0.5f, 1.5f, 6, '?', 0x992200FF, 0x99220000, -30f, 0f, 1f);
234228
// gg.summon(next.x, next.y, next.x, next.y + 0.5f, '?', 0xFF22CCAA, 0xFF22CC00, 0f, 0f, 1f);
235229
// gg.addAction(gg.dyeFG(next.x, next.y, 0x992200FF, 1f, Float.POSITIVE_INFINITY, null));
236230
}
231+
vision.finishChanges();
237232
}
238233

239234
public void regenerate(){
@@ -267,7 +262,7 @@ public void regenerate(){
267262
public void putMap(){
268263
int playerX = Math.round(playerGlyph.getX());
269264
int playerY = Math.round(playerGlyph.getY());
270-
float change = (float) Math.min(Math.max(TimeUtils.timeSinceMillis(lastMove) * 4.0, 0.0), 1000.0);
265+
float change = (float) Math.min(Math.max(TimeUtils.timeSinceMillis(lastMove) * 4f, 0.0), 1000.0);
271266
// Makes everything visible, mainly for FPS tests
272267
// ArrayTools.fill(vision.lighting.resistances, 0f);
273268
vision.update(change);
@@ -296,46 +291,46 @@ public void putMap(){
296291

297292
for (int y = 0; y < PLACE_HEIGHT; y++) {
298293
for (int x = 0; x < PLACE_WIDTH; x++) {
299-
if (vision.inView.contains(x, y)) {
294+
if (vision.seen.contains(x, y)) {
300295
{
301296
switch (vision.prunedPlaceMap[x][y]) {
302297
case '~':
303-
gg.backgrounds[x][y] = toRGBA8888(lerpColors(DEEP_OKLAB, vision.backgroundColors[x][y], 0.4f + 0.3f * waves.getConfiguredNoise(x, y, time)));
298+
gg.backgrounds[x][y] = toRGBA8888(lerpColorsBlended(vision.backgroundColors[x][y], DEEP_OKLAB, 0.4f + 0.3f * waves.getConfiguredNoise(x, y, time)));
304299
gg.put(x, y, vision.prunedPlaceMap[x][y], deepText);
305300
break;
306301
case ',':
307-
gg.backgrounds[x][y] = toRGBA8888(lerpColors(SHALLOW_OKLAB, vision.backgroundColors[x][y], 0.4f + 0.3f * waves.getConfiguredNoise(x, y, time)));
302+
gg.backgrounds[x][y] = toRGBA8888(lerpColorsBlended(vision.backgroundColors[x][y], SHALLOW_OKLAB, 0.4f + 0.3f * waves.getConfiguredNoise(x, y, time)));
308303
gg.put(x, y, vision.prunedPlaceMap[x][y], shallowText);
309304
break;
310305
case '"':
311-
gg.backgrounds[x][y] = toRGBA8888(lerpColors(lerpColors(GRASS_OKLAB, DRY_OKLAB, waves.getConfiguredNoise(x, y) * 0.5f + 0.5f), vision.backgroundColors[x][y], 0.3f + 0.2f * waves.getConfiguredNoise(x, y, time * 0.7f)));
306+
gg.backgrounds[x][y] = toRGBA8888(lerpColorsBlended(vision.backgroundColors[x][y], lerpColors(GRASS_OKLAB, DRY_OKLAB, waves.getConfiguredNoise(x, y) * 0.5f + 0.5f), 0.3f + 0.2f * waves.getConfiguredNoise(x, y, time * 0.7f)));
312307
gg.put(x, y, vision.prunedPlaceMap[x][y], grassText);
313308
break;
314309
case ' ':
315310
gg.backgrounds[x][y] = 0;
316311
break;
317312
default:
318-
gg.backgrounds[x][y] = toRGBA8888(lerpColors(STONE_OKLAB, vision.backgroundColors[x][y], 0.5f));
313+
gg.backgrounds[x][y] = toRGBA8888(lerpColorsBlended(vision.backgroundColors[x][y], STONE_OKLAB, 0.5f));
319314
gg.put(x, y, vision.prunedPlaceMap[x][y], stoneText);
320315
}
321316
}
322-
} else if (vision.seen.contains(x, y)) {
323-
switch (vision.prunedPlaceMap[x][y]) {
324-
case '~':
325-
gg.backgrounds[x][y] = toRGBA8888(edit(DEEP_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
326-
gg.put(x, y, vision.prunedPlaceMap[x][y], deepText);
327-
break;
328-
case ',':
329-
gg.backgrounds[x][y] = toRGBA8888(edit(SHALLOW_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
330-
gg.put(x, y, vision.prunedPlaceMap[x][y], shallowText);
331-
break;
332-
case ' ':
333-
gg.backgrounds[x][y] = 0;
334-
break;
335-
default:
336-
gg.backgrounds[x][y] = toRGBA8888(edit(STONE_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
337-
gg.put(x, y, vision.prunedPlaceMap[x][y], stoneText);
338-
}
317+
// } else if (vision.seen.contains(x, y)) {
318+
// switch (vision.prunedPlaceMap[x][y]) {
319+
// case '~':
320+
// gg.backgrounds[x][y] = toRGBA8888(edit(DEEP_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
321+
// gg.put(x, y, vision.prunedPlaceMap[x][y], deepText);
322+
// break;
323+
// case ',':
324+
// gg.backgrounds[x][y] = toRGBA8888(edit(SHALLOW_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
325+
// gg.put(x, y, vision.prunedPlaceMap[x][y], shallowText);
326+
// break;
327+
// case ' ':
328+
// gg.backgrounds[x][y] = 0;
329+
// break;
330+
// default:
331+
// gg.backgrounds[x][y] = toRGBA8888(edit(STONE_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
332+
// gg.put(x, y, vision.prunedPlaceMap[x][y], stoneText);
333+
// }
339334
} else {
340335
gg.backgrounds[x][y] = 0;
341336
}

SquidSquad/DungeonDemo/gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ gdxBackendsVersion=1.1210.1
66
gwtFrameworkVersion=2.11.0
77
gwtPluginVersion=1.1.29
88
freetypeGwtVersion=1.9.10.1
9-
squidSquadVersion=1466dea55e
9+
squidSquadVersion=f133d08536
10+
#squidSquadVersion=1466dea55e
1011

1112
gdxVersion=1.12.1
1213
funderbyVersion=0.1.2

0 commit comments

Comments
 (0)