Package fr.formiko.views.gui2d
Class ThMove
java.lang.Object
fr.formiko.views.gui2d.ThMove
A simple Thread extends class to move ObjetSurCarteAId.
It modify only rotation & position so it won't break any game mechanic.
It modify only rotation & position so it won't break any game mechanic.
- Author:
- Hydrolien
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Comparator<ThMove>
private static int
private fr.formiko.usual.Point
private fr.formiko.usual.Point
private static fr.formiko.usual.structures.listes.Liste<ThMove>
private fr.formiko.usual.Point
private int
private int
private int
private boolean
private int
private ObjetSurCarteAId
private static fr.formiko.usual.structures.listes.Liste<ThMove>
private fr.formiko.usual.Point
private double
private static ThMoveManager
private long
private fr.formiko.usual.Point
private double
private double
private double
-
Constructor Summary
ConstructorsConstructorDescriptionThMove
(ObjetSurCarteAId o, CCase from, CCase to) Create Thread for the ObjetSurCarteAId animation. -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addToQueue
(ThMove th) add an item to the queue.void
endRun()
End the ObjetSurCarteAId animation by removing this from the 2 thread.private int
int
getIdTh()
private void
Initialize before launch start function.void
iniRun()
Initialize the ObjetSurCarteAId animation.void
oneStep()
Do a step of the ObjetSurCarteAId animation.(package private) static void
Update the queue by launching all ThMove that can be launch.static void
Update all ThMove that need to be change if ant move a 2a time.private void
updateTo
(fr.formiko.usual.Point to) Update the destination Point.
-
Field Details
-
o
-
from
private fr.formiko.usual.Point from -
to
private fr.formiko.usual.Point to -
curent
private fr.formiko.usual.Point curent -
curent2
private fr.formiko.usual.Point curent2 -
rotate
private fr.formiko.usual.Point rotate -
vectX
private double vectX -
vectY
private double vectY -
vectRotate
private double vectRotate -
curentThList
-
queue
-
id
private int id -
cptId
private static int cptId -
lock
private boolean lock -
time
private long time -
comparator
-
thMoveManager
-
k
private int k -
kIni
private int kIni -
numberOfTic
private int numberOfTic -
rotateAngle
private double rotateAngle
-
-
Constructor Details
-
ThMove
Create Thread for the ObjetSurCarteAId animation.- Parameters:
o
- the Object to animate.from
- CCase from where it move.to
- CCase where it move.
-
-
Method Details
-
getIdMovingObject
private int getIdMovingObject() -
getIdTh
public int getIdTh() -
iniBeforeStart
private void iniBeforeStart()Initialize before launch start function. It Initialize Point and add to the 2 curent list. -
addToQueue
add an item to the queue. Item are sorted in queue so that they will be launch in the creation order. -
updateQueue
static void updateQueue()Update the queue by launching all ThMove that can be launch. -
updateTo
private void updateTo(fr.formiko.usual.Point to) Update the destination Point.- Parameters:
to
- the new destination.
-
updateTo
Update all ThMove that need to be change if ant move a 2a time. It will update all ThMove that haven't been done & that are about ObjetSurCarteAId with given id.- Parameters:
to
- new CCase were to go.id
- id of the concerned ObjetSurCarteAId.
-
iniRun
public void iniRun()Initialize the ObjetSurCarteAId animation. -
oneStep
public void oneStep()Do a step of the ObjetSurCarteAId animation. Call end run if it's over. -
endRun
public void endRun()End the ObjetSurCarteAId animation by removing this from the 2 thread.
-