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);
|
||||
}
|
||||
|
||||
// The
|
||||
// The marking box is sized and positioned
|
||||
if(leftKlickPos != null){
|
||||
markingBox.setSize(new Vector2f(
|
||||
Math.abs(leftKlickPos.getX()-(LWJGLGameWindow.getCamera().getLocation().getX()+x)),
|
||||
Math.abs(leftKlickPos.getY()-(LWJGLGameWindow.getCamera().getLocation().getY()+y))));
|
||||
getNode().add(markingBox);
|
||||
float markingSizeX = 0;
|
||||
float markingSizeY = 0;
|
||||
|
||||
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){
|
||||
//map.printAllUnits();
|
||||
if(leftKlickPos == null){
|
||||
leftKlickPos = new Vector2f(x,y);
|
||||
markingBox.setLocation(leftKlickPos);
|
||||
leftKlickPos = new Vector2f(
|
||||
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
||||
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
||||
markingBox.setSize(new Vector2f(0,0));
|
||||
getNode().add(markingBox);
|
||||
}
|
||||
}
|
||||
//unit action.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue