Example #1
0
 public void readData(SpoutInputStream input) throws IOException {
   setX(input.readInt());
   setY(input.readInt());
   setWidth(input.readInt());
   setHeight(input.readInt());
   setAnchor(WidgetAnchor.getAnchorFromId(input.read()));
   setVisible(input.readBoolean());
   setPriority(RenderPriority.getRenderPriorityFromId(input.readInt()));
   setTooltip(input.readString());
   setAddon(input.readString());
   setAddon(addon);
   animType = WidgetAnim.getAnimationFromId(input.read());
   animFlags = (byte) input.read();
   animValue = input.readFloat();
   animTicks = input.readShort();
   animCount = input.readShort();
 }
Example #2
0
 public void onAnimate() {
   if ((animFlags & ANIM_RUNNING) == 0 || animTicks == 0 || ++animTick % animTicks != 0) {
     return;
   }
   // We're running, and it's ready for our next frame...
   if (++animFrame == animCount) {
     animFrame = 0;
     if ((animFlags & ANIM_STOPPING) != 0 || (animFlags & ANIM_REPEAT) == 0) {
       animFlags &= ~ANIM_RUNNING;
       if ((animFlags & ANIM_RESET) == 0) {
         return;
       }
     }
   }
   int value = animStart + (int) Math.floor(animFrame * animValue);
   switch (animType) {
     case POS_X:
       setX(value);
       break;
     case POS_Y:
       setY(value);
       break;
     case WIDTH:
       setWidth(value);
       break;
     case HEIGHT:
       setHeight(value);
       break;
     case OFFSET_LEFT:
       ((Texture) this).setLeft(value);
       break;
     case OFFSET_TOP:
       ((Texture) this).setTop(value);
       break;
   }
 }
Example #3
0
 public Widget restorePos() {
   setX(orig_x);
   setY(orig_y);
   return this;
 }
Example #4
0
 public Widget shiftXPos(int modX) {
   setX(getX() + modX);
   return this;
 }