Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java-e006-javacleta
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pedro Rolon
java-e006-javacleta
Commits
a6178413
Commit
a6178413
authored
Nov 08, 2018
by
Pedro Rolon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se agregó fondo y se corrigieron los angulos diagonales
parent
d8fb3402
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
Something.java
+14
-16
mapamundi.jpg
+0
-0
No files found.
Something.java
View file @
a6178413
...
...
@@ -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
,
7
00
);
Canvas
canvas
=
new
Canvas
(
1300
,
8
00
);
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
,
5
0
,
false
,
false
);
Image
img
=
new
Image
(
inputstream
,
60
,
6
0
,
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
<
ActionEvent
>()
{
@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
<
ActionEvent
>()
{
@Override
public
void
handle
(
ActionEvent
event
)
{
mover
(
gc
,
bicicleta
,
distancia
,
0.
5235987755970
001
,
imagen
);
mover
(
gc
,
bicicleta
,
distancia
,
0.
7853981633955
001
,
imagen
);
}
});
...
...
@@ -148,7 +150,7 @@ public class Something extends Application
boton6
.
setOnAction
(
new
EventHandler
<
ActionEvent
>()
{
@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
<
ActionEvent
>()
{
@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.
5235987755970
001
,
imagen
);
mover
(
gc
,
bicicleta
,
distancia
,
0.
7853981633955
001
,
imagen
);
}
else
if
(
e
.
getCode
()
==
KeyCode
.
PLUS
)
{
//distancia++;
...
...
mapamundi.jpg
0 → 100644
View file @
a6178413
359 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment