Fixed mouse coordinates
This commit is contained in:
parent
71011aa33a
commit
e19132c65f
2 changed files with 11 additions and 5 deletions
|
|
@ -54,10 +54,10 @@ public class InGameMouseInput extends MouseInput{
|
|||
|
||||
@Override
|
||||
public void mouseDown(int event,int x, int y) {
|
||||
System.out.println("DOWN("+event+"): "+x+"-"+y+map);
|
||||
System.out.println("DOWN("+event+"): "+x+"-"+y);
|
||||
Vector2i pos = map.getPosByPixel(
|
||||
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
||||
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
||||
LWJGLGameWindow.getCamera().getLocation().getY()+(LWJGLGameWindow.getHeight()-y));
|
||||
if(!map.isPosEmpty(pos.getX(), pos.getY())){
|
||||
selected.clear();
|
||||
System.out.println(pos.getX()+", "+pos.getY());
|
||||
|
|
@ -65,8 +65,8 @@ public class InGameMouseInput extends MouseInput{
|
|||
}
|
||||
else{
|
||||
for(int i=0; i<selected.size() ;i++){
|
||||
Unit u = (Unit) selected.get(i);
|
||||
u.move(pos.getX(),pos.getY());
|
||||
selected.get(i).move(pos.getX(),pos.getY());
|
||||
System.out.println("Lolz");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +74,6 @@ public class InGameMouseInput extends MouseInput{
|
|||
@Override
|
||||
public void mouseUp(int event,int x, int y) {
|
||||
System.out.println("UP("+event+"): "+x+"-"+y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,13 @@ public class Map {
|
|||
if(map[x][y] != null){
|
||||
return true;
|
||||
}
|
||||
for(int i=0; i<width ;i++){
|
||||
for(int j=0; j<hight ;j++){
|
||||
if(map[i][j] != null){
|
||||
System.out.println("LOL: "+i+" "+j);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue