public void updatePosition() { widget.transform.x = getXFor(id); widget.dirty = true; alpha = id == active ? MAX_ALPHA : MIN_ALPHA; widget.transform.scale = id == active ? MAX_SCALE : MIN_SCALE; DrawTexture.get(widget).color.a = alpha; }
@Override public void handleEvent(Widget w, FrameEvent event) { double masterAlpha = getPage(w.getWidgetParent().getWidgetParent()).alpha; DrawTexture dt = DrawTexture.get(w); if (dt != null) { dt.color.a = masterAlpha; } else { TextBox.get(w).color.a = masterAlpha; } }
public void updateInfo() { Preset p = data.getPreset(id); byte[] pdata = (id == active && editor != null) ? editor.display : p.getData(); for (int i = 0; i < 4; ++i) { Category cat = AbilityData.get(player).getCategory(); Controllable c = cat.getControllable(pdata[i]); Widget main = widget.getWidget("" + i); DrawTexture.get(main.getWidget("icon")).texture = c == null ? Resources.TEX_EMPTY : c.getHintIcon(); TextBox.get(main.getWidget("text")).content = c == null ? "" : c.getHintText(); } }
private Widget createMedia(Media media) { Widget ret = loaded.getWidget("t_one").copy(); DrawTexture.get(ret.getWidget("icon")).texture = media.cover; TextBox.get(ret.getWidget("title")).content = media.getDisplayName(); TextBox.get(ret.getWidget("desc")).content = media.getDesc(); TextBox.get(ret.getWidget("time")).content = media.getLengthStr(); ret.regEventHandler( MouseDownEvent.class, (Widget w, MouseDownEvent event) -> { if (w.isFocused()) { player.startPlay(media); gui.postEvent(new UpdateMediaEvent()); } }); return ret; }
@Override public void updatePosition() { double x0 = getXFor(id, lastActive), x1 = getXFor(id, active); double dx = MathUtils.lerp(x0, x1, transitProgress); double scale; if (isFrom()) { alpha = MathUtils.lerp(MAX_ALPHA, MIN_ALPHA, transitProgress); scale = MathUtils.lerp(MAX_SCALE, MIN_SCALE, transitProgress); } else if (isTo()) { alpha = MathUtils.lerp(MIN_ALPHA, MAX_ALPHA, transitProgress); scale = MathUtils.lerp(MIN_SCALE, MAX_SCALE, transitProgress); } else { alpha = MIN_ALPHA; scale = MIN_SCALE; } widget.transform.x = dx; widget.transform.scale = scale; DrawTexture.get(widget).color.a = alpha; widget.dirty = true; }
private void updatePopState() { System.out.println(player.isPlaying()); DrawTexture.get(pageMain.getWidget("pop")).texture = (player.isPlaying() && !player.isPaused()) ? T_PAUSE : T_PLAY; }