changement des
This commit is contained in:
parent
9e468f5f14
commit
8c55091fb2
@ -16,7 +16,7 @@ public class Main extends Application {
|
|||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
System.out.println("Lancement de l'application");
|
System.out.println("Lancement de l'application");
|
||||||
|
|
||||||
final URL fxmlURL = getClass().getResource("ressources/Menu.fxml"); // "ressources/Jouer_tour(1)lancer_des.fxml"
|
final URL fxmlURL = getClass().getResource("ressources/Jouer_tour(1)lancer_des.fxml"); // "ressources/Jouer_tour(1)lancer_des.fxml"
|
||||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||||
Pane root = fxmlLoader.load();
|
Pane root = fxmlLoader.load();
|
||||||
|
@ -6,13 +6,22 @@ import java.util.Random;
|
|||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import carte.CarteLieu;
|
import carte.CarteLieu;
|
||||||
|
import ihm.SpriteAnimation;
|
||||||
|
import javafx.animation.Animation;
|
||||||
|
import javafx.event.Event;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.geometry.Rectangle2D;
|
||||||
|
import javafx.scene.Group;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.util.Duration;
|
||||||
import main.Joueur;
|
import main.Joueur;
|
||||||
|
|
||||||
public class JouerSonTour1Controller implements Initializable{
|
public class JouerSonTour1Controller implements Initializable{
|
||||||
@ -20,10 +29,53 @@ public class JouerSonTour1Controller implements Initializable{
|
|||||||
|
|
||||||
@FXML private Pane rootPane;
|
@FXML private Pane rootPane;
|
||||||
@FXML private Label nomJoueur;
|
@FXML private Label nomJoueur;
|
||||||
|
@FXML private AnchorPane d6;
|
||||||
|
@FXML private AnchorPane d4;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
//nomJoueur.setText(joueur.getNom());
|
//nomJoueur.setText(joueur.getNom());
|
||||||
|
|
||||||
|
int OFFSET_X = 0;
|
||||||
|
int OFFSET_Y = 0;
|
||||||
|
int WIDTH = 200;
|
||||||
|
int HEIGHT = 200;
|
||||||
|
int COUNT = 6;
|
||||||
|
int COLUMNS = 6;
|
||||||
|
|
||||||
|
//anchorPane1.getChildren().setAll(imageView);
|
||||||
|
|
||||||
|
|
||||||
|
ImageView imageView;
|
||||||
|
try {
|
||||||
|
imageView = FXMLLoader.load(getClass().getResource("../ressources/img/des.fxml"));
|
||||||
|
imageView.setViewport(new Rectangle2D(OFFSET_X, OFFSET_Y, WIDTH, HEIGHT));
|
||||||
|
|
||||||
|
imageView.fitWidthProperty().bind(d6.widthProperty());
|
||||||
|
final SpriteAnimation animation = new SpriteAnimation(
|
||||||
|
imageView,
|
||||||
|
Duration.millis(250),
|
||||||
|
COUNT, COLUMNS,
|
||||||
|
OFFSET_X, OFFSET_Y,
|
||||||
|
557, 557
|
||||||
|
);
|
||||||
|
animation.setCycleCount(Animation.INDEFINITE);
|
||||||
|
animation.play();
|
||||||
|
d6.getChildren().addAll(new Group(imageView));
|
||||||
|
d6.setOnMousePressed(new EventHandler<Event>(
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(Event arg0) {
|
||||||
|
animation.stop();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.Pane?>
|
<?import javafx.scene.layout.Pane?>
|
||||||
<?import javafx.scene.shape.Polygon?>
|
|
||||||
<?import javafx.scene.shape.Rectangle?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<Pane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="480.0" prefWidth="640.0" stylesheets="@style/popUp.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.JouerSonTour1Controller">
|
<Pane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="480.0" prefWidth="640.0" stylesheets="@style/popUp.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.JouerSonTour1Controller">
|
||||||
@ -14,8 +13,6 @@
|
|||||||
<Font size="36.0" />
|
<Font size="36.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="WHITE" height="174.0" layoutX="130.0" layoutY="149.0" stroke="BLACK" strokeType="INSIDE" width="173.0" />
|
|
||||||
<Polygon fill="WHITE" layoutX="440.0" layoutY="216.0" points="-75.79998779296875, 98.80001831054688, 97.0, 98.80001831054688, 8.20001220703125, -59.199981689453125" stroke="BLACK" strokeType="INSIDE" />
|
|
||||||
<Button layoutX="262.0" layoutY="388.0" mnemonicParsing="false" onMouseClicked="#lancerDes" text="Lancer les dés">
|
<Button layoutX="262.0" layoutY="388.0" mnemonicParsing="false" onMouseClicked="#lancerDes" text="Lancer les dés">
|
||||||
<font>
|
<font>
|
||||||
<Font size="18.0" />
|
<Font size="18.0" />
|
||||||
@ -25,5 +22,7 @@
|
|||||||
<Font size="36.0" />
|
<Font size="36.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
|
<AnchorPane fx:id="d6" layoutX="91.0" layoutY="140.0" prefHeight="200.0" prefWidth="200.0" />
|
||||||
|
<AnchorPane fx:id="d4" layoutX="379.0" layoutY="140.0" prefHeight="200.0" prefWidth="200.0" />
|
||||||
</children>
|
</children>
|
||||||
</Pane>
|
</Pane>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user