Fixed problem with select
This commit is contained in:
parent
95053aa6b5
commit
98c7550e83
1 changed files with 8 additions and 9 deletions
|
|
@ -59,7 +59,6 @@ public class InGameMouseInput extends MouseInput{
|
|||
|
||||
// The
|
||||
if(leftKlickPos != null){
|
||||
System.out.println("leftclick 2");
|
||||
markingBox.setSize(new Vector2f(
|
||||
Math.abs(leftKlickPos.getX()-(LWJGLGameWindow.getCamera().getLocation().getX()+x)),
|
||||
Math.abs(leftKlickPos.getY()-(LWJGLGameWindow.getCamera().getLocation().getY()+y))));
|
||||
|
|
@ -77,7 +76,6 @@ public class InGameMouseInput extends MouseInput{
|
|||
if(event==LEFT_MOUSE_BUTTON){
|
||||
//map.printAllUnits();
|
||||
if(leftKlickPos == null){
|
||||
System.out.println("leftclick 1");
|
||||
leftKlickPos = new Vector2f(x,y);
|
||||
markingBox.setLocation(leftKlickPos);
|
||||
}
|
||||
|
|
@ -113,15 +111,16 @@ public class InGameMouseInput extends MouseInput{
|
|||
}
|
||||
|
||||
public void selectUnits(Vector2i startPos, Vector2i stopPos){
|
||||
MultiPrintStream.out.println("Selecting: "+startPos.getX()+", "+startPos.getY()+" to "+stopPos.getX()+", "+stopPos.getY());
|
||||
for(int i=Math.min(startPos.getX(), stopPos.getX()); i<Math.max(startPos.getX(), stopPos.getX()) ;i++){
|
||||
for(int j=Math.min(startPos.getY(), stopPos.getY()); j<Math.max(startPos.getY(), stopPos.getY()) ;j++){
|
||||
if(!map.isPosEmpty(i, j)){
|
||||
selected.add(map.getPos(i, j));
|
||||
map.getPos(i, j).setSelected(true);
|
||||
|
||||
for(int i=Math.min(startPos.getX(), stopPos.getX()); i<=Math.max(startPos.getX(), stopPos.getX()) ;i++){
|
||||
for(int j=Math.min(startPos.getY(), stopPos.getY()); j<=Math.max(startPos.getY(), stopPos.getY()) ;j++){
|
||||
if(!map.isPosEmpty(i, j)){
|
||||
selected.add(map.getPos(i, j));
|
||||
map.getPos(i, j).setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue