This commit is contained in:
Monin 2022-05-11 20:31:30 +02:00
parent 13940c0fb4
commit c059255e54
9 changed files with 545 additions and 71 deletions

1
.vscode/configurationCache.log vendored Normal file
View File

@ -0,0 +1 @@
{"buildTargets":["Case.class","but","clean","main_ex.class","observateurButtonEtText.class","observateurCase.class","observateurChoix.class","observateurFenetre.class","observateurSAV.class","paintChoix.class","paintMenuJeu.class","plateau.class","plusoumoins.class","run"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}}

17
.vscode/dryrun.log vendored Normal file
View File

@ -0,0 +1,17 @@
make --dry-run --always-make --keep-going --print-directory
make: Entering directory `/Users/tommonin/Documents/SAE21_2021'
javac -implicit:none Case.java
javac -implicit:none plateau.java
javac -implicit:none observateurCase.java
javac -implicit:none paintMenuJeu.java
javac -implicit:none observateurSAV.java
javac -implicit:none observateurFenetre.java
javac -implicit:none paintChoix.java
javac -implicit:none observateurChoix.java
javac -implicit:none plusoumoins.java
javac -implicit:none observateurButtonEtText.java
javac -implicit:none main_ex.java
make: Leaving directory `/Users/tommonin/Documents/SAE21_2021'

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"makefile.extensionOutputFolder": "./.vscode"
}

410
.vscode/targets.log vendored Normal file
View File

