Browse Source

Some improved mouse handling code.

master
Ben Kurtovic 12 years ago
parent
commit
f03f4e07d7
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      src/Render.java

+ 5
- 5
src/Render.java View File

@@ -128,16 +128,16 @@ public class Render extends Canvas implements Runnable, MouseListener,
@Override
public void mouseDragged(MouseEvent e) {
try {
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(1);
draw(e.getX() / scale, e.getY() / scale, 0xffffff);
} catch (ArrayIndexOutOfBoundsException exception) {
}
if (e.getX() < 0 || e.getY() < 0 || e.getX() / scale > width || e.getY() / scale > height)
return;
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(1);
e.consume();
}
@Override
public void mouseClicked(MouseEvent e) {
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(1);
e.consume();
}
@Override


Loading…
Cancel
Save