-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreditsPane.java
149 lines (126 loc) · 5.32 KB
/
CreditsPane.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.control.Button;
import javafx.scene.layout.Pane;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.text.*;
public class CreditsPane extends Pane {
//Constants
private final String SOUND_ICON = "/img/soundIcon.png";
private final String SETTINGS_ICON = "/img/Settings-icon.png";
private final String BACK_ICON = "/img/backIcon.png";
private final String TEAM_IMAGE = "/img/creditspage.png";
private final String COPYRIGHT_LABEL = "Developed by Royal Flush";
private final double WIDTH = 1080;
private final double HEIGHT = 720;
private final double COPYRIGHT_PANEL_SIZE = 60;
private final int ICON_SIZE = 64;
//Variables
int tutorialCount;
//Labels
private Label copyRightLabel;
private Pane copyRightPanel;
private Label version;
//Buttons
private Button soundButton;
private Button settingsButton;
private Button backButton;
//Images
private ImageView soundImage;
private ImageView settingsImage;
private ImageView backImage;
private Image[] tutorialImage;
private ImageView tutorial;
public CreditsPane() {
super();
initialize();
}
public void initialize(){
//Creating middle panel
this.setMinHeight(HEIGHT - COPYRIGHT_PANEL_SIZE);
this.setMinWidth(WIDTH);
//Creating copyright panel
copyRightPanel = new Pane();
//Copyright label
copyRightLabel = new Label(COPYRIGHT_LABEL);
//Version label
version = new Label("Version b0.1");
//How_To Panel
Label settings = new Label("");
settings.setStyle("-fx-font-weight: bold;");
ImageView labelImage = new ImageView("/img/credits.png");
labelImage.setFitWidth(400);
labelImage.setFitHeight(60);
settings.setGraphic(labelImage);
settings.setMaxSize(450,75);
settings.setFont(new Font("Verdana", 45));
settings.setLayoutX(335);
settings.setLayoutY(30);
//Sound button
soundImage = new ImageView(new Image(SOUND_ICON));
soundImage.setFitWidth(ICON_SIZE);
soundImage.setFitHeight(ICON_SIZE);
soundButton = new Button();
soundButton.setGraphic(soundImage);
soundButton.setStyle("-fx-background-color: transparent");
soundButton.setMinSize(ICON_SIZE, ICON_SIZE);
soundButton.setLayoutX(WIDTH - 100);
soundButton.setLayoutY(25);
//Settings button
settingsImage = new ImageView(new Image(SETTINGS_ICON));
settingsImage.setFitWidth(ICON_SIZE);
settingsImage.setFitHeight(ICON_SIZE);
settingsButton = new Button();
settingsButton.setGraphic(settingsImage);
settingsButton.setStyle("-fx-background-color: transparent");
settingsButton.setMinSize(ICON_SIZE, ICON_SIZE);
settingsButton.setLayoutX(WIDTH - 200);
settingsButton.setLayoutY(25);
//Back button
backImage = new ImageView(BACK_ICON);
backImage.setFitWidth(ICON_SIZE);
backImage.setFitHeight(ICON_SIZE);
backButton = new Button();
backButton.setGraphic(backImage);
backButton.setStyle("-fx-background-color: transparent");
backButton.setMinSize(ICON_SIZE, ICON_SIZE);
backButton.setLayoutX(25);
backButton.setLayoutY(25);
//Tutorial Images
tutorialCount = 1;
tutorialImage = new Image[tutorialCount];
tutorialImage[0] = new Image(getClass().getResourceAsStream(TEAM_IMAGE), 950, 750, true, false);
tutorial = new ImageView(tutorialImage[0]);
tutorial.setLayoutX(50);
tutorial.setLayoutY(150);
// tutorial.setFitHeight(500);
addAnimation(10);
//Adding buttons to middle panel
this.getChildren().addAll(settings, soundButton, settingsButton, backButton, tutorial);
this.setCurrentColor(null);
copyRightPanel.getChildren().add(copyRightLabel);
copyRightPanel.getChildren().add(version);
}
public void setCurrentColor(String colorCSS){
if (colorCSS == null){
this.setStyle("-fx-background-color: #81aae6;");
}else{
this.setStyle(colorCSS);
}
}
public void addAnimation(int factor) {
soundButton.setOnMouseEntered(new GameManager.Animation(soundButton, factor, true));
soundButton.setOnMouseExited(new GameManager.Animation(soundButton, factor, false));
backButton.setOnMouseEntered(new GameManager.Animation(backButton, factor, true));
backButton.setOnMouseExited(new GameManager.Animation(backButton, factor, false));
settingsButton.setOnMouseEntered(new GameManager.Animation(settingsButton, factor, true));
settingsButton.setOnMouseExited(new GameManager.Animation(settingsButton, factor, false));
}
public void addHandler( GameManager.ButtonListener e) {
backButton.addEventHandler(MouseEvent.MOUSE_CLICKED, e);
GameManager.ButtonListener settings = e.clone();
settings.setIndex(4);
settingsButton.addEventHandler(MouseEvent.MOUSE_CLICKED, settings);
}
}