vue
Class Fenetre

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by javax.microedition.lcdui.game.GameCanvas
              extended by vue.Fenetre
All Implemented Interfaces:
java.lang.Runnable, javax.microedition.lcdui.CommandListener

public class Fenetre
extends javax.microedition.lcdui.game.GameCanvas
implements javax.microedition.lcdui.CommandListener, java.lang.Runnable

Gère le plateau niveau graphique : Les pions visibles sont représentés par des images représentant un numéro avec un fond transparents. Les pions nont visibles seront représentés par la couleur correspondant au joueur


Field Summary
private  javax.microedition.lcdui.Image background
           
private  javax.microedition.lcdui.Command commandeJouer
           
private  javax.microedition.lcdui.Command commandeMenu
           
protected  int[][] coordonnesXCases
           
protected  int[][] coordonnesYCases
           
private  int coordXCurseur
           
private  int coordYCurseur
           
private  javax.microedition.lcdui.Image curseurPNG
           
private  javax.microedition.lcdui.Display display
           
private  int margeGauche
           
private  int margeHaute
           
private  MenuInGame menuInGame
           
private  Plateau modelePlateau
           
private  java.lang.Thread runner
           
private  Stratego stratego
           
private  int tailleCase
           
private  int tempsAttente
           
private  boolean threadEnVie
           
private  java.lang.Thread threadSource
           
 
Fields inherited from class javax.microedition.lcdui.game.GameCanvas
DOWN_PRESSED, FIRE_PRESSED, GAME_A_PRESSED, GAME_B_PRESSED, GAME_C_PRESSED, GAME_D_PRESSED, LEFT_PRESSED, RIGHT_PRESSED, UP_PRESSED
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
Fenetre(javax.microedition.lcdui.Display display, Stratego stratego, java.lang.Thread thread)
          Constructeur
 
Method Summary
private  void afficherLesPions(javax.microedition.lcdui.Graphics g)
          Affiche les pions des joueurs sur le plateau
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable arg1)
          Gère la pression des commande prédéfinies
private  java.lang.String convertGrade(int gradeInt)
          Convertit le grade de sa forme entière en chaine
private  void dessinerGrilleDepart(javax.microedition.lcdui.Graphics g)
          Dessine la grille en fonction du placement des pions
private  void envoyerPlateau()
          Envoie le plateau par bluetooth
 Plateau getPlateau()
           
 Stratego getStratego()
           
 boolean isThreadEnVie()
           
private  void mettreAjourEcran(javax.microedition.lcdui.Graphics g)
          Met l'écran à jour à partir du modèle
private  void mouvementCurseur()
          Gère le mouvement du curseur
private  void placerPion(Case uneCase, Pion unPion)
          Place un pion sur une case
 void revelerPion(Case uneCase)
          Révèle le pion sur la case passée en paramètre.
 void run()
          Exécute le thread.
 void setPlateau(Plateau plateau)
           
 void setThreadEnVie(boolean threadEnVie)
           
 void start(java.lang.Thread thread)
          Démarre l'application à son état initial
 
Methods inherited from class javax.microedition.lcdui.game.GameCanvas
flushGraphics, flushGraphics, getGraphics, getKeyStates, paint
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setCommandListener, setFullScreenMode, showNotify, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tailleCase

private int tailleCase

margeGauche

private int margeGauche

margeHaute

private int margeHaute

coordonnesXCases

protected int[][] coordonnesXCases

coordonnesYCases

protected int[][] coordonnesYCases

coordXCurseur

private int coordXCurseur

coordYCurseur

private int coordYCurseur

tempsAttente

private int tempsAttente

modelePlateau

private Plateau modelePlateau

commandeMenu

private javax.microedition.lcdui.Command commandeMenu

commandeJouer

private javax.microedition.lcdui.Command commandeJouer

stratego

private Stratego stratego

display

private javax.microedition.lcdui.Display display

runner

private java.lang.Thread runner

threadSource

private java.lang.Thread threadSource

background

private javax.microedition.lcdui.Image background

curseurPNG

private javax.microedition.lcdui.Image curseurPNG

menuInGame

private MenuInGame menuInGame

threadEnVie

private boolean threadEnVie
Constructor Detail

Fenetre

public Fenetre(javax.microedition.lcdui.Display display,
               Stratego stratego,
               java.lang.Thread thread)
Constructeur

Parameters:
display - instance de Display pour afficher une fenetre
stratego - instance du Stratego
thread - thread
Method Detail

start

public void start(java.lang.Thread thread)
Démarre l'application à son état initial


run

public void run()
Exécute le thread.

Specified by:
run in interface java.lang.Runnable

mouvementCurseur

private void mouvementCurseur()
Gère le mouvement du curseur


placerPion

private void placerPion(Case uneCase,
                        Pion unPion)
Place un pion sur une case


revelerPion

public void revelerPion(Case uneCase)
Révèle le pion sur la case passée en paramètre. Cette méthode est appelée lors d'un combat.

Parameters:
uneCase - case dont on veut voir le pion

mettreAjourEcran

private void mettreAjourEcran(javax.microedition.lcdui.Graphics g)
Met l'écran à jour à partir du modèle


dessinerGrilleDepart

private void dessinerGrilleDepart(javax.microedition.lcdui.Graphics g)
Dessine la grille en fonction du placement des pions


afficherLesPions

private void afficherLesPions(javax.microedition.lcdui.Graphics g)
Affiche les pions des joueurs sur le plateau


commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable arg1)
Gère la pression des commande prédéfinies

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener

envoyerPlateau

private void envoyerPlateau()
Envoie le plateau par bluetooth


convertGrade

private java.lang.String convertGrade(int gradeInt)
Convertit le grade de sa forme entière en chaine


getStratego

public Stratego getStratego()

getPlateau

public Plateau getPlateau()

setPlateau

public void setPlateau(Plateau plateau)

isThreadEnVie

public boolean isThreadEnVie()

setThreadEnVie

public void setThreadEnVie(boolean threadEnVie)