forked from fiuba/algo3_proyecto_base_tp2
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar> Co-authored-by: agus-germi <agerminario@fi.uba.ar>
- Loading branch information
1 parent
4a0c4e8
commit 8d6146e
Showing
13 changed files
with
154 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/edu/fiuba/algo3/interfaz/controladores/ControladorInicioPartida.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package edu.fiuba.algo3.interfaz.controladores; | ||
|
||
import edu.fiuba.algo3.interfaz.vistas.escenas.VistaTablero; | ||
import javafx.event.ActionEvent; | ||
import javafx.event.EventHandler; | ||
import javafx.scene.Scene; | ||
import javafx.stage.Stage; | ||
|
||
public class ControladorInicioPartida implements EventHandler<ActionEvent> { | ||
|
||
private Stage ventana; | ||
|
||
public ControladorInicioPartida(Stage ventana) { | ||
this.ventana = ventana; | ||
} | ||
|
||
@Override | ||
public void handle(ActionEvent evento) { | ||
// TODO: Si no llegamos a poner un boceto escribimos: "Tablero en construccion ;)" CON BOB EL CONSTRUCTOR | ||
VistaTablero tablero = new VistaTablero(); | ||
|
||
Scene escenaTablero = new Scene(tablero); | ||
|
||
this.ventana.setScene(escenaTablero); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/edu/fiuba/algo3/interfaz/vistas/botones/BotonIniciarPartida.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package edu.fiuba.algo3.interfaz.vistas.botones; | ||
|
||
import javafx.scene.control.Button; | ||
import javafx.scene.layout.Background; | ||
import javafx.scene.layout.BackgroundFill; | ||
import javafx.scene.layout.CornerRadii; | ||
import javafx.geometry.Insets; | ||
import javafx.scene.paint.Color; | ||
import edu.fiuba.algo3.interfaz.controladores.ControladorInicioPartida; | ||
import javafx.stage.Stage; | ||
|
||
|
||
public class BotonIniciarPartida extends Button { | ||
|
||
public BotonIniciarPartida(Stage ventana, String texto) { | ||
super.setText(texto); | ||
|
||
// PARTE ASTERIIIIIIKK <3 | ||
BackgroundFill normalFill = new BackgroundFill(Color.LIME, CornerRadii.EMPTY, Insets.EMPTY); | ||
Background normalBackground = new Background(normalFill); | ||
|
||
BackgroundFill hoveredFill = new BackgroundFill(Color.DARKGREEN, CornerRadii.EMPTY, Insets.EMPTY); | ||
Background hoveredBackground = new Background(hoveredFill); | ||
|
||
// Estilo del Boton | ||
this.setBackground(normalBackground); | ||
// Cuando entra el Mouse | ||
this.setOnMouseEntered(event -> { | ||
this.setBackground(hoveredBackground); | ||
}); | ||
// Cuando sale el Mouse | ||
this.setOnMouseExited(event -> { | ||
this.setBackground(normalBackground); | ||
}); | ||
// | ||
|
||
this.setDisable(true); | ||
setOnAction(new ControladorInicioPartida(ventana)); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/edu/fiuba/algo3/interfaz/vistas/escenas/VistaTablero.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package edu.fiuba.algo3.interfaz.vistas.escenas; | ||
|
||
import javafx.scene.image.Image; | ||
import javafx.scene.image.ImageView; | ||
import javafx.scene.layout.GridPane; | ||
import javafx.scene.layout.StackPane; | ||
|
||
public class VistaTablero extends GridPane { | ||
|
||
private static final int TAMANO_CELDA = 50; | ||
|
||
// public VistaTablero(Tablero tablero)? TODO: Pasarle tablero? | ||
public VistaTablero() { | ||
for (int fila = 0; fila < 4; fila++) { | ||
for (int col = 0; col < 7; col++) { | ||
|
||
StackPane panelCelda = this.crearPanelCelda("/imagenes/imagenCamino.png"); | ||
|
||
setConstraints(panelCelda, fila, col); | ||
|
||
super.getChildren().add(panelCelda); | ||
} | ||
} | ||
} | ||
|
||
public StackPane crearPanelCelda(String rutaImagen) { | ||
// "file:" + System.getProperty("user.dir") + "/imagenes/pasto.jpg" --> Ruta para imagen de pasto | ||
// "file:" + System.getProperty("user.dir") + "/imagenes/imagenCamino.png" --> Ruta para imagen de camino | ||
StackPane panelCelda = new StackPane(); | ||
Image imagenCamino = new Image("file:" + System.getProperty("user.dir") + rutaImagen); | ||
|
||
ImageView viewImagenCamino = new ImageView(imagenCamino); | ||
viewImagenCamino.setFitHeight(TAMANO_CELDA); | ||
viewImagenCamino.setFitWidth(TAMANO_CELDA); | ||
|
||
panelCelda.getChildren().add(viewImagenCamino); | ||
|
||
return panelCelda; | ||
} | ||
|
||
} |