Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Quentin DRUAULT-AUBIN
lo23-project
Commits
13b3e459
Commit
13b3e459
authored
Dec 14, 2017
by
Quentin DRUAULT-AUBIN
Browse files
[Ship] Fix place ship on board
parent
3e011626
Changes
2
Hide whitespace changes
Inline
Side-by-side
Battleship/src/main/java/com/utclo23/ihmtable/IHMTableFacade.java
View file @
13b3e459
...
...
@@ -5,19 +5,14 @@
*/
package
com.utclo23.ihmtable
;
import
com.utclo23.data.facade.DataFacade
;
import
com.utclo23.data.structure.Coordinate
;
import
com.utclo23.data.structure.StatGame
;
import
com.utclo23.data.facade.IDataIHMTable
;
import
com.utclo23.data.structure.Game
;
import
com.utclo23.data.structure.LightPublicUser
;
import
com.utclo23.data.structure.Ship
;
import
com.utclo23.ihmmain.controller.AbstractController
;
import
com.utclo23.ihmmain.facade.IHMMainToIhmTable
;
import
com.utclo23.ihmtable.controller.InGameGUIController
;
import
java.io.IOException
;
import
java.rmi.server.UID
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javafx.fxml.FXMLLoader
;
...
...
Battleship/src/main/java/com/utclo23/ihmtable/controller/InGameGUIController.java
View file @
13b3e459
...
...
@@ -479,7 +479,16 @@ public class InGameGUIController {
shipOnTheGrid
.
setFitWidth
(
grid
.
getWidth
()/
10.0
*
ship
.
getSize
());
shipOnTheGrid
.
setFitHeight
(
grid
.
getHeight
()/
10.0
);
// Place on the grid.
grid
.
add
(
shipOnTheGrid
,
Math
.
min
(
ship
.
getListCoord
().
get
(
0
).
getX
(),
ship
.
getListCoord
().
get
(
1
).
getX
()),
ship
.
getListCoord
().
get
(
0
).
getY
(),
ship
.
getSize
(),
1
);
grid
.
add
(
shipOnTheGrid
,
Math
.
min
(
ship
.
getListCoord
().
get
(
0
).
getX
(),
ship
.
getListCoord
().
get
(
ship
.
getListCoord
().
size
()
-
1
).
getX
()
),
ship
.
getListCoord
().
get
(
0
).
getY
(),
ship
.
getSize
(),
1
);
}
else
{
// Vertical
// Set the size.
...
...
@@ -488,7 +497,15 @@ public class InGameGUIController {
// Rotate the image.
shipOnTheGrid
.
setRotate
(
90
);
// Place on the grid.
grid
.
add
(
shipOnTheGrid
,
ship
.
getListCoord
().
get
(
0
).
getX
(),
Math
.
min
(
ship
.
getListCoord
().
get
(
0
).
getY
(),
ship
.
getListCoord
().
get
(
1
).
getY
()),
1
,
ship
.
getSize
());
grid
.
add
(
shipOnTheGrid
,
ship
.
getListCoord
().
get
(
0
).
getX
(),
Math
.
min
(
ship
.
getListCoord
().
get
(
0
).
getY
(),
ship
.
getListCoord
().
get
(
ship
.
getListCoord
().
size
()
-
1
).
getY
()
),
1
,
ship
.
getSize
());
}
return
shipOnTheGrid
;
...
...
Write
Preview
Supports
Markdown
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