This commit is contained in:
parent
98c7550e83
commit
9d1bcdc52b
1 changed files with 27 additions and 7 deletions
|
|
@ -57,12 +57,29 @@ public class InGameMouseInput extends MouseInput{
|
||||||
LWJGLGameWindow.getCamera().getLocation().add(0,CAMERA_MOVE_SPEED,0);
|
LWJGLGameWindow.getCamera().getLocation().add(0,CAMERA_MOVE_SPEED,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The
|
// The marking box is sized and positioned
|
||||||
if(leftKlickPos != null){
|
if(leftKlickPos != null){
|
||||||
markingBox.setSize(new Vector2f(
|
float markingSizeX = 0;
|
||||||
Math.abs(leftKlickPos.getX()-(LWJGLGameWindow.getCamera().getLocation().getX()+x)),
|
float markingSizeY = 0;
|
||||||
Math.abs(leftKlickPos.getY()-(LWJGLGameWindow.getCamera().getLocation().getY()+y))));
|
|
||||||
getNode().add(markingBox);
|
if(leftKlickPos.getX() > (LWJGLGameWindow.getCamera().getLocation().getX()+x)){
|
||||||
|
markingSizeX = Math.abs(leftKlickPos.getX()-(LWJGLGameWindow.getCamera().getLocation().getX()+x));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
markingSizeX = -Math.abs(leftKlickPos.getX()-(LWJGLGameWindow.getCamera().getLocation().getX()+x));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(leftKlickPos.getY() > (LWJGLGameWindow.getCamera().getLocation().getY()+y)){
|
||||||
|
markingSizeY = Math.abs(leftKlickPos.getY()-(LWJGLGameWindow.getCamera().getLocation().getY()+y));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
markingSizeY = -Math.abs(leftKlickPos.getY()-(LWJGLGameWindow.getCamera().getLocation().getY()+y));
|
||||||
|
}
|
||||||
|
|
||||||
|
markingBox.setSize(new Vector2f(markingSizeX+getSprite().getSize().getX()/2,markingSizeY+getSprite().getSize().getY()/2));
|
||||||
|
markingBox.setLocation(new Vector2f(
|
||||||
|
leftKlickPos.getX()-markingBox.getSize().getX()/2,
|
||||||
|
leftKlickPos.getY()-markingBox.getSize().getY()/2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,8 +93,11 @@ public class InGameMouseInput extends MouseInput{
|
||||||
if(event==LEFT_MOUSE_BUTTON){
|
if(event==LEFT_MOUSE_BUTTON){
|
||||||
//map.printAllUnits();
|
//map.printAllUnits();
|
||||||
if(leftKlickPos == null){
|
if(leftKlickPos == null){
|
||||||
leftKlickPos = new Vector2f(x,y);
|
leftKlickPos = new Vector2f(
|
||||||
markingBox.setLocation(leftKlickPos);
|
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
||||||
|
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
||||||
|
markingBox.setSize(new Vector2f(0,0));
|
||||||
|
getNode().add(markingBox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//unit action.
|
//unit action.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue