Skip to content

Commit

Permalink
gif feature added.
Browse files Browse the repository at this point in the history
commit made by: Diego V.
  • Loading branch information
Diegx22v committed Jan 7, 2025
1 parent 3576c1b commit 6826ec3
Show file tree
Hide file tree
Showing 22 changed files with 685 additions and 290 deletions.
11 changes: 9 additions & 2 deletions src/application/Creditos_juegos.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public class Creditos_juegos {
*/
@FXML
public VBox contenedor_vertical;

/**
* Objeto Text para contener el primer grupo
*/
@FXML
public Text integrantes_d;

Expand All @@ -61,9 +63,14 @@ public class Creditos_juegos {
@FXML
public VBox Contenedor_vertical_tres;

/**
* Objeto Text para contener el segundo grupo
*/
@FXML
public Text integrantes_c;

/**
* Objeto Text para contener los profesores
*/
@FXML
public Text profesores;

Expand Down
2 changes: 1 addition & 1 deletion src/application/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void start(Stage primaryStage) throws Exception {
Image icono = new Image(getClass().getResourceAsStream("resources/TECHCOM.png"));
primaryStage.getIcons().add(icono);

FXMLLoader loader = new FXMLLoader(getClass().getResource("menu_principal.fxml"));
FXMLLoader loader = new FXMLLoader(getClass().getResource("/application/menu_principal.fxml"));
GridPane main = loader.load(); // Se asegura de que el GridPane es el nodo raíz

// Crear un grupo para aplicar el escalado al contenido
Expand Down
355 changes: 187 additions & 168 deletions src/application/creditos.fxml

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions src/application/creditos.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public class creditos {
*/
@FXML
public VBox contenedor_vertical;

/**
* Objeto Text para contener el primer grupo
*/
@FXML
public Text integrantes_d;

Expand All @@ -61,9 +63,15 @@ public class creditos {
@FXML
public VBox Contenedor_vertical_tres;

/**
* Objeto Text para contener el segundo grupo
*/
@FXML
public Text integrantes_c;

/**
* Objeto Text para contener los profesores
*/
@FXML
public Text profesores;

Expand All @@ -78,8 +86,12 @@ public class creditos {
*/
@FXML
public ImageView Return_credits;


/**
* Objeto Text para contener el tercer grupo
*/
@FXML
public Text integrantes_desarrollo;

/**
* Animacion de la imagen de retorno
*/
Expand All @@ -94,15 +106,22 @@ public void initialize(){
String texto_d = "* Diego Villota\n"
+ "* Dayana Torres\n"
+ "* Carlos Vélez\n"
+ "* Franklin Chunga\n";
+ "* Franklin Chunga";

String texto_deep = "* Juan Carlos Flores\n"
+ "* Kendy Vera\n"
+ "* Melanyn Triguero\n"
+ "* Benjamin Rodriguez";

String texto_c = "* Danna Lopez\n"
+ "* Felix Mendoza\n"
+ "* Daniela Marcillo\n"
+ "* Valeria Arias\n";
+ "* Valeria Arias";
String texto_p = "* Lcda. Maria Fernanda Lavaye\n"
+ "* Lcdo. Anthony Sotomayor";
integrantes_d.setText(texto_d);
integrantes_desarrollo.setText(texto_d);
integrantes_c.setText(texto_c);
integrantes_d.setText(texto_deep);
profesores.setText(texto_p);
}

Expand Down
6 changes: 6 additions & 0 deletions src/application/juegos.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
Expand All @@ -21,6 +22,11 @@
<ColumnConstraints fillWidth="false" percentWidth="99.0" />
<ColumnConstraints fillWidth="false" percentWidth="1.0" />
</columnConstraints>
<ImageView fx:id="Return_credits" fitHeight="87.0" fitWidth="97.0" onMouseClicked="#return_main1" onMouseEntered="#softimage1" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@resources/return-57.png" />
</image>
</ImageView>

<Text fx:id="tittle" text="juegos locos franklin" wrappingWidth="958.2000122070312" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.rowIndex="0">
<font>
Expand Down
130 changes: 128 additions & 2 deletions src/application/juegos.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javafx.geometry.Pos;
import javafx.geometry.Rectangle2D;
import javafx.scene.Group;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Screen;
/**
Expand All @@ -26,12 +27,23 @@ public class juegos {
@FXML
public Button jugar;


/*
Texto de titulo
*/
@FXML
public Text tittle;


/*
Texto de SubTitulo
*/
@FXML
public Text subtittle;

/*
Texto de version (Obsoleto)
*/
@FXML
public Text version;

Expand All @@ -42,6 +54,10 @@ public class juegos {
@FXML
public Button salir;


/*
Imagen / Gif de la ruleta
*/
@FXML
public ImageView gif_ruleta;

Expand All @@ -59,6 +75,7 @@ public void initialize(){
inicializarAnimacion_boton_jugar();
inicializarAnimacion_boton_creditos();
inicializarAnimacion_boton_salir();
initialize_animation_return_credits();
}


Expand Down Expand Up @@ -146,12 +163,10 @@ public void ruleta() throws IllegalStateException, InterruptedException{
gif_ruleta.setVisible(true);
// Duración del GIF en milisegundos (modifica según tu GIF)
gifDuration = 5000;

// Usar un Timeline para restaurar los elementos tras la reproducción del GIF
timeline = new Timeline(new KeyFrame(Duration.millis(gifDuration), e -> {
gif_ruleta.setVisible(false); // Ocultar el GIF
gif_ruleta.setImage(null); // Opcional: Limpiar referencia al GIF

// Mostrar elementos nuevamente
tittle.setVisible(true);
subtittle.setVisible(true);
Expand Down Expand Up @@ -421,5 +436,116 @@ public void ventana_creditos() {
}
}

/*
Animacion para la imagen de retorno
*/
@FXML
public ScaleTransition credits_return_animation;

/*
Imagen de retorno
*/
@FXML
public ImageView Return_credits;

/**
* Inicia una animacion
*/
public void initialize_animation_return_credits() {

credits_return_animation = new ScaleTransition(Duration.millis(150), Return_credits);
credits_return_animation.setByX(0.15);
credits_return_animation.setByY(0.10);
credits_return_animation.setAutoReverse(true);
credits_return_animation.setCycleCount(2);
}

/**
* verifica la ejecucion de la animacion
* @param animacion recoge la animacion
*/
public void animacion_image(ScaleTransition animacion) {
if (animacion.getStatus() != Status.RUNNING) {
animacion.playFromStart();
}
}

/**
* Inicia la animacion
*/
@FXML
public void softimage1() {
animacion_image(credits_return_animation);
}

/**
* Cierra la ventana actual y regresa a la anterior
*/
@FXML
public void return_main1() {
try {
Return_credits.setDisable(true);
Stage cerrar = (Stage) Return_credits.getScene().getWindow();
cerrar.close();

Stage primaryStage = new Stage();
double baseWidth = 1920;
double baseHeight = 1080;

// Detectar resolución de pantalla
Rectangle2D screenBounds = Screen.getPrimary().getBounds();
double screenWidth = screenBounds.getWidth();
double screenHeight = screenBounds.getHeight();

// Configuración de la ventana principal
Image icono = new Image(getClass().getResourceAsStream("resources/TECHCOM.png"));
primaryStage.getIcons().add(icono);

FXMLLoader loader = new FXMLLoader(getClass().getResource("menu_principal.fxml"));
GridPane main = loader.load(); // Se asegura de que el GridPane es el nodo raíz

// Crear un grupo para aplicar el escalado al contenido
Group scalableGroup = new Group(main);

// Crear una escena con la resolución detectada
Scene scene = new Scene(new StackPane(scalableGroup), screenWidth, screenHeight);
scene.getStylesheets().add(getClass().getResource("resources/interfaz_principal.css").toExternalForm());

// Calcular el factor de escalado
double scaleX = screenWidth / baseWidth;
double scaleY = screenHeight / baseHeight;
double scale = Math.min(scaleX, scaleY); // Mantener proporciones

// Aplicar el escalado
scalableGroup.setScaleX(scale);
scalableGroup.setScaleY(scale);

// Centrar el contenido escalado en la ventana
StackPane stackPane = (StackPane) scene.getRoot();
stackPane.setAlignment(Pos.CENTER);

// Configuración del Stage
primaryStage.setMaximized(true);
primaryStage.setTitle("Contribuidores");
primaryStage.setScene(scene);
primaryStage.show();

// Mostrar la nueva ventana
cerrar.close();
} catch (Exception e) {
// ALERTA`
Alert errorAlert = new Alert(AlertType.ERROR);
errorAlert.setTitle("Error en la Aplicación");
errorAlert.setHeaderText("Error en la ejecución");
errorAlert.setContentText("error: " + e);

Stage errores = (Stage) errorAlert.getDialogPane().getScene().getWindow();
errores.getIcons().add(new Image(getClass().getResourceAsStream("resources/error_icon.png")));
errorAlert.showAndWait();
}finally{
Return_credits.setDisable(false);
}
}


}
Loading

0 comments on commit 6826ec3

Please sign in to comment.