Ejemplo n.º 1
0
 public static TextureGraphNode load(Scanner s) {
   int x = s.nextInt();
   int y = s.nextInt();
   boolean isFolded = false;
   if (s.hasNextInt()) { // this check is needed to be compatible to files savec in version 0.6.3
     // and earlier (where no folding existed)
     isFolded = (s.nextInt() == 1);
   }
   TextureGraphNode ret = new TextureGraphNode(Channel.loadChannel(s));
   ret.setLocation(x, y);
   ret.setFolded(isFolded);
   return ret;
 }
Ejemplo n.º 2
0
 // saves only the node; not the Connection!!
 public void save(Writer w, TextureGraphNode n) throws IOException {
   w.write(String.format("%d %d %d\n", n.getX(), n.getY(), folded ? 1 : 0));
   Channel.saveChannel(w, texChannel);
 }
Ejemplo n.º 3
0
 // Utility method to check if the mouse position is inside the
 // connection point
 public boolean inside(int px, int py) {
   return ((px >= getX() + parent.getX())
       && (px <= (getX() + parent.getX() + width))
       && (py >= getY() + parent.getY())
       && (py <= (getY() + parent.getY() + height)));
 }
Ejemplo n.º 4
0
 public int getWorldSpaceY() {
   return parent.getY() + getY() + 4;
 }
Ejemplo n.º 5
0
 public int getY() {
   if (y > 16 && parent.isFolded()) return y - 64; // !!HACK
   return y;
 }
Ejemplo n.º 6
0
 /** @return a true copy of the current node */
 public TextureGraphNode cloneThisNode() {
   TextureGraphNode ret = new TextureGraphNode(Channel.cloneChannel(texChannel));
   ret.setLocation(getX(), getY());
   return ret;
 }