commit
62a5e59c05
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/tpJeuDeL_oie.iml" filepath="$PROJECT_DIR$/.idea/tpJeuDeL_oie.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c44c2f96-8ae0-4f37-a212-587839ee08bf" name="Changes" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../../../.." />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2ZZJwcpiDLr2R3nWM1YGBHgEZ1j" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="c44c2f96-8ae0-4f37-a212-587839ee08bf" name="Changes" comment="" />
|
||||
<created>1702623908454</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1702623908454</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="18" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Oie.iml" filepath="$PROJECT_DIR$/Oie.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../../../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="lib1" level="application" />
|
||||
</component>
|
||||
</module>
|
Binary file not shown.
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ButtonBar?>
|
||||
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<BorderPane fx:id="myBorderPane" style="-fx-background-color: #ecf0f1;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.Fenetre">
|
||||
|
||||
</BorderPane>
|
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.
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ButtonBar?>
|
||||
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<BorderPane fx:id="myBorderPane" style="-fx-background-color: #ecf0f1;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.Fenetre">
|
||||
|
||||
</BorderPane>
|
@ -0,0 +1,15 @@
|
||||
package data;
|
||||
|
||||
import models.Jeu;
|
||||
import models.Pion;
|
||||
import models.Plateau;
|
||||
|
||||
public class Stub {
|
||||
public Jeu loadPions() {
|
||||
Plateau myPlateau = new Plateau(5);
|
||||
Jeu game = new Jeu(myPlateau);
|
||||
game.addPion(new Pion("rouge"));
|
||||
game.addPion(new Pion("bleu"));
|
||||
return game;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package launcher;
|
||||
|
||||
import data.Stub;
|
||||
import models.Jeu;
|
||||
import models.Pion;
|
||||
|
||||
public class ConsoleGame {
|
||||
|
||||
public static void main(String[] args) {
|
||||
final Jeu game = new Stub().loadPions();
|
||||
System.out.println(game.getPlateau().toString());
|
||||
Pion currentPion = game.getCurrentPion();
|
||||
System.out.println(currentPion.toString());
|
||||
System.out.println("Changement de Pion");
|
||||
currentPion = game.changePion();
|
||||
System.out.println(currentPion.toString());
|
||||
game.avancerPion();
|
||||
System.out.println(currentPion.toString());
|
||||
System.out.println(game.getPlateau().toString());
|
||||
game.avancerPion();
|
||||
System.out.println(currentPion.toString());
|
||||
System.out.println(game.getPlateau().toString());
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package launcher;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class GraphicGame extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Fenetre.fxml"));
|
||||
Parent root = loader.load();
|
||||
|
||||
primaryStage.setScene(new Scene(root, 700, 500));
|
||||
primaryStage.show();
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package models;
|
||||
|
||||
public class Case {
|
||||
private int idCase;
|
||||
private boolean presence;
|
||||
public Case(int i){
|
||||
idCase = i;
|
||||
presence = false;
|
||||
}
|
||||
public boolean getPresence() {
|
||||
return this.presence;
|
||||
}
|
||||
public void setPresence(boolean presence) {
|
||||
this.presence = presence;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.idCase + " " + this.presence + "\n";
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Jeu {
|
||||
private Plateau myPlateau;
|
||||
private List<Pion> pionsList = new ArrayList<>();
|
||||
private int currentPionId = 0;
|
||||
public Jeu(Plateau myPlateau) {
|
||||
this.myPlateau = myPlateau;
|
||||
}
|
||||
public Plateau getPlateau() {
|
||||
return this.myPlateau;
|
||||
}
|
||||
public List<Pion> getPionsList() {
|
||||
return this.pionsList;
|
||||
}
|
||||
public Pion getCurrentPion() {
|
||||
return pionsList.get(currentPionId);
|
||||
}
|
||||
public Pion changePion() {
|
||||
return pionsList.get(++currentPionId % pionsList.size());
|
||||
}
|
||||
public void avancerPion() {
|
||||
Pion currentPion = pionsList.get(currentPionId);
|
||||
if(currentPion.getCurrentIdCase() != 0) {
|
||||
this.myPlateau.getCaseList().get(currentPion.getCurrentIdCase() - 1).setPresence(false);
|
||||
}
|
||||
currentPion.setCurrentIdCase();
|
||||
this.myPlateau.getCaseList().get(currentPion.getCurrentIdCase()-1).setPresence(true);
|
||||
}
|
||||
public void addPion(Pion pion) {
|
||||
pionsList.add(pion);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package models;
|
||||
|
||||
public class Pion {
|
||||
private String color;
|
||||
private int idCase = 0;
|
||||
public Pion(String myColor) {
|
||||
this.color = myColor;
|
||||
}
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
public int getCurrentIdCase() {
|
||||
return this.idCase;
|
||||
}
|
||||
public void setCurrentIdCase() {
|
||||
this.idCase++;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Je suis le Pion de couleur " + this.color + " et je suis sur la case " + this.idCase;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Plateau {
|
||||
private List<Case> CaseList = new ArrayList<>();
|
||||
public Plateau(int nbCase) {
|
||||
for(int i = 1; i <= nbCase; ++i) {
|
||||
CaseList.add(new Case(i));
|
||||
}
|
||||
}
|
||||
public List<Case> getCaseList() {
|
||||
return this.CaseList;
|
||||
}
|
||||
public boolean addCaseList(Case myCase) {
|
||||
return this.CaseList.add(myCase);
|
||||
}
|
||||
public boolean removeCaseList(Case myCase) {
|
||||
return this.CaseList.remove(myCase);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String plateau = "";
|
||||
for(int i = 0; i < CaseList.size(); i++) {
|
||||
plateau = plateau.concat(CaseList.get(i).toString());
|
||||
}
|
||||
return plateau;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package view;
|
||||
|
||||
import data.Stub;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import models.Jeu;
|
||||
import models.Pion;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class Fenetre {
|
||||
@FXML
|
||||
private BorderPane myBorderPane = new BorderPane();
|
||||
private final Jeu game = new Stub().loadPions();
|
||||
Pion currentPion = game.getCurrentPion();
|
||||
|
||||
public void initialize() {
|
||||
for(int i = 0; i < game.getPlateau().getCaseList().size(); i++) {
|
||||
myBorderPane.setCenter(new Button().setText("hello"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue