Skip to content

Commit

Permalink
Merge pull request #173 from Team-40-IDATT2003/172-fix-game-engine-vi…
Browse files Browse the repository at this point in the history
…ew-instantiating-classes

172 fix game engine view instantiating gimmicks
  • Loading branch information
etsorens authored May 27, 2026
2 parents 586973a + 8a69e9e commit b3d64b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
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

0 comments on commit b3d64b1

Please sign in to comment.