Skip to content
Snippets Groups Projects
Commit 28fd70fd authored by Azurlors's avatar Azurlors
Browse files

Ajout du plan UML

parent 6f8fe0e2
No related branches found
No related tags found
No related merge requests found
@startuml
interface engine.GameController {
+ Cmd getCommand()
}
class model.PacmanController {
- Cmd commandeEnCours
+ <<Create>> PacmanController()
+ Cmd getCommand()
+ void keyPressed(KeyEvent)
+ void keyReleased(KeyEvent)
+ void keyTyped(KeyEvent)
}
enum engine.Cmd {
+ LEFT
+ RIGHT
+ UP
+ IDLE
}
class engine.GraphicalInterface {
- DrawingPanel panel
+ <<Create>> GraphicalInterface(GamePainter,GameController)
+ void paint()
}
class model.PacmanGame {
+ <<Create>> PacmanGame(String)
+ void evolve(Cmd)
+ boolean isFinished()
}
class engine.DrawingPanel {
- {static} long serialVersionUID
- GamePainter painter
- BufferedImage nextImage
- BufferedImage currentImage
- int width
+ <<Create>> DrawingPanel(GamePainter)
+ void drawGame()
+ void paint(Graphics)
}
class start.Main {
+ {static} void main(String[])
}
class model.PacmanPainter {
# {static} int WIDTH
# {static} int HEIGHT
+ <<Create>> PacmanPainter()
+ void draw(BufferedImage)
+ int getWidth()
+ int getHeight()
}
interface engine.GamePainter {
+ {abstract}void draw(BufferedImage)
+ {abstract}int getWidth()
+ {abstract}int getHeight()
}
interface engine.Game {
+ void evolve(Cmd)
+ boolean isFinished()
}
class engine.GameEngineGraphical {
- Game game
- GamePainter gamePainter
- GameController gameController
- GraphicalInterface gui
+ <<Create>> GameEngineGraphical(Game,GamePainter,GameController)
+ void run()
}
java.awt.event.KeyListener <|-- engine.GameController
engine.GameController <|.. model.PacmanController
engine.Game <|.. model.PacmanGame
javax.swing.JPanel <|-- engine.DrawingPanel
engine.GamePainter <|.. model.PacmanPainter
@enduml
\ No newline at end of file
...@@ -5,5 +5,5 @@ package engine; ...@@ -5,5 +5,5 @@ package engine;
* *
*/ */
public enum Cmd { public enum Cmd {
LEFT,RIGHT,UP,DOWN,IDLE; LEFT,RIGHT,UP,IDLE;
} }
...@@ -44,10 +44,17 @@ public class PacmanController implements GameController { ...@@ -44,10 +44,17 @@ public class PacmanController implements GameController {
switch (e.getKeyChar()) { switch (e.getKeyChar()) {
// si on appuie sur 'q',commande joueur est gauche // si on appuie sur 'q',commande joueur est gauche
case 'l': case 'q':
case 'L': case 'Q':
this.commandeEnCours = Cmd.LEFT; this.commandeEnCours = Cmd.LEFT;
break; break;
case 'd':
case 'D':
this.commandeEnCours = Cmd.RIGHT;
break;
case ' ':
this.commandeEnCours = Cmd.UP;
break;
} }
} }
......
...@@ -42,6 +42,7 @@ public class PacmanGame implements Game { ...@@ -42,6 +42,7 @@ public class PacmanGame implements Game {
@Override @Override
public void evolve(Cmd commande) { public void evolve(Cmd commande) {
System.out.println("Execute "+commande); System.out.println("Execute "+commande);
} }
/** /**
......
...@@ -17,7 +17,7 @@ public class PacmanPainter implements GamePainter { ...@@ -17,7 +17,7 @@ public class PacmanPainter implements GamePainter {
/** /**
* la taille des cases * la taille des cases
*/ */
protected static final int WIDTH = 100; protected static final int WIDTH = 1000;
protected static final int HEIGHT = 100; protected static final int HEIGHT = 100;
/** /**
...@@ -36,7 +36,7 @@ public class PacmanPainter implements GamePainter { ...@@ -36,7 +36,7 @@ public class PacmanPainter implements GamePainter {
public void draw(BufferedImage im) { public void draw(BufferedImage im) {
Graphics2D crayon = (Graphics2D) im.getGraphics(); Graphics2D crayon = (Graphics2D) im.getGraphics();
crayon.setColor(Color.blue); crayon.setColor(Color.blue);
crayon.fillOval(0,0,10,10); crayon.fillOval(20,20,10,10);
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment