public Widget setMinWidth(int min) { min = Math.max(min, 0); if (minWidth != min) { minWidth = min; updateSize(); setWidth((int) getWidth()); // Enforce our new size if needed } return this; }
public Widget setMaxWidth(int max) { max = max <= 0 ? 427 : max; if (maxWidth != max) { maxWidth = max; updateSize(); setWidth((int) getWidth()); // Enforce our new size if needed } return this; }
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; } }