This commit is contained in:
blues 2020-07-29 15:22:30 +02:00
parent c371e9eed6
commit eea56824e4
22 changed files with 130 additions and 17 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="recource"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

Binary file not shown.

View File

@ -1,6 +1,7 @@
package application; package application;
import javafx.application.Preloader; import javafx.application.Preloader;
import javafx.application.Preloader.StateChangeNotification;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
@ -27,6 +28,18 @@ public class HangmanPreload extends Preloader {
} }
@Override
public void handleStateChangeNotification(Preloader.StateChangeNotification info) {
StateChangeNotification.Type type = info.getType();
switch (type) {
case BEFORE_START:
// Called after MyApplication#init and before MyApplication#start is called.
System.out.println("BEFORE_START");
preloaderStage.hide();
break;
}
} }
}

View File

@ -1,25 +1,33 @@
package application; package application;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import java.util.ResourceBundle;
import com.sun.javafx.application.LauncherImpl; import com.sun.javafx.application.LauncherImpl;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Preloader; import javafx.application.Preloader;
import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.text.Font;
import javafx.scene.text.Text; import javafx.scene.text.Text;
public class Main extends Application { public class Main extends Application {
@ -33,6 +41,31 @@ public class Main extends Application {
TextField textField; TextField textField;
@FXML @FXML
Text info; Text info;
@FXML
Label zuErratendesWort;
@FXML
private Label progress;
public static Label label;
@FXML
private ProgressBar progressBar;
public static ProgressBar statProgressBar;
@FXML
private void handleButtonAction(ActionEvent event) {
}
public void initialize(URL url, ResourceBundle rb) {
label = progress ;
statProgressBar = progressBar;
}
private static final int COUNT_LIMIT = 10;
String wort; String wort;
String rightletterString; String rightletterString;
@ -49,11 +82,14 @@ public class Main extends Application {
Scene scene = new Scene(root); Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.setTitle("****HANGMAN****"); primaryStage.setTitle("****HANGMAN****");
primaryStage.show(); primaryStage.show();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -127,6 +163,20 @@ public class Main extends Application {
return temp.get(random.nextInt(temp.size())).toString(); return temp.get(random.nextInt(temp.size())).toString();
} }
@Override
public void init() throws Exception {
// Perform some heavy lifting (i.e. database start, check for application updates, etc. )
for (int i = 1; i <= COUNT_LIMIT; i++) {
double progress = (double) i/10;
System.out.println("progress: " + progress);
LauncherImpl.notifyPreloader(this, new Preloader.ProgressNotification(progress));
Thread.sleep(250);
}
}

View File

@ -1,7 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.Bloom?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.effect.Light.Distant?>
<?import javafx.scene.effect.Lighting?>
<?import javafx.scene.effect.Reflection?>
<?import javafx.scene.effect.Shadow?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
@ -9,33 +17,66 @@
<AnchorPane prefHeight="424.0" prefWidth="608.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.Main"> <AnchorPane prefHeight="424.0" prefWidth="608.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.Main">
<children> <children>
<ImageView fx:id="hangmanImage" fitHeight="190.0" fitWidth="262.0" layoutX="316.0" layoutY="140.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fitHeight="425.0" fitWidth="636.0" layoutX="-2.0">
<image>
<Image url="@../images/bg.jpg" />
</image>
</ImageView>
<ImageView fx:id="hangmanImage" fitHeight="180.0" fitWidth="258.0" layoutX="370.0" layoutY="245.0" pickOnBounds="true" preserveRatio="true">
<effect>
<Bloom threshold="0.0" />
</effect></ImageView>
<TextField fx:id="textField" layoutX="37.0" layoutY="298.0" prefHeight="72.0" prefWidth="82.0" promptText="..."> <TextField fx:id="textField" layoutX="37.0" layoutY="298.0" prefHeight="72.0" prefWidth="82.0" promptText="...">
<font> <font>
<Font size="41.0" /> <Font size="41.0" />
</font> </font>
</TextField> </TextField>
<Text fx:id="text" layoutX="224.0" layoutY="130.0" strokeType="OUTSIDE" strokeWidth="0.0" textAlignment="CENTER" wrappingWidth="359.13671875"> <Text fx:id="text" fill="#f5f5f5" layoutX="130.0" layoutY="162.0" strokeType="OUTSIDE" strokeWidth="0.0" textAlignment="CENTER" wrappingWidth="359.13671875">
<font> <font>
<Font size="54.0" /> <Font size="48.0" />
</font> </font>
<effect>
<DropShadow color="#d70a0a" height="15.07" radius="7.775" spread="0.45" width="18.03" />
</effect>
</Text> </Text>
<Button layoutX="145.0" layoutY="329.0" mnemonicParsing="false" onAction="#checkLetter" text="Bestätigen" /> <Button layoutX="144.0" layoutY="342.0" mnemonicParsing="false" onAction="#checkLetter" prefHeight="33.0" prefWidth="155.0" text="Bestätigen">
<Button layoutX="22.0" layoutY="29.0" mnemonicParsing="false" onAction="#newGame" text="New Game" /> <effect>
<Text layoutX="22.0" layoutY="404.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Bitte einen Buchstaben eingeben" textAlignment="CENTER" wrappingWidth="295.0"> <Lighting surfaceScale="10.0">
<bumpInput>
<Shadow />
</bumpInput>
<light>
<Light.Distant color="#e11111" />
</light>
</Lighting>
</effect></Button>
<Button layoutX="144.0" layoutY="295.0" mnemonicParsing="false" onAction="#newGame" prefHeight="33.0" prefWidth="155.0" text="New Game">
<effect>
<Lighting surfaceScale="4.87">
<bumpInput>
<Shadow />
</bumpInput>
<light>
<Light.Distant color="#f20000" />
</light>
</Lighting>
</effect></Button>
<Text fill="#ff2222" layoutX="9.0" layoutY="271.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Wähle weise " wrappingWidth="195.0">
<font> <font>
<Font size="18.0" /> <Font name="Harrington" size="27.0" />
</font> </font>
<effect>
<Reflection />
</effect>
</Text> </Text>
<Text layoutX="20.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Zu erratendes Wort" textAlignment="CENTER" wrappingWidth="197.13671875"> <Text fx:id="info" fill="#f20808" layoutX="9.0" layoutY="412.0" strokeType="OUTSIDE" strokeWidth="0.0" textAlignment="CENTER" wrappingWidth="137.13671875">
<font>
<Font size="20.0" />
</font>
</Text>
<Text fx:id="info" fill="#f20808" layoutX="37.0" layoutY="205.0" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="137.13671875">
<font> <font>
<Font size="25.0" /> <Font size="25.0" />
</font> </font>
</Text> </Text>
<Label fx:id="zuErratendesWort" alignment="CENTER" layoutX="76.0" layoutY="14.0" prefHeight="87.0" prefWidth="481.0" text="H A N G M A N" textFill="#f8f5f5">
<effect>
<DropShadow color="#b91515" height="53.62" radius="21.862499999999997" spread="0.76" width="35.83" />
</effect></Label>
</children> </children>
</AnchorPane> </AnchorPane>

View File

@ -1 +1,9 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
@font-face {
font-family: BloodBlocks;
src: url('BloodBlocks.ttf');
}
.label{
-fx-font-family: 'BloodBlocks';
-fx-font-size: 60;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
HangmanFx/src/images/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB