-
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.
Savanna FX
- Loading branch information
Showing
33 changed files
with
1,350 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<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="output" path="bin"/> | ||
</classpath> |
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>SavannaSimulator</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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 @@ | ||
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import java.lang.String?> | ||
<?import javafx.collections.FXCollections?> | ||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Button?> | ||
<?import javafx.scene.control.CheckBox?> | ||
<?import javafx.scene.control.ChoiceBox?> | ||
<?import javafx.scene.control.ColorPicker?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.AnchorPane?> | ||
<?import javafx.scene.layout.HBox?> | ||
<?import javafx.scene.layout.VBox?> | ||
<?import model.Terrain?> | ||
|
||
<AnchorPane maxWidth="-Infinity" prefHeight="285.0" prefWidth="178.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.EditorPaneController"> | ||
<children> | ||
<VBox minHeight="-Infinity" minWidth="-Infinity" prefHeight="265.0" prefWidth="184.0" spacing="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="20.0"> | ||
<children> | ||
<HBox alignment="CENTER_LEFT" spacing="10.0"> | ||
<children> | ||
<Label prefHeight="17.0" prefWidth="47.0" text="Terrain:" /> | ||
<ChoiceBox fx:id="terrainBox" disable="false" prefHeight="25.0" prefWidth="99.0" value="River"> | ||
<items> | ||
<FXCollections fx:factory="observableArrayList"> | ||
<String fx:value="River" /> | ||
<String fx:value="Forest" /> | ||
</FXCollections> | ||
</items> | ||
</ChoiceBox> | ||
</children> | ||
</HBox> | ||
<HBox alignment="CENTER_LEFT" spacing="10.0"> | ||
<children> | ||
<Label alignment="TOP_LEFT" prefHeight="17.0" prefWidth="45.0" text="Size:" /> | ||
<ChoiceBox fx:id="sizeBox" prefHeight="27.0" prefWidth="103.0" value="Small"> | ||
<items> | ||
<FXCollections fx:factory="observableArrayList"> | ||
<String fx:value="Small" /> | ||
<String fx:value="Medium" /> | ||
<String fx:value="Large" /> | ||
</FXCollections> | ||
</items> | ||
</ChoiceBox> | ||
</children> | ||
</HBox> | ||
<HBox alignment="CENTER_LEFT" prefHeight="27.0" prefWidth="156.0" spacing="20.0"> | ||
<children> | ||
<Label prefHeight="17.0" prefWidth="36.0" text="Color:" /> | ||
<ColorPicker fx:id="colorBox" disable="true" prefHeight="27.0" prefWidth="103.0" /> | ||
</children> | ||
</HBox> | ||
<HBox alignment="CENTER_RIGHT"> | ||
<children> | ||
<Label prefHeight="17.0" prefWidth="194.0" text="Animation" /> | ||
<CheckBox fx:id="animationCheckBox" alignment="CENTER_RIGHT" contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false" prefHeight="17.0" prefWidth="41.0" selected="true" text="text" textAlignment="CENTER" textOverrun="CENTER_ELLIPSIS" /> | ||
</children> | ||
</HBox> | ||
</children> | ||
<opaqueInsets> | ||
<Insets /> | ||
</opaqueInsets> | ||
</VBox> | ||
<Button fx:id="readyButton" layoutX="-26.0" layoutY="-12.0" onAction="#readyToGo" mnemonicParsing="false" text="Ready!" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="25.0" /> | ||
<Button fx:id="clearButton" mnemonicParsing="false" onAction="#clearMap" text="Clear" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="95.0" /> | ||
</children> | ||
</AnchorPane> |
Binary file not shown.
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,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.SplitPane?> | ||
<?import javafx.scene.layout.AnchorPane?> | ||
<?import javafx.scene.layout.StackPane?> | ||
|
||
<SplitPane dividerPositions="0.821" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="580.0" prefWidth="1135.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.MainPaneController"> | ||
<items> | ||
<StackPane fx:id="leftPane" Style="-fx-border-width: 5; -fx-border-color: green"> | ||
|
||
</StackPane> | ||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="0.0" minWidth="-Infinity" prefHeight="578.0" prefWidth="180.0" SplitPane.resizableWithParent="false"> | ||
<children> | ||
|
||
<fx:include fx:id="editorPane" source="EditorPane.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /> | ||
|
||
</children> | ||
</AnchorPane> | ||
|
||
</items> | ||
</SplitPane> |
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,8 @@ | ||
<?xml version="1.0" encoding="ASCII"?> | ||
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build"> | ||
<deploy> | ||
<application name="SavannaSimulator"/> | ||
<info/> | ||
</deploy> | ||
<signjar/> | ||
</anttasks:AntTask> |
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,37 @@ | ||
package application; | ||
|
||
import javafx.application.Application; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.SplitPane; | ||
import javafx.stage.Stage; | ||
import model.EditorModel; | ||
|
||
public class Main extends Application | ||
{ | ||
@Override | ||
public void start(Stage primaryStage) | ||
{ | ||
try | ||
{ | ||
SplitPane root = new SplitPane(); | ||
|
||
root = (SplitPane) FXMLLoader.load(Main.class.getResource("/view/MainPane.fxml")); | ||
|
||
Scene scene = new Scene(root); | ||
primaryStage.setScene(scene); | ||
primaryStage.setTitle("Savanna Simulator v1.1"); | ||
primaryStage.show(); | ||
EditorModel.getInstance().sayHello(); | ||
} | ||
catch (Exception e) | ||
{ | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
launch(args); | ||
} | ||
} |
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 @@ | ||
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ |
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,97 @@ | ||
package controller; | ||
|
||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.CheckBox; | ||
import javafx.scene.control.ChoiceBox; | ||
import javafx.scene.control.ColorPicker; | ||
import model.EditorModel; | ||
import model.Size; | ||
import model.Terrain; | ||
|
||
public class EditorPaneController implements Initializable | ||
{ | ||
|
||
@FXML | ||
private ChoiceBox<String> terrainBox; | ||
|
||
@FXML | ||
private ChoiceBox<String> sizeBox; | ||
|
||
@FXML | ||
private ColorPicker colorBox; | ||
|
||
@FXML | ||
private Button readyButton; | ||
@FXML | ||
private Button clearButton; | ||
@FXML | ||
private CheckBox animationCheckBox; | ||
|
||
public CheckBox getAnimationCheckBox() | ||
{ | ||
return animationCheckBox; | ||
} | ||
|
||
public void setAnimationCheckBox(CheckBox animationCheckBox) | ||
{ | ||
this.animationCheckBox = animationCheckBox; | ||
} | ||
|
||
public ChoiceBox<String> getTerrainBox() | ||
{ | ||
return terrainBox; | ||
} | ||
|
||
public void setTerrainBox(ChoiceBox<String> terrainBox) | ||
{ | ||
this.terrainBox = terrainBox; | ||
} | ||
|
||
public ChoiceBox<String> getSizeBox() | ||
{ | ||
return sizeBox; | ||
} | ||
|
||
public void setSizeBox(ChoiceBox<String> sizeBox) | ||
{ | ||
this.sizeBox = sizeBox; | ||
} | ||
|
||
public ColorPicker getColorBox() | ||
{ | ||
return colorBox; | ||
} | ||
|
||
public void setColorBox(ColorPicker colorBox) | ||
{ | ||
this.colorBox = colorBox; | ||
} | ||
|
||
@Override | ||
public void initialize(URL location, ResourceBundle resources) | ||
{ | ||
EditorModel em = EditorModel.getInstance(); | ||
em.terrainProperty().bind(getTerrainBox().getSelectionModel().selectedItemProperty()); | ||
em.sizeProperty().bind(getSizeBox().getSelectionModel().selectedItemProperty()); | ||
em.animationProperty().bind(getAnimationCheckBox().selectedProperty()); | ||
|
||
} | ||
|
||
@FXML | ||
private void clearMap() | ||
{ | ||
EditorModel.getInstance().clearMap(); | ||
} | ||
|
||
@FXML | ||
private void readyToGo() | ||
{ | ||
EditorModel.getInstance().goToNextWindow(); | ||
} | ||
|
||
} |
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,83 @@ | ||
package controller; | ||
|
||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.Node; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.image.Image; | ||
import javafx.scene.image.ImageView; | ||
import javafx.scene.layout.GridPane; | ||
import javafx.scene.layout.StackPane; | ||
import model.EditorModel; | ||
import view.Field; | ||
|
||
public class MainPaneController implements Initializable | ||
{ | ||
private EditorModel editorModel; | ||
@FXML | ||
private EditorPaneController editorPaneController; | ||
|
||
|
||
@FXML | ||
private Label testLabel; | ||
|
||
@FXML | ||
private StackPane leftPane; | ||
|
||
@Override | ||
public void initialize(URL location, ResourceBundle resources) | ||
{ | ||
setEditorModel(EditorModel.getInstance()); | ||
// getEditorModel().init(); | ||
leftPane.getChildren().add(createGridPane()); | ||
/* | ||
* System.out.println("ok"); testLabel.textProperty() | ||
* .bind(editorPaneController.getTerrainBox().getSelectionModel(). | ||
* selectedItemProperty().asString()); | ||
* testLabel.textFillProperty().bind(editorPaneController.getColorBox(). | ||
* valueProperty()); testLabel.fontProperty() .bind(Bindings.when( | ||
* editorPaneController.getSizeBox().getSelectionModel(). | ||
* selectedItemProperty().isEqualTo("Large")) .then(new | ||
* Font(30)).otherwise(new Font(20))); | ||
*/ | ||
|
||
} | ||
|
||
public Node createGridPane() | ||
{ | ||
GridPane board = new GridPane(); | ||
for (int i = 0; i < EditorModel.BOARD_X_SIZE; i++) | ||
{ | ||
for (int j = 0; j < EditorModel.BOARD_Y_SIZE; j++) | ||
{ | ||
Field field = new Field(i, j); | ||
field.terrainProperty().bind((getEditorModel().getMap())[i][j]); | ||
|
||
/* | ||
* getEditorModel().getMap()[i][j].addListener((ov, oldVal, | ||
* newVal) -> { if (newVal.equals(Terrain.FOREST)) { | ||
* field.exitTransition.play(); } }); | ||
*/ | ||
Image im = new Image("file:pic1.png"); | ||
ImageView iv = new ImageView(im); | ||
iv.setMouseTransparent(true); | ||
board.add(new StackPane(field), i, j); | ||
} | ||
} | ||
|
||
return board; | ||
} | ||
|
||
public EditorModel getEditorModel() | ||
{ | ||
return editorModel; | ||
} | ||
|
||
public void setEditorModel(EditorModel editorModel) | ||
{ | ||
this.editorModel = editorModel; | ||
} | ||
} |
Oops, something went wrong.