From 20016ad19d03fce9abcd2ef1289411ea487c01a9 Mon Sep 17 00:00:00 2001 From: thchazot1 Date: Tue, 17 Jan 2023 18:08:28 +0100 Subject: [PATCH] ajout du projet --- projet/.gitignore | 133 ++++++++++++++++++++ projet/.idea/.gitignore | 3 + projet/.idea/misc.xml | 6 + projet/.idea/modules.xml | 8 ++ projet/.idea/vcs.xml | 6 + projet/Capteurs.iml | 13 ++ projet/README.md | 85 +++++++++++++ projet/ressources/css/application.css | 75 +++++++++++ projet/ressources/fxml/Capteur.fxml | 15 +++ projet/ressources/fxml/TreeViewCapteur.fxml | 17 +++ projet/src/launcher/Launch.java | 60 +++++++++ projet/src/modele/Capteur.java | 34 +++++ projet/src/modele/CapteurVirtuel.java | 42 +++++++ projet/src/modele/CpuCapteur.java | 19 +++ projet/src/modele/RandomCapteur.java | 18 +++ projet/src/modele/Stub.java | 37 ++++++ projet/src/view/FxmlWindow.java | 19 +++ projet/src/view/Home.java | 15 +++ projet/src/view/TreeViewCapteur.java | 66 ++++++++++ projet/src/view/ViewCapteurVirtuel.java | 65 ++++++++++ projet/src/view/ViewRandom.java | 11 ++ 21 files changed, 747 insertions(+) create mode 100644 projet/.gitignore create mode 100644 projet/.idea/.gitignore create mode 100644 projet/.idea/misc.xml create mode 100644 projet/.idea/modules.xml create mode 100644 projet/.idea/vcs.xml create mode 100644 projet/Capteurs.iml create mode 100644 projet/README.md create mode 100644 projet/ressources/css/application.css create mode 100644 projet/ressources/fxml/Capteur.fxml create mode 100644 projet/ressources/fxml/TreeViewCapteur.fxml create mode 100644 projet/src/launcher/Launch.java create mode 100644 projet/src/modele/Capteur.java create mode 100644 projet/src/modele/CapteurVirtuel.java create mode 100644 projet/src/modele/CpuCapteur.java create mode 100644 projet/src/modele/RandomCapteur.java create mode 100644 projet/src/modele/Stub.java create mode 100644 projet/src/view/FxmlWindow.java create mode 100644 projet/src/view/Home.java create mode 100644 projet/src/view/TreeViewCapteur.java create mode 100644 projet/src/view/ViewCapteurVirtuel.java create mode 100644 projet/src/view/ViewRandom.java diff --git a/projet/.gitignore b/projet/.gitignore new file mode 100644 index 0000000..35e755d --- /dev/null +++ b/projet/.gitignore @@ -0,0 +1,133 @@ +# ---> JetBrains +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +# ---> macOS +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# ---> Java +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + diff --git a/projet/.idea/.gitignore b/projet/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/projet/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/projet/.idea/misc.xml b/projet/.idea/misc.xml new file mode 100644 index 0000000..a346fd7 --- /dev/null +++ b/projet/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/projet/.idea/modules.xml b/projet/.idea/modules.xml new file mode 100644 index 0000000..0395c8f --- /dev/null +++ b/projet/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/projet/.idea/vcs.xml b/projet/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/projet/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/projet/Capteurs.iml b/projet/Capteurs.iml new file mode 100644 index 0000000..1d85562 --- /dev/null +++ b/projet/Capteurs.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/projet/README.md b/projet/README.md new file mode 100644 index 0000000..d5792fa --- /dev/null +++ b/projet/README.md @@ -0,0 +1,85 @@ +# La course de dé (version JavaFX) + +L'objectif de ce TP est d'ajouter une interface graphique au jeu de dé que vous avez codé en C++ en première année. Pour rappel : + +> La « course de dé » se joue en lançant un dé. Les joueurs jouent tour à tour (pour ce TP nous nous limiterons à deux joueurs). Lorsque c'est à son tour, le joueur lance un dé et, tant qu'il ne fait pas 1, accumule les points des lancers successifs. S'il fait 1, il perd les points qu'il avait accumulés pendant son tour de jeu et la main passe, c'est à l'autre joueur de jouer. Un joueur peut sciemment décider d'arrêter de lancer le dé et ainsi sécuriser le score de son tour de jeu. Le premier joueur qui atteint un score de victoire (par exemple 50) gagne. + +Afin de vous concenter sur l'interface graphique, nous vous fournissons la version Java du jeu que vous avez codé en C++. La conception de ce dernier est rappelé ci-dessous. + +```plantuml +@startuml +skinparam defaultFontName Tahoma +skinparam classAttributeIconSize 0 +skinparam monochrome true +skinparam shadowing false +skinparam linetype ortho +skinparam class { + BackgroundColor transparent +} +skinparam package { + BackgroundColor transparent +} +hide circle + +package launcher { + +class ConsoleGame { + +{static} main(args : String[]) +} + +} + +package model { + +class Dice { + -{static}NB_FACES_DEFAULT : int = 6 {frozen} + -nbFaces : int + -value : int + + +Dice(nbFaces : int) + +Dice() + +getValue() : int + +roll() : int + +clear() +} + +class Player { + -{static}num : int = 0 + -name : string + -totalScore : int + -currentScore : int + + +Player(name : string) + +Player() + +getName() : string + +getCurrentScore() : int + +setCurrentScore(score : int) + +getTotalScore() : int + +setTotalScore(score : int) +} + +class Game { + +{static}LOSE_DICE_VALUE : int = 1 {frozen} + +{static}SCORE_TO_WIN : int = 50 {frozen} + -gameOver : boolean + -currentPlayerIndex : int + + +Game() + +addPlayer(player : Player) + +getCurrentPlayer() : Player + +rollDice() + +getDiceValue() : int + +isGameOver() : boolean + +passToNextPlayer() + +restart() +} + +Game --> "-dice" Dice +Game --> "*\n-players" Player +ConsoleGame ..> Game + +} + +@enduml +``` + diff --git a/projet/ressources/css/application.css b/projet/ressources/css/application.css new file mode 100644 index 0000000..1ec7fc1 --- /dev/null +++ b/projet/ressources/css/application.css @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2012, 2014 Oracle and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +root { + display: block; +} + +.root { + -fx-background-image: url("https://www.francetvinfo.fr/pictures/zwzFc6PU5JuzL2NA0BwMqhCrvo0/1200x900/2016/08/23/shrek-5.jpg"); +} + +.label { + -fx-font-size: 12px; + -fx-font-weight: bold; + -fx-text-fill: #333333; + -fx-effect: dropshadow( gaussian , rgba(255,255,255,0.5) , 0,0,0,1 ); +} + +#welcome { + -fx-font-size: 75px; + -fx-font-family: "Arial Black"; + -fx-fill: #818181; + -fx-effect: innershadow( three-pass-box , rgba(0,0,0,0.7) , 6, 0.0 , 0 , 2 ); +} + +#left{ + -fx-text-fill: red; +} + + +.button { + -fx-text-fill: white; + -fx-font-family: "Arial Narrow"; + -fx-font-weight: bold; + -fx-background-color: #B0E0E6; + -fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 ); +} + + +.button:hover { + -fx-background-color: linear-gradient(#2A5058, #61a2b1); +} + +#rectangle{ + -fx-background-image: url("https://i-mom.unimedias.fr/2020/09/16/gingy-shrek.jpg?auto=format,compress&cs=tinysrgb"); +} \ No newline at end of file diff --git a/projet/ressources/fxml/Capteur.fxml b/projet/ressources/fxml/Capteur.fxml new file mode 100644 index 0000000..ca031a8 --- /dev/null +++ b/projet/ressources/fxml/Capteur.fxml @@ -0,0 +1,15 @@ + + + + + + + + + + + +