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

Changement menu départ

parent 51ba0e03
Branches
No related tags found
No related merge requests found
...@@ -49,8 +49,8 @@ public class DrawingPanel extends JPanel { ...@@ -49,8 +49,8 @@ public class DrawingPanel extends JPanel {
*/ */
public DrawingPanel(GamePainter painter) { public DrawingPanel(GamePainter painter) {
super(); super();
this.width = painter.getWidth(); this.width = jeu.Painter.getWidth();
this.height = painter.getHeight(); this.height = jeu.Painter.getHeight();
this.setPreferredSize(new Dimension(this.width, this.height)); this.setPreferredSize(new Dimension(this.width, this.height));
this.painter=painter; this.painter=painter;
......
...@@ -71,7 +71,7 @@ public class GameEngineGraphical { ...@@ -71,7 +71,7 @@ public class GameEngineGraphical {
this.gui.paint(); this.gui.paint();
} }
// met en attente // met en attente
Thread.sleep(2); Thread.sleep(1);
} }
} }
......
...@@ -19,8 +19,4 @@ public interface GamePainter { ...@@ -19,8 +19,4 @@ public interface GamePainter {
*/ */
public abstract void draw(BufferedImage image); public abstract void draw(BufferedImage image);
public abstract int getWidth();
public abstract int getHeight();
} }
package engine; package engine;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
public class MenuPanel { public class MenuPanel {
...@@ -14,11 +15,14 @@ public class MenuPanel { ...@@ -14,11 +15,14 @@ public class MenuPanel {
public MenuPanel(){ public MenuPanel(){
JFrame f=new JFrame(); JFrame f=new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLayout(new BorderLayout());
f.setPreferredSize(new Dimension(jeu.Painter.getWidth(), jeu.Painter.getHeight()));
this.button = new JButton("Nouvelle partie"); this.button = new JButton("Nouvelle partie");
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.add(button); panel.add(button,BorderLayout.CENTER);
f.getContentPane().add(panel); f.getContentPane().add(panel);
f.pack(); f.pack();
f.setVisible(true); f.setVisible(true);
f.getContentPane().setFocusable(true); f.getContentPane().setFocusable(true);
......
...@@ -37,7 +37,7 @@ public class ShootingCharacter extends Character{ ...@@ -37,7 +37,7 @@ public class ShootingCharacter extends Character{
} }
kunaiReloading = (kunaiReloading+1)%300; kunaiReloading = (kunaiReloading+1)%300;
if (stockKunai == stockMaxKunai) { //pour apprecier la duree de rechargement totale if (stockKunai == stockMaxKunai) { //pour apprecier la duree de rechargement totale
System.out.println("yo"); //System.out.println("yo");
} }
} }
} }
...@@ -148,7 +148,6 @@ public class Painter implements GamePainter{ ...@@ -148,7 +148,6 @@ public class Painter implements GamePainter{
} }
private void drawMap(Graphics2D crayon){ private void drawMap(Graphics2D crayon){
//System.out.println("Nombre obstacle :"+Jeu.getObstacleTable().size());
for (Obstacle obs : Jeu.getObstacleTable()){ for (Obstacle obs : Jeu.getObstacleTable()){
if (!collision(gameCharacter.getHitBox(), obs.getHitbox())){ if (!collision(gameCharacter.getHitBox(), obs.getHitbox())){
crayon.setColor(Color.blue); crayon.setColor(Color.blue);
...@@ -228,13 +227,11 @@ public class Painter implements GamePainter{ ...@@ -228,13 +227,11 @@ public class Painter implements GamePainter{
zCam = -HEIGHT/2 +(int) coordonneesCam.getZ()-decalage; zCam = -HEIGHT/2 +(int) coordonneesCam.getZ()-decalage;
} }
@Override public static int getWidth() {
public int getWidth() {
return WIDTH; return WIDTH;
} }
@Override public static int getHeight() {
public int getHeight() {
return HEIGHT; return HEIGHT;
} }
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment