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(); }
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; } }
public Widget restorePos() { setX(orig_x); setY(orig_y); return this; }
public Widget shiftXPos(int modX) { setX(getX() + modX); return this; }