Fixed the mouse y invert thingy

This commit is contained in:
Ziver Koc 2007-04-15 19:27:36 +00:00
parent 5d07cd2dee
commit 575e0158ea
3 changed files with 8 additions and 9 deletions

View file

@ -76,7 +76,7 @@ public abstract class MouseInput extends Input{
int mouseDW = Mouse.getDWheel();
if (mouseDX != 0 || mouseDY != 0 || mouseDW != 0) {
cursorX += mouseDX;
cursorY += mouseDY;
cursorY -= mouseDY;
if (cursorX < 0) {
cursorX = 0;
}
@ -102,8 +102,7 @@ public abstract class MouseInput extends Input{
}
if(cursor != null){
cursor.setLocation(new Vector2f(cursorX,
LWJGLGameWindow.getHeight()-cursorY));
cursor.setLocation(new Vector2f(cursorX, cursorY));
}
}

View file

@ -41,11 +41,11 @@ public class InGameMouseInput extends MouseInput{
}
// mov cam upp
if(y < CAMERA_MOVE_BORDER){
LWJGLGameWindow.getCamera().getLocation().add(0,CAMERA_MOVE_SPEED,0);
LWJGLGameWindow.getCamera().getLocation().add(0,-CAMERA_MOVE_SPEED,0);
}
// mov cam down
if(y > LWJGLGameWindow.getHeight()-CAMERA_MOVE_BORDER){
LWJGLGameWindow.getCamera().getLocation().add(0,-CAMERA_MOVE_SPEED,0);
LWJGLGameWindow.getCamera().getLocation().add(0,CAMERA_MOVE_SPEED,0);
}
}
@ -54,7 +54,7 @@ public class InGameMouseInput extends MouseInput{
System.out.println("DOWN("+event+"): "+x+"-"+y);
Vector2i pos = map.getPosByPixel(
LWJGLGameWindow.getCamera().getLocation().getX()+x,
LWJGLGameWindow.getCamera().getLocation().getY()+(LWJGLGameWindow.getHeight()-y));
LWJGLGameWindow.getCamera().getLocation().getY()+y);
if(!map.isPosEmpty(pos.getX(), pos.getY())){
//map.printAllUnits();
selected.clear();

View file

@ -53,9 +53,9 @@ public class Map {
* @return The coordinate of the pos
*/
public Vector2f getPixelByPos(int x, int y){
x = (int)(POS_SIZE*x);
y = (int)(POS_SIZE*y);
return new Vector2f((int)x,(int)y);
float xf = (POS_SIZE*x);
float yf = (POS_SIZE*y);
return new Vector2f(xf,yf);
}
/**