Ajout de la liste des case

julien
ZIRTR0X 4 years ago
parent 80d21d9003
commit bf8a49ac9b

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SplitMenuButton?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="levelRoot" xmlns:fx="http://javafx.com/fxml/1" id="pane" maxHeight="-Infinity" maxWidth="-Infinity"
minHeight="-Infinity"
minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0"
xmlns="http://javafx.com/javafx/11" fx:controller="controller.GameConfigMenuController">
<children>
<ImageView fitHeight="709.0" fitWidth="1072.0" layoutX="-16.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="/image/difficulty.jpg"/>
</image>
</ImageView>
<Rectangle arcHeight="5.0" arcWidth="5.0" height="344.0" layoutX="33.0" layoutY="137.0" opacity="0.6"
stroke="BLACK" strokeLineCap="ROUND" strokeLineJoin="ROUND" strokeMiterLimit="0.0" strokeWidth="5.0"
width="272.0">
<cursor>
<Cursor fx:constant="DEFAULT"/>
</cursor>
</Rectangle>
<Label layoutX="44.0" layoutY="151.0" prefHeight="18.0" prefWidth="69.0" text="Difficulty" textFill="WHITE">
<font>
<Font name="Segoe UI Black" size="12.0"/>
</font>
</Label>
<Line endX="181.0" endY="-3.0517578125E-5" layoutX="107.0" layoutY="160.0" startX="1.0889129638671875"
startY="-1.52587890625E-5" stroke="#535252"/>
<JFXToggleButton prefHeight="33.0" prefWidth="75.0" selected="true" textFill="WHITE"
toggleColor="#8e8c8c"
toggleLineColor="WHITE" unToggleLineColor="#99999981"/>
<JFXToggleButton prefHeight="33.0" prefWidth="75.0" textFill="WHITE" toggleColor="#8e8c8c"
toggleLineColor="WHITE" unToggleLineColor="#99999981"/>
<JFXToggleButton prefHeight="33.0" prefWidth="75.0" textFill="WHITE" toggleColor="#8e8c8c"
toggleLineColor="WHITE" unToggleLineColor="#99999981"/>
<Line endX="240.5999755859375" endY="-3.0517578125E-5" layoutX="47.0" layoutY="467.0"
startX="1.0889129638671875"
startY="-1.52587890625E-5" stroke="#535252"/>
<Label layoutX="144.0" layoutY="229.0" text="Medium" textFill="#a9a1a1">
<font>
<Font name="Segoe UI Black" size="12.0"/>
</font>
</Label>
<Label layoutX="79.0" layoutY="229.0" text="Easy" textFill="#a9a1a1">
<font>
<Font name="Segoe UI Black" size="12.0"/>
</font>
</Label>
<Label layoutX="230.0" layoutY="229.0" text="Hard" textFill="#a9a1a1">
<font>
<Font name="Segoe UI Black" size="12.0"/>
</font>
</Label>
<Line endX="181.0" endY="-3.0517578125E-5" layoutX="107.0" layoutY="275.0" startX="-26.200027465820312"
startY="-3.0517578125E-5" stroke="#535252"/>
<Label layoutX="44.0" layoutY="265.0" prefHeight="18.0" prefWidth="30.0" text="Skin" textFill="WHITE">
<font>
<Font name="Segoe UI Black" size="12.0"/>
</font>
</Label>
<ImageView fitHeight="126.0" fitWidth="109.0" layoutX="38.0" layoutY="309.0" pickOnBounds="true"
preserveRatio="true">
<image>
<Image url="/image/personnage/Perso1.png"/>
</image>
</ImageView>
<SplitMenuButton alignment="CENTER" contentDisplay="CENTER" layoutX="152.0" layoutY="351.0"
mnemonicParsing="false" text="Choix Personnage">
<items>
<MenuItem mnemonicParsing="false" text="Personnage 1"/>
<MenuItem mnemonicParsing="false" text="Personnage 2"/>
<MenuItem mnemonicParsing="false" text="Personnage 3"/>
</items>
<font>
<Font name="Segoe UI Black" size="12.0"/>
</font>
</SplitMenuButton>
</children>
</AnchorPane>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ImageView fitHeight="600.0" fitWidth="600.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="/image/terrain/map1.png" />
</image>
</ImageView>
<Rectangle arcWidth="5.0" fill="#535353" height="614.0" layoutX="599.0" layoutY="-7.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="302.0" />
<ImageView fitHeight="85.0" fitWidth="59.0" layoutX="625.0" layoutY="28.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="/image/personnage/Perso1.2.png" />
</image>
</ImageView>
<Text fill="WHITE" layoutX="712.0" layoutY="64.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Joueur 1">
<font>
<Font name="Segoe UI Black" size="19.0" />
</font>
</Text>
<Button layoutX="711.0" layoutY="519.0" mnemonicParsing="false" style="-fx-background-color: #ffa20d;" text="Lancer le dé" textFill="WHITE" />
<Rectangle arcHeight="20.0" arcWidth="20.0" height="342.0" layoutX="624.0" layoutY="149.0" opacity="0.21" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="252.0" />
<Text fill="WHITE" layoutX="729.0" layoutY="180.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Action">
<font>
<Font size="15.0" />
</font>
</Text>
<Line endX="74.33331298828125" endY="1.52587890625E-5" layoutX="763.0" layoutY="201.0" startX="-100.0" stroke="WHITE" />
</children>
</AnchorPane>

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ImageView fitHeight="600.0" fitWidth="600.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="/image/terrain/map1.png" />
</image>
</ImageView>
<Rectangle arcWidth="5.0" fill="#535353" height="614.0" layoutX="599.0" layoutY="-7.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="302.0" />
<ImageView fitHeight="85.0" fitWidth="59.0" layoutX="625.0" layoutY="28.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="/image/personnage/Perso1.2.png" />
</image>
</ImageView>
<Text fill="WHITE" layoutX="712.0" layoutY="64.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Joueur 1">
<font>
<Font name="Segoe UI Black" size="19.0" />
</font>
</Text>
<Button layoutX="711.0" layoutY="519.0" mnemonicParsing="false" style="-fx-background-color: #ffa20d;" text="Lancer le dé" textFill="WHITE" />
<Rectangle arcHeight="20.0" arcWidth="20.0" height="342.0" layoutX="624.0" layoutY="149.0" opacity="0.21" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="252.0" />
<Text fill="WHITE" layoutX="729.0" layoutY="180.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Action">
<font>
<Font size="15.0" />
</font>
</Text>
<Line endX="74.33331298828125" endY="1.52587890625E-5" layoutX="763.0" layoutY="201.0" startX="-100.0" stroke="WHITE" />
</children>
</AnchorPane>