@ -0,0 +1,410 @@
make all --print-data-base --no-builtin-variables --no-builtin-rules --question
# GNU Make 3.81
# Copyright (C) 2006 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions.
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# This program built for i386-apple-darwin11.3.0
# Make data base, printed on Wed May 11 20:30:49 2022
# Variables
# automatic
<D = $(patsubst %/,%,$(dir $<))
# automatic
?F = $(notdir $?)
# environment
VSCODE_LOG_NATIVE = false
# automatic
?D = $(patsubst %/,%,$(dir $?))
# automatic
@D = $(patsubst %/,%,$(dir $@))
# automatic
@F = $(notdir $@)
# makefile
CURDIR := /Users/tommonin/Documents/SAE21_2021
# makefile
SHELL = /bin/sh
# environment
VSCODE_NLS_CONFIG = {"locale":"fr","availableLanguages":{"*":"fr"},"_languagePackId":"25fe6a3290ec415596628d4afc87a88c.fr","_translationsConfigFile":"/Users/tommonin/Library/Application Support/Code/clp/25fe6a3290ec415596628d4afc87a88c.fr/tcf.json","_cacheRoot":"/Users/tommonin/Library/Application Support/Code/clp/25fe6a3290ec415596628d4afc87a88c.fr","_resolvedLanguagePackCoreLocation":"/Users/tommonin/Library/Application Support/Code/clp/25fe6a3290ec415596628d4afc87a88c.fr/da15b6fd3ef856477bf6f4fb29ba1b7af717770d","_corruptedFile":"/Users/tommonin/Library/Application Support/Code/clp/25fe6a3290ec415596628d4afc87a88c.fr/corrupted.info","_languagePackSupport":true}
# environment
_ = /usr/bin/make
# makefile (from `Makefile', line 19)
CFLAGS = -implicit:none
# makefile (from `Makefile', line 1)
MAKEFILE_LIST := Makefile
# environment
VSCODE_VERBOSE_LOGGING = true
# environment
__CFBundleIdentifier = com.microsoft.VSCode
# environment
INFOPATH = /opt/homebrew/share/info:
# environment
VSCODE_IPC_HOOK_EXTHOST = /var/folders/z7/5ldy4cvx299dqsp97x3f2vj80000gn/T/vscode-ipc-30381884-6d2b-41f6-b5b5-a06e4be98907.sock
# environment
VSCODE_CWD = /
# environment
PATH = /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
# environment
LSCOLORS = Gxfxcxdxbxegedabagacad
# environment
VSCODE_LOG_STACK = false
# environment
ELECTRON_RUN_AS_NODE = 1
# default
.FEATURES := target-specific order-only second-expansion else-if archives jobserver check-symlink
# environment
SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.Dc3E9i80R2/Listeners
# automatic
%F = $(notdir $%)
# environment
VSCODE_PIPE_LOGGING = true
# environment
PWD = /Users/tommonin/Documents/SAE21_2021
# environment
HOMEBREW_CELLAR = /opt/homebrew/Cellar
# environment
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
# environment
MANPATH = /opt/homebrew/share/man::
# environment
VSCODE_AMD_ENTRYPOINT = vs/workbench/api/node/extensionHostProcess
# environment
HOME = /Users/tommonin
# default
MAKEFILEPATH = $(shell /usr/bin/xcode-select -print-path 2>/dev/null || echo /Developer)/Makefiles
# environment
VSCODE_CODE_CACHE_PATH = /Users/tommonin/Library/Application Support/Code/CachedData/da15b6fd3ef856477bf6f4fb29ba1b7af717770d
# environment
LOGNAME = tommonin
# environment
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1
# environment
ZSH = /Users/tommonin/.oh-my-zsh
# environment
VSCODE_HANDLES_UNCAUGHT_ERRORS = true
# automatic
^D = $(patsubst %/,%,$(dir $^))
# environment
XPC_FLAGS = 0x0
# default
MAKE = $(MAKE_COMMAND)
# default
MAKECMDGOALS := all
# environment
SHLVL = 1
# default
MAKE_VERSION := 3.81
# environment
USER = tommonin
# makefile
.DEFAULT_GOAL := but
# environment
LESS = -R
# automatic
%D = $(patsubst %/,%,$(dir $%))
# default
MAKE_COMMAND := /Library/Developer/CommandLineTools/usr/bin/make
# default
.VARIABLES :=
# environment
TMPDIR = /var/folders/z7/5ldy4cvx299dqsp97x3f2vj80000gn/T/
# automatic
*F = $(notdir $*)
# environment
VSCODE_IPC_HOOK = /Users/tommonin/Library/Application Support/Code/1.67.1-main.sock
# makefile
MAKEFLAGS = Rrqp
# environment
MFLAGS = -Rrqp
# automatic
*D = $(patsubst %/,%,$(dir $*))
# environment
XPC_SERVICE_NAME = application.com.microsoft.VSCode.23049971.23049977
# environment
HOMEBREW_PREFIX = /opt/homebrew
# automatic
+D = $(patsubst %/,%,$(dir $+))
# automatic
+F = $(notdir $+)
# environment
HOMEBREW_REPOSITORY = /opt/homebrew
# environment
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x1
# environment
COMMAND_MODE = unix2003
# default
MAKEFILES :=
# automatic
<F = $(notdir $<)
# environment
PAGER = less
# environment
LC_ALL = C
# automatic
^F = $(notdir $^)
# default
SUFFIXES :=
# default
.INCLUDE_DIRS = /usr/local/include
# makefile (from `Makefile', line 8)
OFILES = Case.class plateau.class observateurCase.class paintMenuJeu.class observateurSAV.class observateurFenetre.class paintChoix.class observateurChoix.class plusoumoins.class observateurButtonEtText.class
# environment
MAKELEVEL := 0
# environment
LANG = C
# environment
VSCODE_PID = 18516
# variable set hash-table stats:
# Load=73/1024=7%, Rehash=0, Collisions=1/98=1%
# Pattern-specific Variable Values
# No pattern-specific variable values.
# Directories
# . (device 16777231, inode 22333054): 37 files, no impossibilities.
# 37 files, no impossibilities in 1 directories.
# Implicit Rules
# No implicit rules.
# Files
but: main_ex.class
# Phony target (prerequisite of .PHONY).
# Implicit rule search has not been done.
# File does not exist.
# File has not been updated.
# Not a target:
observateurSAV.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
observateurCase.class: observateurCase.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 29):
javac $(CFLAGS) observateurCase.java
observateurChoix.class: observateurChoix.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 49):
javac $(CFLAGS) observateurChoix.java
# Not a target:
Case.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
paintMenuJeu.class: paintMenuJeu.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 32):
javac $(CFLAGS) paintMenuJeu.java
# Not a target:
all:
# Command-line target.
# Implicit rule search has been done.
# File does not exist.
# File has not been updated.
# variable set hash-table stats:
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%
# Not a target:
observateurButtonEtText.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
.PHONY: but clean but run
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# Not a target:
plateau.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
paintChoix.class: paintChoix.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 46):
javac $(CFLAGS) paintChoix.java
# Not a target:
observateurFenetre.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# Not a target:
.SUFFIXES:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# Not a target:
observateurCase.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
main_ex.class: Case.class plateau.class observateurCase.class paintMenuJeu.class observateurSAV.class observateurFenetre.class paintChoix.class observateurChoix.class plusoumoins.class observateurButtonEtText.class main_ex.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 43):
javac $(CFLAGS) main_ex.java
# Not a target:
Makefile:
# Implicit rule search has been done.
# Last modified 2022-05-11 11:16:40
# File has been updated.
# Successfully updated.
# variable set hash-table stats:
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%
# Not a target:
observateurChoix.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# Not a target:
paintMenuJeu.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# Not a target:
paintChoix.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
plusoumoins.class: plusoumoins.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 52):
javac $(CFLAGS) plusoumoins.java
# Not a target:
main_ex.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# Not a target:
.DEFAULT:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
run:
# Phony target (prerequisite of .PHONY).
# Implicit rule search has not been done.
# File does not exist.
# File has not been updated.
# commands to execute (from `Makefile', line 63):
java main_ex
clean:
# Phony target (prerequisite of .PHONY).
# Implicit rule search has not been done.
# File does not exist.
# File has not been updated.
# commands to execute (from `Makefile', line 60):
-rm -f $(OFILES) main_ex.class
# Not a target:
plusoumoins.java:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
observateurSAV.class: observateurSAV.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 35):
javac $(CFLAGS) observateurSAV.java
Case.class: Case.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 23):
javac $(CFLAGS) Case.java
observateurButtonEtText.class: observateurButtonEtText.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 55):
javac $(CFLAGS) observateurButtonEtText.java
plateau.class: plateau.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 26):
javac $(CFLAGS) plateau.java
observateurFenetre.class: observateurFenetre.java
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `Makefile', line 38):
javac $(CFLAGS) observateurFenetre.java
# files hash-table stats:
# Load=30/1024=3%, Rehash=0, Collisions=1/69=1%
# VPATH Search Paths
# No `vpath' search paths.
# No general (`VPATH' variable) search path.
# # of strings in strcache: 1
# # of strcache buffers: 1
# strcache size: total = 4096 / max = 4096 / min = 4096 / avg = 4096
# strcache free: total = 4087 / max = 4087 / min = 4087 / avg = 4087
# Finished Make data base on Wed May 11 20:30:49 2022
make: *** No rule to make target `all'. Stop.

View File

@ -57,7 +57,7 @@ observateurButtonEtText.class: observateurButtonEtText.java
#Chapitre 5: nettoyage des fichiers generes #Chapitre 5: nettoyage des fichiers generes
clean : clean :
-rm -f $(OFILES) -rm -f $(OFILES) main_ex.class
run : run :
java main_ex java main_ex

View File

@ -42,8 +42,36 @@ public class observateurButtonEtText implements ActionListener {
} }
} }
if(this.fonction==2){ if(this.fonction==2){
if(this.plat.getLigne()!=-1 && this.plat.getCollonne()!=-1 && this.plat.getBombe()!=-1){ int nombre=0;
this.plat.newGame(); try{
this.zone.setBackground(new Color(255,255,255));
nombre=Integer.parseInt(this.zone.getText());
if(nombre<0){
nombre=0;
}
if(this.plat.getLigne()!=-1 && this.plat.getCollonne()!=-1){
if(nombre>this.plat.getLigne()*this.plat.getCollonne()){
nombre=this.plat.getLigne()*this.plat.getCollonne();
}
this.plat.setBombe(nombre);
if(this.plat.getLigne()!=-1 && this.plat.getCollonne()!=-1 && this.plat.getBombe()!=-1){
this.plat.newGame();
}else{
if(this.plat.getBombe()==-1){
this.zone.setBackground(Color.red);
this.zone.setText("Rentrer un nombre de Bobme");
}
}
}else{
this.zone.setBackground(Color.red);
this.zone.setText("Selectionner Ligne et Collonne Avant");
this.plat.setBombe(-1);
}
this.plat.setBombe(nombre);
}catch(NumberFormatException e1){
this.zone.setBackground(Color.red);
this.zone.setText("rentrer un nombre valide");
this.plat.setBombe(-1);
} }
} }
if(this.fonction==3){ if(this.fonction==3){

View File

@ -5,27 +5,11 @@ import javax.swing.JComponent;
public class paintMenuJeu extends JComponent{ public class paintMenuJeu extends JComponent{
private int choix; private int choix;
private int scoreMax, score; private int scoreMax, score;
private Image un, deux, trois, quatre, cinq, six, sept, huit, neuf, zero, err, sav, lose, win, replay;
private boolean survol; private boolean survol;
public paintMenuJeu(int choix0, int score0, int scoreMax0){ public paintMenuJeu(int choix0, int score0, int scoreMax0){
this.choix=choix0; this.choix=choix0;
this.score=score0; this.score=score0;
this.scoreMax=scoreMax0; this.scoreMax=scoreMax0;
this.un=Toolkit.getDefaultToolkit().getImage("./IMAGE/unD.png");
this.deux=Toolkit.getDefaultToolkit().getImage("./IMAGE/deuxD.png");
this.trois=Toolkit.getDefaultToolkit().getImage("./IMAGE/troisD.png");
this.quatre=Toolkit.getDefaultToolkit().getImage("./IMAGE/quatreD.png");
this.cinq=Toolkit.getDefaultToolkit().getImage("./IMAGE/cinqD.png");
this.six=Toolkit.getDefaultToolkit().getImage("./IMAGE/sixD.png");
this.sept=Toolkit.getDefaultToolkit().getImage("./IMAGE/septD.png");
this.huit=Toolkit.getDefaultToolkit().getImage("./IMAGE/huitD.png");
this.neuf=Toolkit.getDefaultToolkit().getImage("./IMAGE/neufD.png");
this.zero=Toolkit.getDefaultToolkit().getImage("./IMAGE/zeroD.png");
this.err=Toolkit.getDefaultToolkit().getImage("./IMAGE/err.png");
this.sav=Toolkit.getDefaultToolkit().getImage("./IMAGE/sav.png");
this.lose=Toolkit.getDefaultToolkit().getImage("./IMAGE/lose.png");
this.win=Toolkit.getDefaultToolkit().getImage("./IMAGE/win.png");
this.replay=Toolkit.getDefaultToolkit().getImage("./IMAGE/replay.png");
this.survol=false; this.survol=false;
} }
public void setChoix(int choix0){ public void setChoix(int choix0){
@ -86,56 +70,71 @@ public class paintMenuJeu extends JComponent{
secondPinceau.setColor(new Color(0,255,0)); secondPinceau.setColor(new Color(0,255,0));
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
} }
secondPinceau.drawImage(this.sav, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image sav=Toolkit.getDefaultToolkit().getImage("./IMAGE/sav.png");
secondPinceau.drawImage(sav, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(this.choix==5){ if(this.choix==5){
secondPinceau.drawImage(this.lose, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image lose=Toolkit.getDefaultToolkit().getImage("./IMAGE/lose.png");
secondPinceau.drawImage(lose, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(this.choix==6){ if(this.choix==6){
secondPinceau.drawImage(this.win, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image win=Toolkit.getDefaultToolkit().getImage("./IMAGE/win.png");
secondPinceau.drawImage(win, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(this.choix==7){ if(this.choix==7){
if(this.survol==true){ if(this.survol==true){
secondPinceau.setColor(new Color(0,255,0)); secondPinceau.setColor(new Color(0,255,0));
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
} }
secondPinceau.drawImage(this.replay, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image replay=Toolkit.getDefaultToolkit().getImage("./IMAGE/replay.png");
secondPinceau.drawImage(replay, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
} }
private void paintNombre(Graphics secondPinceau, int nombre){ private void paintNombre(Graphics secondPinceau, int nombre){
if(this.score>=0){ if(this.score>=0){
if(nombre==1){ if(nombre==1){
secondPinceau.drawImage(this.un, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image un=Toolkit.getDefaultToolkit().getImage("./IMAGE/unD.png");
secondPinceau.drawImage(un, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==2){ if(nombre==2){
secondPinceau.drawImage(this.deux, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image deux=Toolkit.getDefaultToolkit().getImage("./IMAGE/deuxD.png");
secondPinceau.drawImage(deux, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==3){ if(nombre==3){
secondPinceau.drawImage(this.trois, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image trois=Toolkit.getDefaultToolkit().getImage("./IMAGE/troisD.png");
secondPinceau.drawImage(trois, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==4){ if(nombre==4){
secondPinceau.drawImage(this.quatre, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image quatre=Toolkit.getDefaultToolkit().getImage("./IMAGE/quatreD.png");
secondPinceau.drawImage(quatre, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==5){ if(nombre==5){
secondPinceau.drawImage(this.cinq, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image cinq=Toolkit.getDefaultToolkit().getImage("./IMAGE/cinqD.png");
secondPinceau.drawImage(cinq, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==6){ if(nombre==6){
secondPinceau.drawImage(this.six, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image six=Toolkit.getDefaultToolkit().getImage("./IMAGE/sixD.png");
secondPinceau.drawImage(six, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==7){ if(nombre==7){
secondPinceau.drawImage(this.sept, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image sept=Toolkit.getDefaultToolkit().getImage("./IMAGE/septD.png");
secondPinceau.drawImage(sept, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==8){ if(nombre==8){
secondPinceau.drawImage(this.huit, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image huit=Toolkit.getDefaultToolkit().getImage("./IMAGE/huitD.png");
secondPinceau.drawImage(huit, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==9){ if(nombre==9){
secondPinceau.drawImage(this.neuf, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image neuf=Toolkit.getDefaultToolkit().getImage("./IMAGE/neufD.png");
secondPinceau.drawImage(neuf, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
if(nombre==0){ if(nombre==0){
secondPinceau.drawImage(this.zero, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image zero=Toolkit.getDefaultToolkit().getImage("./IMAGE/zeroD.png");
secondPinceau.drawImage(zero, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
}else{ }else{
secondPinceau.drawImage(this.err, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/6*4, this.getHeight()/6*4 ,this); Image err=Toolkit.getDefaultToolkit().getImage("./IMAGE/err.png");
secondPinceau.drawImage(err, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/6*4, this.getHeight()/6*4 ,this);
} }
} }

View File

@ -20,8 +20,9 @@ public class plateau{
this.fenetre=fenetre0; this.fenetre=fenetre0;
this.ligne=-1; this.ligne=-1;
this.collonne=-1; this.collonne=-1;
this.bombe=0; this.bombe=-1;
} }
//-------------------> Debut Seter et Getteur <-------------------------
public void setLogo(paintMenuJeu logo0){ public void setLogo(paintMenuJeu logo0){
this.logo=logo0; this.logo=logo0;
} }
@ -49,6 +50,8 @@ public class plateau{
public void setBombe(int n){ public void setBombe(int n){
this.bombe=n; this.bombe=n;
} }
//-------------------------> fin Setter et Getteur <-----------------------------
//-------------------------Fonction plaçant les bombes aléatoirement------------------------ //-------------------------Fonction plaçant les bombes aléatoirement------------------------
private void setAllBombe(){ private void setAllBombe(){
@ -227,7 +230,7 @@ public class plateau{
for(int i=0; i<ligne; i++){ for(int i=0; i<ligne; i++){
for(int t=0; t<collonne; t++){ for(int t=0; t<collonne; t++){
this.tableau[i][t]= new Case(); this.tableau[i][t]= new Case();
this.tableau[i][t].setPreferredSize(new Dimension(100,100)); this.tableau[i][t].setPreferredSize(new Dimension(50,50));
//nous ajoutons aussi a chaque case son observateur de case //nous ajoutons aussi a chaque case son observateur de case
} }
} }
@ -241,31 +244,40 @@ public class plateau{
//------------------------------------> Fonction pour sauvegarder la partie <------------------------- //------------------------------------> Fonction pour sauvegarder la partie <-------------------------
/*
Mettre les bloc try catch au bon endroit
*/
public void save(){ public void save(){
//les fonctions vont lever des Exeption nous devons donc mettre un try Catch //les fonctions vont lever des Exeption nous devons donc mettre un try Catch
try{ try{
//nous initialison le outputStream en créant le fichier "sauvegarde.data" //nous initialison le outputStream en créant le fichier "sauvegarde.data"
FileOutputStream sav = new FileOutputStream(new File("sauvegarde.data")); FileOutputStream sav = new FileOutputStream(new File("sauvegarde.data"));
//nous allons sérialiser le tableau de Case try{
ObjectOutputStream oos = new ObjectOutputStream(sav); //nous allons sérialiser le tableau de Case
//nous écrivons donc tout d'abord la taille de celui-ci ObjectOutputStream oos = new ObjectOutputStream(sav);
oos.writeInt(this.ligne); //nous écrivons donc tout d'abord la taille de celui-ci
oos.writeInt(this.collonne); oos.writeInt(this.ligne);
//puis nous parcourons le tableau en sérialisant toute les Case oos.writeInt(this.collonne);
for(int i=0; i<this.ligne; i++){ //puis nous parcourons le tableau en sérialisant toute les Case
for(int t=0; t<this.collonne; t++){ for(int i=0; i<this.ligne; i++){
oos.writeObject(this.tableau[i][t]); for(int t=0; t<this.collonne; t++){
oos.writeObject(this.tableau[i][t]);
}
} }
} //nous écrivons ensuite le score Maximum(nombre de bombe) pour éviter de regarder toutes les Case plus tard
//nous écrivons ensuite le score Maximum(nombre de bombe) pour éviter de regarder toutes les Case plus tard oos.writeInt(this.tabScore[0].getScoreMax());
oos.writeInt(this.tabScore[0].getScoreMax()); //puis le score a l'instant T
//puis le score a l'instant T oos.writeInt(this.tabScore[0].getScore());
oos.writeInt(this.tabScore[0].getScore()); //nous fermons la sauvegardes
//nous fermons la sauvegardes
oos.close(); oos.close();
sav.close(); }catch(IOException e){
}
}catch(FileNotFoundException e1){ }catch(FileNotFoundException e1){
}catch(IOException e2){
} }
//nous fermons la fenetre et donc arrêtons l'applications //nous fermons la fenetre et donc arrêtons l'applications
this.fenetre.dispose(); this.fenetre.dispose();
@ -276,24 +288,28 @@ public class plateau{
int score=0; int score=0;
//les fonctions vont lever des Exeption nous devons donc mettre un try Catch //les fonctions vont lever des Exeption nous devons donc mettre un try Catch
try{ try{
//création de l'objet pour lire le fichier donner
ObjectInputStream ois = new ObjectInputStream(file);
//initialisation des collonnes avec le fichier //initialisation des collonnes avec le fichier
this.ligne=ois.readInt(); try{
this.collonne=ois.readInt(); //création de l'objet pour lire le fichier donner
//on crée le tableau de Case avec les bonnes dimention ObjectInputStream ois = new ObjectInputStream(file);
this.tableau=new Case[this.ligne][this.collonne]; this.ligne=ois.readInt();
//on parcoure celui-ci et remettons les Case avec la sauvegarde this.collonne=ois.readInt();
for(int i=0; i<ligne; i++){ //on crée le tableau de Case avec les bonnes dimention
for(int t=0; t<collonne; t++){ this.tableau=new Case[this.ligne][this.collonne];
this.tableau[i][t]=(Case) ois.readObject(); //on parcoure celui-ci et remettons les Case avec la sauvegarde
for(int i=0; i<ligne; i++){
for(int t=0; t<collonne; t++){
this.tableau[i][t]=(Case) ois.readObject();
}
} }
//nous initialison maintenant le nombre de bombe
this.bombe=ois.readInt();
//puis le score
score=ois.readInt();
ois.close();
}catch(IOException e2){
} }
//nous initialison maintenant le nombre de bombe
this.bombe=ois.readInt();
//puis le score
score=ois.readInt();
}catch(IOException e2){
}catch(ClassNotFoundException e3){ }catch(ClassNotFoundException e3){
} }
//nous pouvons maintenant lancer la partie sauvegarder //nous pouvons maintenant lancer la partie sauvegarder
@ -319,9 +335,9 @@ public class plateau{
panMenu.setBackground(new Color(0,0,0)); panMenu.setBackground(new Color(0,0,0));
//on met un gestionaires de mise en page grille avec le nombre de ligne+1 (pour le menu en haut) et le nombre de collonne //on met un gestionaires de mise en page grille avec le nombre de ligne+1 (pour le menu en haut) et le nombre de collonne
panJeu.setLayout(new GridLayout(this.ligne,this.collonne)); panJeu.setLayout(new GridLayout(this.ligne,this.collonne));
panMenu.setLayout(new GridLayout(1, 7)); panMenu.setLayout(new GridLayout(1, 15));
//on met en place le menu du haut et donc toute la première ligne //on met en place le menu du haut et donc toute la première ligne
for(int i=0; i<10; i++){ for(int i=0; i<15; i++){
paintMenuJeu menu= new paintMenuJeu(0, score, bombe); paintMenuJeu menu= new paintMenuJeu(0, score, bombe);
//nous mettons des dimensions convenable pour des Case //nous mettons des dimensions convenable pour des Case
menu.setPreferredSize(new Dimension(50,50)); menu.setPreferredSize(new Dimension(50,50));
@ -339,7 +355,7 @@ public class plateau{
menu.setChoix(3); menu.setChoix(3);
} }
//et la derniere au logo //et la derniere au logo
if(i==9){ if(i==14){
menu.setChoix(4); menu.setChoix(4);
this.setLogo(menu); this.setLogo(menu);
observateurSAV observateur=new observateurSAV(menu, this); observateurSAV observateur=new observateurSAV(menu, this);

Binary file not shown.