From a6178413784e07978c5670a1d58dc5a6a6b61782 Mon Sep 17 00:00:00 2001 From: Pedro Rolon Date: Thu, 8 Nov 2018 15:06:08 -0300 Subject: [PATCH] Se agregó fondo y se corrigieron los angulos diagonales --- Something.java | 30 ++++++++++++++---------------- mapamundi.jpg | Bin 0 -> 367508 bytes 2 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 mapamundi.jpg diff --git a/Something.java b/Something.java index 2b23b8e..2d31472 100644 --- a/Something.java +++ b/Something.java @@ -15,6 +15,7 @@ import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.input.KeyEvent; import javafx.scene.input.KeyCode; +import javafx.scene.paint.Color; //import Bicicleta; public class Something extends Application @@ -28,9 +29,10 @@ public class Something extends Application public void start(Stage stage) { double distancia = 10; - Canvas canvas = new Canvas(700, 700); + Canvas canvas = new Canvas(1300, 800); GraphicsContext gc = canvas.getGraphicsContext2D(); - gc.setLineWidth(2.0); + gc.setLineWidth(5.0); + //gc.setStroke(Color.BLUE); Pane root = new Pane(); ImageView imagen; @@ -40,7 +42,7 @@ public class Something extends Application //FileInputStream inputstream = new FileInputStream("file:javacleta.png"); FileInputStream inputstream = new FileInputStream("bici.png"); //se setea el tamaño de la imagen! - Image img = new Image(inputstream, 50, 50, false, false); + Image img = new Image(inputstream, 60, 60, false, false); //gc.drawImage(img, 0, 0); //es 350 menos porque se toma en cuenta el tamaño de la imagen! //gc.drawImage(img, bicicleta.x, 350-bicicleta.y); @@ -93,7 +95,7 @@ public class Something extends Application boton1.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - mover(gc, bicicleta, distancia, 2.09439510238807, imagen); + mover(gc, bicicleta, distancia, 2.3561944901865, imagen); } }); @@ -115,7 +117,7 @@ public class Something extends Application boton3.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - mover(gc, bicicleta, distancia, 0.5235987755970001, imagen); + mover(gc, bicicleta, distancia, 0.7853981633955001, imagen); } }); @@ -148,7 +150,7 @@ public class Something extends Application boton6.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - mover(gc, bicicleta, distancia, 3.665191429179, imagen); + mover(gc, bicicleta, distancia, 3.9269908169775, imagen); } }); @@ -170,17 +172,13 @@ public class Something extends Application boton8.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - mover(gc, bicicleta, distancia, 5.23598775597, imagen); + mover(gc, bicicleta, distancia, 5.4977871437685, imagen); } }); - root.setStyle("-fx-border-style: solid inside;" + - "-fx-border-width: 2;" + - "-fx-border-insets: 5;" + - "-fx-border-radius: 5;" + - "-fx-border-color: blue;"); + root.setStyle("-fx-background-image: url(\"mapamundi.jpg\");"); root.getChildren().add(canvas); root.getChildren().add(boton1); @@ -197,13 +195,13 @@ public class Something extends Application scene.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.NUMPAD1) { - mover(gc, bicicleta, distancia, 3.665191429179, imagen); + mover(gc, bicicleta, distancia, 3.9269908169775, imagen); } else if (e.getCode() == KeyCode.NUMPAD2) { mover(gc, bicicleta, distancia, 4.712388980373, imagen); } else if (e.getCode() == KeyCode.NUMPAD3) { - mover(gc, bicicleta, distancia, 5.23598775597, imagen); + mover(gc, bicicleta, distancia, 5.4977871437685, imagen); } else if (e.getCode() == KeyCode.NUMPAD4) { mover(gc, bicicleta, distancia, 3.141592653582001, imagen); @@ -212,13 +210,13 @@ public class Something extends Application mover(gc, bicicleta, distancia, 0, imagen); } else if (e.getCode() == KeyCode.NUMPAD7) { - mover(gc, bicicleta, distancia, 2.09439510238807, imagen); + mover(gc, bicicleta, distancia, 2.3561944901865, imagen); } else if (e.getCode() == KeyCode.NUMPAD8) { mover(gc, bicicleta, distancia, 1.570796326791001, imagen); } else if (e.getCode() == KeyCode.NUMPAD9) { - mover(gc, bicicleta, distancia, 0.5235987755970001, imagen); + mover(gc, bicicleta, distancia, 0.7853981633955001, imagen); } else if (e.getCode() == KeyCode.PLUS) { //distancia++; diff --git a/mapamundi.jpg b/mapamundi.jpg new file mode 100644 index 0000000..6fb133a Binary files /dev/null and b/mapamundi.jpg differ -- libgit2 0.26.0