@ -6,10 +6,8 @@ import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.media.MediaPlayer;
import javafx.stage.Stage;
import model.Album;
import model.Database;
import model.*;
import javafx.scene.media.Media;
import model.Musique;
import java.io.File;
@ -22,16 +20,21 @@ import java.util.Objects;
public class Main extends Application {
private static Database currentd;
@Override
public void stop(){
System.out.println("Stopping");
}
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/GameConfigurationMenu.fxml")));
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/PageGame.fxml")));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 900, 600));
primaryStage.setResizable(false);
primaryStage.show();
//String pathmusique ="/musique/medieval_musique1.mp3";
//début musique
ArrayList<Musique> musiqueListe = new ArrayList<Musique>();
Musique song1 = new Musique("/musique/medieval_musique1.mp3",211000);
Musique song2 = new Musique("/musique/medieval_musique2.mp3",248000);
@ -43,6 +46,27 @@ public class Main extends Application {
song.addList(song3);
song.addList(song4);
song.play();
//fin musique
//début map
//Map map = new Map(30,5,5,20,20);
Map map = new Map(32,30);
Case case1 = new Case(1,2,2, true, false,map);
Case case2 = new Case(2,3,2, false, false,map);
Case case3 = new Case(3,4,2, false, false,map);
Case case4 = new Case(4,5,2, false, false,map);
map.addCase(case1);
map.addCase(case2);
map.addCase(case3);
map.addCase(case4);
Avatar avatar1 = new Avatar(1, "/image/personnage/Person1.2.png");
avatar1.setCoord(map.getCoordStartX(), map.getCoordStartY());
//fin map
//fin map
}

@ -0,0 +1,57 @@
package model;
public class Avatar {
int idAvatar;
String image;
int coordX;
int coordY;
public Avatar(int idAvatar, String image, int coordX, int coordY) {
this.idAvatar = idAvatar;
this.image = image;
this.coordX = coordX;
this.coordY = coordY;
}
public Avatar(int idAvatar, String image) {
this.idAvatar = idAvatar;
this.image = image;
}
public int getIdAvatar() {
return idAvatar;
}
public String getImage() {
return image;
}
public int getCoordX() {
return coordX;
}
public int getCoordY() {
return coordY;
}
public void setIdAvatar(int idAvatar) {
this.idAvatar = idAvatar;
}
public void setImage(String image) {
this.image = image;
}
public void setCoordX(int coordX) {
this.coordX = coordX;
}
public void setCoordY(int coordY) {
this.coordY = coordY;
}
public void setCoord(int coordX, int coordY){
this.coordX = coordX;
this.coordY = coordY;
}
}

@ -0,0 +1,59 @@
package model;
public class Case {
int idCase;
int coordX;
int coordY;
boolean isStart;
boolean isEnd;
int sizeTile;
public Case(int idCase, int coordX, int coordY, boolean isStart, boolean isEnd, Map map) {
this.sizeTile = map.getSizeTile();
this.idCase = idCase;
this.coordX = coordX*sizeTile;
this.coordY = coordY*sizeTile;
this.isStart = isStart;
this.isEnd = isEnd;
}
public int getIdCase() {
return idCase;
}
public int getCoordX() {
return coordX;
}
public int getCoordY() {
return coordY;
}
public boolean isStart() {
return isStart;
}
public boolean isEnd() {
return isEnd;
}
public void setIdCase(int idCase) {
this.idCase = idCase;
}
public void setCoordX(int coordX) {
this.coordX = coordX;
}
public void setCoordY(int coordY) {
this.coordY = coordY;
}
public void setStart(boolean start) {
isStart = start;
}
public void setEnd(boolean end) {
isEnd = end;
}
}

@ -0,0 +1,56 @@
package model;
import java.util.ArrayList;
public class Map {
private int sizeTile;
private int sizeMap;
private ArrayList<Case> map;
public Map(int sizeTile, int sizeMap) {
this.sizeTile = sizeTile;
this.sizeMap = sizeMap;
this.map = new ArrayList<Case>();
}
public void addCase(Case c) {
this.map.add(c);
}
public void removeCase(Case c) {
this.map.remove(c);
}
public ArrayList<Case> getMap() {
return this.map;
}
public int getSizeTile() {
return this.sizeTile;
}
public int getSizeMap() {
return this.sizeMap;
}
public int getCoordStartX(){
for(Case c : this.map){
if(c.isStart == true){
return c.getCoordX();
}
}
return 666; //code erreur
}
public int getCoordStartY(){
for(Case c : this.map){
if(c.isStart == true){
return c.getCoordY();
}
}
return 666; //code erreur
}
}
Loading…
Cancel
Save