Ajout de la classe Cell et GUI, début d'implémentation de certaines de leurs méthodes.
This commit is contained in:
parent
a7775f9c2a
commit
a2270d5de0
64
client/src/main/java/fr/lnl/game/client/view/Cell.java
Normal file
64
client/src/main/java/fr/lnl/game/client/view/Cell.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package fr.lnl.game.client.view;
|
||||||
|
|
||||||
|
import fr.lnl.game.server.games.grid.Bomb;
|
||||||
|
import fr.lnl.game.server.games.grid.EnergyBall;
|
||||||
|
import fr.lnl.game.server.games.grid.Mine;
|
||||||
|
import fr.lnl.game.server.games.grid.Wall;
|
||||||
|
import fr.lnl.game.server.games.player.Player;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.layout.StackPane;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
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
|
||||||
|
(Mur,Joueur,Energie,bombe,etc..)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Cell extends Rectangle {
|
||||||
|
|
||||||
|
//NON-ETABLIE
|
||||||
|
public Cell(int x, int y){
|
||||||
|
setWidth(GUI.cellSize);
|
||||||
|
setHeight(GUI.cellSize);
|
||||||
|
relocate(x,y);
|
||||||
|
setFill(Color.valueOf("#ffffff"));
|
||||||
|
setStroke(Color.DARKGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//NON-TEST
|
||||||
|
public static StackPane setImageObject(Object object){
|
||||||
|
//voir pour rajouter un répertoire ou stocker les images;
|
||||||
|
Image image;
|
||||||
|
StackPane sp = new StackPane();
|
||||||
|
//remplacer après par le switch dès que on aura implémenter les interfaces
|
||||||
|
|
||||||
|
if(object instanceof Player){
|
||||||
|
//image = new Image();
|
||||||
|
}
|
||||||
|
if(object instanceof EnergyBall){
|
||||||
|
//image = new Image();
|
||||||
|
}
|
||||||
|
if(object instanceof Bomb){
|
||||||
|
//image = new Image();
|
||||||
|
}
|
||||||
|
if(object instanceof Mine){
|
||||||
|
//image = new Image();
|
||||||
|
}
|
||||||
|
if(object instanceof Wall){
|
||||||
|
//image = new Image();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ImageView iv = new ImageView(image);
|
||||||
|
iv.setFitHeight(40);
|
||||||
|
iv.setFitWidth(40);
|
||||||
|
sp.getChilldren().add(iv);
|
||||||
|
*/
|
||||||
|
return sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
52
client/src/main/java/fr/lnl/game/client/view/GUI.java
Normal file
52
client/src/main/java/fr/lnl/game/client/view/GUI.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package fr.lnl.game.client.view;
|
||||||
|
|
||||||
|
|
||||||
|
import fr.lnl.game.server.games.grid.Box;
|
||||||
|
import fr.lnl.game.server.games.grid.Grid;
|
||||||
|
import fr.lnl.game.server.games.player.Player;
|
||||||
|
import fr.lnl.game.server.utils.Pair;
|
||||||
|
import fr.lnl.game.server.utils.Point;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class GUI {
|
||||||
|
|
||||||
|
//à revoir pour respecter MVC
|
||||||
|
HashMap<Point, Pair<Player, Box>> board;
|
||||||
|
Stage stage;
|
||||||
|
Scene scene;
|
||||||
|
Grid grid;
|
||||||
|
String text ="";
|
||||||
|
|
||||||
|
|
||||||
|
//temporaire
|
||||||
|
public static final int cellSize = 40;
|
||||||
|
public static final int width = 24;
|
||||||
|
public static final int height = 16;
|
||||||
|
|
||||||
|
public GUI(){
|
||||||
|
stage = new Stage();
|
||||||
|
stage.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
//ce n'est pas à la vue de gérer ça donc à voir
|
||||||
|
//grid = getGrid();
|
||||||
|
scene = new Scene(createContent());
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.setTitle("Game");
|
||||||
|
stage.setResizable(false);
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Parent createContent() {
|
||||||
|
Pane principalPane = new Pane();
|
||||||
|
|
||||||
|
|
||||||
|
return principalPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -31,5 +31,6 @@ public class Window extends AbstractView {
|
|||||||
Scene scene = new Scene(grid, 640, 480);
|
Scene scene = new Scene(grid, 640, 480);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user