Skip to content

Commit

Permalink
feat(ludo): Add titles
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStegii committed Feb 27, 2024
1 parent 8d82c78 commit ef13de8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ludo/src/main/java/de/uniks/ludo/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public void start(Stage primaryStage) {
}
});

// Setting the title pattern of the application. The %s will be replaced with the title of the view
setTitlePattern("Ludo - %s");

// Setting the resource path to the resources folder of the project (required for reloading in dev)
// If the resource path is not set, the framework will use the default resource path (src/main/resources)
setResourcesPath(Path.of("ludo/src/main/resources/"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import org.fulib.fx.annotation.controller.Controller;
import org.fulib.fx.annotation.controller.Resource;
import org.fulib.fx.annotation.controller.Title;
import org.fulib.fx.annotation.event.onRender;
import org.fulib.fx.annotation.param.Param;

import javax.inject.Inject;
import java.util.ResourceBundle;

@Title("%gameover.title")
@Controller
public class GameOverController {

@FXML
private Label playerWonLabel;

@Resource
@Inject
ResourceBundle bundle;

@Inject
public GameOverController() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import javafx.scene.shape.Circle;
import javafx.scene.shape.StrokeType;
import org.fulib.fx.annotation.controller.Controller;
import org.fulib.fx.annotation.controller.Resource;
import org.fulib.fx.annotation.controller.SubComponent;
import org.fulib.fx.annotation.controller.Title;
import org.fulib.fx.annotation.event.onDestroy;
import org.fulib.fx.annotation.event.onInit;
import org.fulib.fx.annotation.event.onRender;
Expand All @@ -30,6 +32,7 @@
import javax.inject.Inject;
import java.util.*;

@Title("%ingame.title")
@Controller
public class IngameController {

Expand All @@ -42,6 +45,7 @@ public class IngameController {
GameService gameService;
@Inject
Subscriber subscriber;
@Resource
@Inject
ResourceBundle bundle;
@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
import javafx.fxml.FXML;
import javafx.scene.control.Slider;
import org.fulib.fx.annotation.controller.Controller;
import org.fulib.fx.annotation.controller.Resource;
import org.fulib.fx.annotation.controller.Title;

import javax.inject.Inject;
import java.util.Map;
import java.util.ResourceBundle;

@Title("%setup.title")
@Controller
public class SetupController {

@FXML
private Slider playerAmountSlider;

@Resource
@Inject
ResourceBundle bundle;

@Inject
App app;

Expand Down
3 changes: 3 additions & 0 deletions ludo/src/main/resources/de/uniks/ludo/lang/lang_de.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ingame.current.player=Momentaner Spieler: %s
ingame.title=Mensch ärgere dich nicht
setup.select.player.amount=Spieleranzahl
setup.start.game=Spiel starten
setup.title=Spiel einrichten
gameover.title=Spiel vorbei
3 changes: 3 additions & 0 deletions ludo/src/main/resources/de/uniks/ludo/lang/lang_en.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ingame.current.player=Current player: %s
ingame.title=Ludo
setup.select.player.amount=Player amount
setup.start.game=Start game
setup.title=Set up the game
gameover.title=Game over!

0 comments on commit ef13de8

Please sign in to comment.