1. Micha Kops
  2. jfx-ball-game

Commits

Micha Kops  committed d4ac647

Stylesheets edited.

  • Participants
  • Parent commits 78444dc
  • Branches master

Comments (0)

Files changed (5)

File src/main/java/com/hascode/jfx/game/BallGame.java

View file
  • Ignore whitespace
 import javafx.scene.Scene;
 import javafx.scene.SceneBuilder;
 import javafx.scene.image.Image;
+import javafx.scene.paint.Color;
 import javafx.stage.Stage;
 
 public class BallGame extends Application {
 	private static final String VIEW_GAME = "/view/GameView.fxml";
 	private static final String STYLESHEET_FILE = "/stylesheet/style.css";
 	public static final Image ICON = new Image(
-			SingleClassNoXmlBallGame.class.getResourceAsStream("/image/head.png"));
+			SingleClassNoXmlBallGame.class
+					.getResourceAsStream("/image/head.png"));
 
 	@Override
 	public void start(final Stage stage) throws Exception {
 	private void initGui(final Stage stage) throws IOException {
 		Parent root = FXMLLoader.load(getClass().getResource(VIEW_GAME));
 		Scene scene = SceneBuilder.create().root(root).width(500).height(530)
-				.build();
+				.fill(Color.GRAY).build();
 		scene.getStylesheets().add(STYLESHEET_FILE);
 		stage.setScene(scene);
 		stage.setTitle("hasCode.com - Java FX 2 Ball Game Tutorial");

File src/main/java/com/hascode/jfx/game/BallGameController.java

View file
  • Ignore whitespace
 
 	@Override
 	public void initialize(final URL url, final ResourceBundle bundle) {
-		applyDropShadowEffects();
+		// applyDropShadowEffects();
 		bindPaddleMouseEvents();
 		bindStartButtonEvents();
 		bindQuitButtonEvents();
 	}
 
 	private void initializeGame() {
+		for (ImageView r : model.getBoxes()) {
+			r.setVisible(true);
+		}
 		model.reset();
 	}
 

File src/main/java/com/hascode/jfx/game/SingleClassNoXmlBallGame.java

View file
  • Ignore whitespace
 	private double paddleTranslateX = 0.0;
 
 	private static final Image ICON = new Image(
-			SingleClassNoXmlBallGame.class.getResourceAsStream("/image/head.png"));
+			SingleClassNoXmlBallGame.class
+					.getResourceAsStream("/image/head.png"));
 
 	private final DropShadow dropshadowEffect = DropShadowBuilder.create()
 			.offsetY(4.0).offsetX(0.5).color(Color.BLACK).build();

File src/main/resources/stylesheet/style.css

View file
  • Ignore whitespace
 	-fx-font-size: 16pt;
 	-fx-font-family: "Arial";
 	-fx-width: 500px;
-	-fx-height:530px;
+	-fx-height: 530px;
+}
+
+#gameOverText,#winnerText {
+	-fx-font-size: 40pt;
+	-fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 100), 1, 1, 4, 2 );
+}
+
+#borderTop,#paddle,#ball {
+	-fx-effect: dropshadow(three-pass-box, #000000, 10.0,0.0,0.5,4.0);
 }

File src/main/resources/view/GameView.fxml

View file
  • Ignore whitespace
 		<Label fx:id="remainingBlocksLabel"/>
 	</ToolBar>
 	<ToolBar minWidth="500" layoutY="500">
-		<Hyperlink text="www.hascode.com" layoutX="360" layoutY="505"/>
+		<Hyperlink text="www.hascode.com" layoutX="360" layoutY="505" />
 	</ToolBar>
 </Group>