Add unimplemented, about pages
This commit is contained in:
parent
2827d79556
commit
21fa946011
@ -1,19 +1,26 @@
|
||||
package com.shr4pnel.minesweeper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.RadioMenuItem;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseButton;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Controller {
|
||||
@FXML
|
||||
@ -25,6 +32,9 @@ public class Controller {
|
||||
@FXML
|
||||
private RadioMenuItem color, marks;
|
||||
|
||||
@FXML
|
||||
private MenuItem about;
|
||||
|
||||
private Grid gridHandler;
|
||||
private GridWrapper wrapper;
|
||||
private boolean gameOver = false;
|
||||
@ -40,14 +50,40 @@ public class Controller {
|
||||
private void initialize() {
|
||||
setNotYetImplemented(color);
|
||||
setNotYetImplemented(marks);
|
||||
about.setOnAction(this::openAbout);
|
||||
setupGrid();
|
||||
gridHandler = new Grid();
|
||||
wrapper = gridHandler.grid;
|
||||
expandedTiles = new boolean[30][16];
|
||||
}
|
||||
|
||||
private void openAbout(ActionEvent actionEvent) {
|
||||
try {
|
||||
Parent root = FXMLLoader.load(getClass().getResource("about.fxml"));
|
||||
Stage stage = new Stage();
|
||||
stage.setTitle("About");
|
||||
stage.setScene(new Scene(root));
|
||||
stage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void setNotYetImplemented(RadioMenuItem node) {
|
||||
node.setOnAction((ActionEvent e) -> System.out.println("https://http.cat/images/501.jpg"));
|
||||
node.setOnAction(new EventHandler<>() {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
try {
|
||||
Parent root = FXMLLoader.load(getClass().getResource("unimplemented.fxml"));
|
||||
Stage stage = new Stage();
|
||||
stage.setTitle("Unimplemented!");
|
||||
stage.setScene(new Scene(root));
|
||||
stage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupGrid() {
|
||||
@ -60,8 +96,7 @@ public class Controller {
|
||||
}
|
||||
|
||||
private Button createBlankButton() {
|
||||
Image blank =
|
||||
new Image(String.valueOf(getClass().getResource("img/blank.png")), 16, 16, true, true);
|
||||
Image blank = new Image(String.valueOf(getClass().getResource("img/blank.png")), 16, 16, true, false);
|
||||
ImageView blankImage = new ImageView(blank);
|
||||
Button blankButton = new Button();
|
||||
blankButton.setGraphic(blankImage);
|
||||
|
31
src/main/resources/com/shr4pnel/minesweeper/about.fxml
Normal file
31
src/main/resources/com/shr4pnel/minesweeper/about.fxml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
|
||||
<AnchorPane prefHeight="225.0" prefWidth="454.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" layoutX="146.0" layoutY="31.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@winmine.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Text layoutY="42.0" strokeType="OUTSIDE" strokeWidth="0.0" text="made with love - shrapnelnet" textAlignment="CENTER" wrappingWidth="454.0">
|
||||
<font>
|
||||
<Font name="Source Code Pro" size="13.0" />
|
||||
</font>
|
||||
</Text>
|
||||
<Text layoutY="183.0" strokeType="OUTSIDE" strokeWidth="0.0" text="greeTz: b4rkod, ping, cockpit, vulon, i330 n' porcupine" textAlignment="CENTER" wrappingWidth="454.0">
|
||||
<font>
|
||||
<Font name="Source Code Pro" size="13.0" />
|
||||
</font>
|
||||
</Text>
|
||||
<Text layoutY="200.0" strokeType="OUTSIDE" strokeWidth="0.0" text="next time make your own!" textAlignment="CENTER" wrappingWidth="454.0">
|
||||
<font>
|
||||
<Font name="Source Code Pro" size="13.0" />
|
||||
</font>
|
||||
</Text>
|
||||
|
||||
</children>
|
||||
</AnchorPane>
|
BIN
src/main/resources/com/shr4pnel/minesweeper/img/204.jpg
Normal file
BIN
src/main/resources/com/shr4pnel/minesweeper/img/204.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -8,7 +8,7 @@
|
||||
|
||||
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="350.0" prefWidth="500.0" style="-fx-border-color: black; -fx-border-width: 1px;" stylesheets="@fix-glow.css" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.shr4pnel.minesweeper.Controller">
|
||||
<children>
|
||||
<MenuBar style="-fx-background-color: white;">
|
||||
<MenuBar prefWidth="498.0" style="-fx-background-color: white;">
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="Game">
|
||||
<items>
|
||||
@ -23,7 +23,7 @@
|
||||
<ToggleGroup fx:id="difficulty" />
|
||||
</toggleGroup>
|
||||
</RadioMenuItem>
|
||||
<RadioMenuItem mnemonicParsing="false" text="Internmediate" toggleGroup="$difficulty" />
|
||||
<RadioMenuItem mnemonicParsing="false" text="Intermediate" toggleGroup="$difficulty" />
|
||||
<RadioMenuItem mnemonicParsing="false" selected="true" text="Expert" toggleGroup="$difficulty" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<RadioMenuItem fx:id="marks" mnemonicParsing="false" selected="true" text="Marks (?)" />
|
||||
@ -36,7 +36,7 @@
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="About Minesweeper" />
|
||||
<MenuItem fx:id="about" mnemonicParsing="false" text="About Minesweeper" />
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
|
||||
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="420.0" prefWidth="525.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<ImageView fitHeight="420.0" fitWidth="531.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@img/204.jpg" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</children>
|
||||
</Pane>
|
Loading…
x
Reference in New Issue
Block a user