-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: done, but ... * chore: made it retain size
- Loading branch information
Showing
5 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.rpg.model.actions; | ||
|
||
public class GameEndAction implements Action { | ||
public final String description; | ||
|
||
public GameEndAction(String description) { | ||
this.description = description; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.rpg.view; | ||
|
||
import io.rpg.viewmodel.GameEndViewModel; | ||
import java.io.IOException; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
|
||
public class GameEndView extends Scene { | ||
private GameEndViewModel viewModel; | ||
|
||
private GameEndView(Parent parent) { | ||
super(parent); | ||
} | ||
|
||
public static GameEndView load() { | ||
GameEndViewModel viewModel; | ||
try { | ||
viewModel = GameEndViewModel.load(); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
GameEndView view = new GameEndView(viewModel.getParent()); | ||
view.viewModel = viewModel; | ||
return view; | ||
} | ||
|
||
public void setDescription(String description) { | ||
viewModel.setDescription(description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.rpg.viewmodel; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.Objects; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.control.Label; | ||
|
||
public class GameEndViewModel { | ||
public static final String GAME_END_VIEW_FXML = "game-end-view.fxml"; | ||
private Parent parent; | ||
@FXML private Label descriptionLabel; | ||
|
||
public static GameEndViewModel load() throws IOException { | ||
URL url = Objects.requireNonNull(GameEndViewModel.class.getResource(GAME_END_VIEW_FXML)); | ||
FXMLLoader loader = new FXMLLoader(url); | ||
Parent root = loader.load(); | ||
GameEndViewModel viewModel = loader.getController(); | ||
viewModel.parent = root; | ||
return viewModel; | ||
} | ||
|
||
public Parent getParent() { | ||
return parent; | ||
} | ||
|
||
public void setDescription(String description) { | ||
descriptionLabel.setText(description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.VBox?> | ||
<?import javafx.scene.text.Font?> | ||
|
||
|
||
<VBox fx:controller="io.rpg.viewmodel.GameEndViewModel" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-background-color: #1c1c1c;" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"> | ||
<children> | ||
<Label text="GAME OVER" textFill="WHITE"> | ||
<font> | ||
<Font name="Sitka Small" size="72.0" /> | ||
</font> | ||
</Label> | ||
<Label fx:id="descriptionLabel" alignment="CENTER" maxWidth="300.0" text="No description given." textAlignment="CENTER" textFill="#848484" wrapText="true"> | ||
<font> | ||
<Font name="Sitka Small" size="18.0" /> | ||
</font> | ||
</Label> | ||
</children> | ||
<padding> | ||
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" /> | ||
</padding> | ||
</VBox> |