Major improvement of windows (in terms of cpu, disk and ram performances), move ClientEventHandler.java to listener package

This commit is contained in:
Quentin Legot 2021-12-07 12:19:31 +01:00
parent 1defc451aa
commit 19dceafb7d
3 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,5 @@
package fr.lnl.game.client.view; package fr.lnl.game.client.listener;
import fr.lnl.game.client.listener.ButtonListener;
import fr.lnl.game.server.listener.ModelListener; import fr.lnl.game.server.listener.ModelListener;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.event.EventHandler; import javafx.event.EventHandler;

View File

@ -10,14 +10,18 @@ import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
/**
* classe qui a pour but de générer chaque case de la grid et de vérifier les entités présentes dessus
/*classe qui a pour but de générer chaque case de la grid et de vérifier les entités présentes dessus * (Mur, Joueur, Energie, Bombe, etc.)
(Mur,Joueur,Energie,bombe,etc..)
*/ */
public class Cell extends Rectangle { public class Cell extends Rectangle {
private static Image PLAYER_IMAGE = new Image("player.png");
private static Image ENERGY_BALL_IMAGE = new Image("energyBall.png");
private static Image BOMB_IMAGE = new Image("bomb.jpg");
private static Image MINE_IMAGE = new Image("mine.webp");
private static Image WALL_IMAGE = new Image("wall.jpg");
public Cell(int x, int y){ public Cell(int x, int y){
setWidth(Window.cellSize); setWidth(Window.cellSize);
setHeight(Window.cellSize); setHeight(Window.cellSize);
@ -30,20 +34,20 @@ public class Cell extends Rectangle {
public static StackPane setImageObject(Object object){ public static StackPane setImageObject(Object object){
StackPane sp = new StackPane(); StackPane sp = new StackPane();
String in; Image in;
if(object instanceof Player){ if(object instanceof Player){
in = "player.png"; in = PLAYER_IMAGE;
} else if(object instanceof EnergyBall){ } else if(object instanceof EnergyBall){
in = "energyBall.png"; in = ENERGY_BALL_IMAGE;
} else if(object instanceof Bomb){ } else if(object instanceof Bomb){
in = "bomb.jpg"; in = BOMB_IMAGE;
} else if(object instanceof Mine){ } else if(object instanceof Mine){
in = "mine.webp"; in = MINE_IMAGE;
} else{ } else{
in = "wall.jpg"; in = WALL_IMAGE;
} }
ImageView iv = new ImageView(new Image(in)); ImageView iv = new ImageView(in);
iv.setFitHeight(40); iv.setFitHeight(40);
iv.setFitWidth(40); iv.setFitWidth(40);
sp.getChildren().add(iv); sp.getChildren().add(iv);

View File

@ -1,6 +1,7 @@
package fr.lnl.game.client.view; package fr.lnl.game.client.view;
import fr.lnl.game.client.listener.ButtonListener; import fr.lnl.game.client.listener.ButtonListener;
import fr.lnl.game.client.listener.ClientEventHandler;
import fr.lnl.game.server.games.Game; import fr.lnl.game.server.games.Game;
import fr.lnl.game.server.games.grid.Grid; import fr.lnl.game.server.games.grid.Grid;
import fr.lnl.game.server.games.grid.elements.*; import fr.lnl.game.server.games.grid.elements.*;