示例#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;
 }
示例#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);
 }
示例#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)));
 }
示例#4
0
 public int getWorldSpaceY() {
   return parent.getY() + getY() + 4;
 }
示例#5
0
 public int getY() {
   if (y > 16 && parent.isFolded()) return y - 64; // !!HACK
   return y;
 }
示例#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;
 }