Skip to content

Commit 99838ed

Browse files
Refac
1 parent 81f4928 commit 99838ed

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

pacman-app-tengen-mspacman/src/main/java/de/amr/pacmanfx/tengen/ms_pacman/scenes/TengenMsPacMan_BootScene.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import de.amr.pacmanfx.model.actors.Actor;
1111
import de.amr.pacmanfx.model.actors.Ghost;
1212
import de.amr.pacmanfx.tengen.ms_pacman.rendering.TengenMsPacMan_GameRenderer;
13-
import de.amr.pacmanfx.ui._2d.GameRenderer;
1413
import de.amr.pacmanfx.ui._2d.GameScene2D;
1514
import de.amr.pacmanfx.ui.api.GameUI;
1615
import javafx.scene.canvas.GraphicsContext;
@@ -23,13 +22,15 @@
2322
import static de.amr.pacmanfx.tengen.ms_pacman.TengenMsPacMan_UIConfig.nesPaletteColor;
2423
import static de.amr.pacmanfx.tengen.ms_pacman.model.TengenMsPacMan_GameModel.createGhost;
2524
import static de.amr.pacmanfx.tengen.ms_pacman.rendering.TengenMsPacMan_GameRenderer.blueShadedColor;
25+
import static de.amr.pacmanfx.ui._2d.GameRenderer.fillCanvas;
2626

2727
/**
2828
* Shows moving and color changing "TENGEN PRESENTS" text and ghost running through scene.
2929
*/
3030
public class TengenMsPacMan_BootScene extends GameScene2D {
3131

3232
public static final String TENGEN_PRESENTS = "TENGEN PRESENTS";
33+
public static final Color GRAY = nesPaletteColor(0x10);
3334

3435
private static final float GHOST_Y = 21.5f * TS;
3536

@@ -63,8 +64,7 @@ public void doInit() {
6364
}
6465

6566
@Override
66-
protected void doEnd() {
67-
}
67+
protected void doEnd() {}
6868

6969
@Override
7070
public void update() {
@@ -113,11 +113,11 @@ else if (tick == 220) {
113113
@Override
114114
public void drawSceneContent() {
115115
if (grayScreen) {
116-
GameRenderer.fillCanvas(canvas, nesPaletteColor(0x10));
116+
fillCanvas(canvas, GRAY);
117117
} else {
118-
renderer().fillTextAtScaledPosition(TENGEN_PRESENTS, blueShadedColor(tick), scaledArcadeFont8(),
118+
gameRenderer.fillTextAtScaledPosition(TENGEN_PRESENTS, blueShadedColor(tick), scaledArcadeFont8(),
119119
movingText.x(), movingText.y());
120-
renderer().drawActor(ghost);
120+
gameRenderer.drawActor(ghost);
121121
}
122122
}
123123

pacman-ui/src/main/java/de/amr/pacmanfx/ui/_2d/GameScene2D.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public abstract class GameScene2D implements GameScene {
3434
protected final GameUI ui;
3535

3636
protected final Color debugTextFill;
37+
protected final Color debugTextStroke;
3738
protected final Font debugTextFont;
3839

3940
protected final ObjectProperty<Font> arcadeFont8Property = new SimpleObjectProperty<>();
@@ -51,8 +52,9 @@ public abstract class GameScene2D implements GameScene {
5152
protected GameScene2D(GameUI ui) {
5253
this.ui = requireNonNull(ui);
5354
actionBindings = new DefaultActionBindingsManager();
54-
debugTextFill = ui.uiPreferences().getColor("debug_text.fill");
55-
debugTextFont = ui.uiPreferences().getFont("debug_text.font");
55+
debugTextFill = ui.uiPreferences().getColor("debug_text.fill");
56+
debugTextStroke = ui.uiPreferences().getColor("debug_text.stroke");
57+
debugTextFont = ui.uiPreferences().getFont("debug_text.font");
5658
}
5759

5860
@Override
@@ -163,10 +165,11 @@ protected void drawDebugInfo() {
163165
gameRenderer.drawTileGrid(sizePx.x(), sizePx.y(), Color.LIGHTGRAY);
164166
gameRenderer.ctx().ifPresent(ctx -> {
165167
ctx.setFill(debugTextFill);
168+
ctx.setStroke(debugTextStroke);
166169
ctx.setFont(debugTextFont);
167170
TickTimer stateTimer = gameContext().gameState().timer();
168171
String stateText = "Game State: '%s' (Tick %d of %s)".formatted(
169-
gameContext().gameState(),
172+
gameContext().gameState().name(),
170173
stateTimer.tickCount(),
171174
stateTimer.durationTicks() == TickTimer.INDEFINITE ? "∞" : String.valueOf(stateTimer.tickCount())
172175
);

pacman-ui/src/main/java/de/amr/pacmanfx/ui/api/GameUI_Preferences.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ protected void defineDefaultValues() {
4747
storeDefaultColor("context_menu.title.fill", Color.CORNFLOWERBLUE);
4848
storeDefaultFont("context_menu.title.font", Font.font("Dialog", FontWeight.BLACK, 14.0f));
4949

50-
storeDefaultColor("debug_text.fill", Color.YELLOW);
51-
storeDefaultFont("debug_text.font", Font.font("Sans", FontWeight.BOLD, 16.0f));
50+
storeDefaultColor("debug_text.fill", Color.WHITE);
51+
storeDefaultColor("debug_text.stroke", Color.GRAY);
52+
storeDefaultFont("debug_text.font", Font.font("Sans", 16.0f));
5253

5354
storeDefaultValue("scene2d.max_scaling", 5.0f);
5455
}

0 commit comments

Comments
 (0)