Procházet zdrojové kódy

Go draw some blue lines in Brian's Brain. Right mouse button.

master
Lee před 12 roky
rodič
revize
0b21556a57
1 změnil soubory, kde provedl 11 přidání a 12 odebrání
  1. +11
    -12
      src/Render.java

+ 11
- 12
src/Render.java Zobrazit soubor

@@ -212,22 +212,28 @@ public class Render extends Canvas implements Runnable, MouseListener,
}
}
@Override
public void mouseDragged(MouseEvent e) {
int states = Goldfish.getMaxStates(rule) - 1;
public void mouseDraw(MouseEvent e) {
int states = Goldfish.getMaxStates(rule);
if (e.getX() < 0 || e.getY() < 0 || e.getX() / scale >= width || e.getY() / scale >= height)
return;
Patch p = _grid.getPatch(e.getX()/scale, e.getY()/scale);
if (_lastPatch != p) {
if (p.getState() != 0) {
p.setState(0);
} else if (states > 2 && SwingUtilities.isRightMouseButton(e)) {
p.setState(1);
} else {
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(states);
p.setState(states - 1);
}
_lastPatch = p;
}
e.consume();
}
@Override
public void mouseDragged(MouseEvent e) {
mouseDraw(e);
}
@Override
public void mouseClicked(MouseEvent e) {
@@ -243,14 +249,7 @@ public class Render extends Canvas implements Runnable, MouseListener,
@Override
public void mousePressed(MouseEvent e) {
int states = Goldfish.getMaxStates(rule) - 1;
Patch p = _grid.getPatch(e.getX()/scale, e.getY()/scale);
if (p.getState() == states) {
p.setState(0);
} else {
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(states);
}
e.consume();
mouseDraw(e);
}
@Override


Načítá se…
Zrušit
Uložit