Skip to content

172 fix game engine view instantiating gimmicks #173

Merged
merged 2 commits into from
May 27, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public void launchGimmickSession(final GameGimmick gimmick) {
secondsRemaining = 20;
refreshMetrics();

getViewElement().setGameGimmickContent(gimmick, (scoreDelta) -> {

getViewElement().getRootPane().setCenter(gimmick.getCanvasNode());
gimmick.initialize((scoreDelta) -> {
if (this.currentScore + scoreDelta >= 0) {
this.currentScore += scoreDelta;
refreshMetrics();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,6 @@ public void updateMetadataDisplay(final int score,
rankLabel.setText("Rank: " + rank);
}

/**
* Sets the content of this view based on the game provided through the
* {@link GameGimmick} interface.
*
* @param gimmick a concrete implementation of the {@link GameGimmick}
* interface
* */
public void setGameGimmickContent(final GameGimmick gimmick, final IntConsumer consumer) {
getRootPane().setCenter(gimmick.getCanvasNode());
gimmick.initialize(consumer);
}

/**
* Displays the report after a minigames timers is finished.
*
Expand Down