public Mesh tile = new Mesh(false);
public Mesh goal = new Mesh(false);
+ private int mousex;
+ private int mousey;
private Matrix projection = null;
JFrame f;
GLCanvas glcanvas;
- Point clickPoint = null;
+
+ private Point clickPoint = null;
Point clickClosest = null;
- int mousex;
- int mousey;
- float tx = 0;
- float ty = 0;
float tz = 0;
float anglex = 0;
float angley = 0;
gl.glDrawBuffer(GL.GL_FRONT);
}
-
/** return the position of the mouse as a point in window-space */
public Point getMouse() {
return new Point(mousex, glcanvas.getHeight()-mousey, 0);
}
+ /** return the position where the mouse button was pressed, or null if it is not currently pressed */
+ public Point getMouseClick() {
+ return clickPoint;
+ }
+
public void mouseWheelMoved(MouseWheelEvent e) {
tz -= e.getWheelRotation();
}
public void mouseDragged(MouseEvent e) {
if (shift) {
- /*
- tx += (mousex - e.getX())/(float)20;
- ty += (mousey - e.getY())/(float)20;
- */
if (closest != null && projection != null && clickClosest != null) {
synchronized(this) {
Vec d1 = projection.inverse().times(getMouse()).minus(projection.inverse().times(clickPoint));
Vec delta = d1.plus(clickClosest).minus(closest.getPoint());
- //System.out.println(delta + " " + closest.getPoint());
- System.out.println(getMouse().minus(clickPoint));
- closest.move(Matrix.translate(delta), false);
+ closest.move(delta, false);
}
}
} else {