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

View file

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

View file

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