List of usage examples for com.badlogic.gdx.graphics Color Color
public Color(Color color)
From source file:com.jmolina.orb.widgets.ui.Credit.java
License:Open Source License
/** * Aade un hiperenlace//w ww. j a v a 2 s . c o m * * @param text Texto visible * @param uri URI del enlace */ public void addLink(String text, final String uri) { Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = new Color(Var.COLOR_LILAC_MEDIUM); style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_REGULAR_30), findRegion(Atlas.FONT_ROBOTO_REGULAR_30)); int linkIndex = links.size() + 1; Label link = new Label("[" + linkIndex + "]: " + text, style); link.setTouchable(Touchable.enabled); link.setPosition(0f, 0f); link.setAlignment(Align.left); link.setHeight(link.getPrefHeight()); link.setWidth(link.getPrefWidth()); link.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { Gdx.net.openURI(uri); } }); links.add(link); addActor(link); header.setY(body.getPrefHeight() + getLinksPrefHeight() + Utils.cell(1)); body.setY(getLinksPrefHeight() + Utils.cell(1)); for (Label previouslink : links) { previouslink.setY(previouslink.getY() + link.getPrefHeight()); } setHeight(header.getPrefHeight() + body.getPrefHeight() + getLinksPrefHeight() + Utils.cell(1)); }
From source file:com.jmolina.orb.widgets.ui.Heading.java
License:Open Source License
public Heading(AssetManager am, String name, int align, Weight weight, int color) { super(am);/*w w w . ja va 2 s . c om*/ Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = new Color(color); style.font = newBitmapFont(weight); label = new Label(name, style); label.setTouchable(Touchable.disabled); label.setPosition(0f, 0f); label.setHeight(Utils.cell(1)); label.setWidth(Utils.cell(10f)); label.setAlignment(align); addActor(label); setTransform(false); setHeight(Utils.cell(1)); }
From source file:com.jmolina.orb.widgets.ui.Ladder.java
License:Open Source License
/** * Constructor//w w w . j a v a 2s . c o m * * @param am AssetManager * @param pm PrefsManager * @param gm GameManager * @param level Nivel al que pertecene la clasificacion * @param title Titulo de la clasificacion */ public Ladder(AssetManager am, PrefsManager pm, GameManager gm, ScreenManager.Key level, String title) { super(am); gameManager = gm; prefs = pm.getPrefs(); times = getLevelTimes(level); ratings = getRatings(level); rows = new ArrayList<LadderRow>(); background = new Image(getAsset(Asset.UI_LADDER_BACKGROUND, Texture.class)); background.setPosition(0f, 0f); Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = new Color(Var.COLOR_GREEN_DARK); style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_BOLD_30), findRegion(Atlas.FONT_ROBOTO_BOLD_30)); titleLabel = new Label(title.toUpperCase(), style); titleLabel.setPosition(Utils.cell(0.5f), Utils.cell(3.125f)); titleLabel.setSize(Utils.cell(2), Utils.cell(0.5f)); titleLabel.setAlignment(Align.left); rows.add(new LadderRow(getAssetManager(), 1, times.get(0), ratings.get(0))); rows.add(new LadderRow(getAssetManager(), 2, times.get(1), ratings.get(1))); rows.add(new LadderRow(getAssetManager(), 3, times.get(2), ratings.get(2))); addActor(background); addActor(titleLabel); addLadderRows(rows); setHeight(Utils.cell(4)); }
From source file:com.jmolina.orb.widgets.ui.LadderRow.java
License:Open Source License
/** * Constructor//w ww. j a v a 2s . c om * * @param am AssetManager * @param rank Rango * @param time Tiempo * @param numericRating Rating numerico (medallas) */ public LadderRow(AssetManager am, int rank, float time, int numericRating) { super(am); Label.LabelStyle regular = new Label.LabelStyle(); Label.LabelStyle strong = new Label.LabelStyle(); regular.fontColor = new Color(Var.COLOR_LILAC_DARK); strong.fontColor = new Color(Var.COLOR_LILAC_DARK); regular.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_REGULAR_30), findRegion(Atlas.FONT_ROBOTO_REGULAR_30)); strong.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_BOLD_30), findRegion(Atlas.FONT_ROBOTO_BOLD_30)); rankLabel = new Label(String.valueOf(rank), strong); rankLabel.setPosition(Utils.cell(0), Utils.cell(0)); rankLabel.setSize(Utils.cell(1), Utils.cell(0.5f)); rankLabel.setAlignment(Align.left); timeLabel = new Label(formatTime(time), regular); timeLabel.setPosition(Utils.cell(1), Utils.cell(0)); timeLabel.setSize(Utils.cell(2), Utils.cell(0.5f)); timeLabel.setAlignment(Align.right); userLabel = new Label("You", strong); userLabel.setPosition(Utils.cell(4), Utils.cell(0)); userLabel.setSize(Utils.cell(3.5f), Utils.cell(0.5f)); userLabel.setAlignment(Align.left); userLabel.setEllipsis(true); rating = new Rating(getAssetManager(), numericRating); rating.setPositionGrid(5, 0); rating.setScale(0.5f); rating.setHeadingVisibility(false); addActor(rankLabel); addActor(timeLabel); if (time > 0) { addActor(userLabel); addActor(rating); } setHeight(Utils.cell(0.5f)); }
From source file:com.jmolina.orb.widgets.ui.MainButton.java
License:Open Source License
/** * Constructor/*from w w w.j ava 2s . c om*/ * * @param am AssetManager * @param name Nombre del boton * @param type Tipo */ public MainButton(AssetManager am, String name, Type type) { super(am); Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = new Color(Var.COLOR_WHITE); style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_BOLD_45), findRegion(Atlas.FONT_ROBOTO_BOLD_45)); label = new Label(name, style); label.setTouchable(Touchable.disabled); label.setPosition(0f, 0f); label.setSize(Utils.cell(8), Utils.cell(1.5f)); label.setAlignment(Align.center); background = new Image(getBackgroundRegion(type)); background.setPosition(0f, 0f); frame = new Image(findRegion(Atlas.UI_BUTTON_FRAME)); frame.setPosition(0, 0); frame.addAction(alpha(0)); frame.act(0); addActor(background); addActor(frame); addActor(label); setFrame(frame); setHeight(Utils.cell(1.5f)); setOrigin(background.getWidth() * 0.5f, background.getHeight() * 0.5f); }
From source file:com.jmolina.orb.widgets.ui.MultiOption.java
License:Open Source License
/** * Constructor/*from w w w . j a va 2 s .c om*/ * * @param am AssetManager * @param name Nombre de la opcion */ public MultiOption(AssetManager am, String name) { super(am); Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = new Color(Var.COLOR_LILAC_DARK); style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_MEDIUM_45), findRegion(Atlas.FONT_ROBOTO_MEDIUM_45)); label = new Label(name, style); label.setTouchable(Touchable.disabled); label.setPosition(0f, 0f); label.setHeight(Utils.cell(1.5f)); checkboxes = new ArrayList<Checkbox>(); for (int i = 0; i < OPTIONS; i++) { checkboxes.add(new Checkbox(getAssetManager(), false)); checkboxes.get(i).setPositionGrid(5.5f + i * 1.5f, 0); checkboxes.get(i).setName(String.valueOf(i)); } lever = new Image(getAsset(Asset.UI_MULTICHECK_1, Texture.class)); lever.setTouchable(Touchable.disabled); lever.setSize(Utils.cell(4.5f), Utils.cell(1.5f)); lever.setPosition(Utils.cell(5.5f), Utils.cell(0)); addActor(label); for (Actor actor : checkboxes) addActor(actor); addActor(lever); setHeight(Utils.cell(1.5f)); setTouchable(Touchable.childrenOnly); setValue(DEFAULT_VALUE); }
From source file:com.jmolina.orb.widgets.ui.Notice.java
License:Open Source License
/** * Constructor/*from w w w . j a v a 2 s .com*/ * * @param am AssetManager */ public Notice(AssetManager am) { super(am); Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.fontColor = new Color(Var.COLOR_LILAC_DARK); labelStyle.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_REGULAR_30), findRegion(Atlas.FONT_ROBOTO_REGULAR_30)); this.author = new Label(Var.APP_AUTHOR, labelStyle); this.author.setTouchable(Touchable.disabled); this.author.setPosition(Utils.cell(0), Utils.cell(0)); this.author.setHeight(Utils.cell(0.5f)); this.author.setWidth(Utils.cell(10f)); this.author.setAlignment(Align.left); this.version = new Label("v" + Var.APP_VERSION, labelStyle); this.version.setTouchable(Touchable.disabled); this.version.setPosition(Utils.cell(0), Utils.cell(0)); this.version.setHeight(Utils.cell(0.5f)); this.version.setWidth(Utils.cell(10f)); this.version.setAlignment(Align.right); addActor(this.author); addActor(this.version); }
From source file:com.jmolina.orb.widgets.ui.Option.java
License:Open Source License
/** * Constructor// w w w .j a va2s.c om * * @param am AssetManager * @param name Etiqueta * @param checked Estado */ public Option(AssetManager am, String name, boolean checked) { super(am); Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = new Color(Var.COLOR_LILAC_DARK); style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_MEDIUM_45), findRegion(Atlas.FONT_ROBOTO_MEDIUM_45)); label = new Label(name, style); label.setTouchable(Touchable.disabled); label.setPosition(0f, 0f); label.setHeight(Utils.cell(1.5f)); checkbox = new Checkbox(getAssetManager(), checked); checkbox.setPosition(Utils.cell(8.5f), 0f); addActor(label); addActor(checkbox); setHeight(Utils.cell(1.5f)); setTouchable(Touchable.childrenOnly); }
From source file:com.jmolina.orb.widgets.ui.ProgressBar.java
License:Open Source License
/** * Constructor/*from w ww. j a v a2 s.c o m*/ * * @param am AssetManager */ public ProgressBar(AssetManager am) { super(am); Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = new Color(Var.COLOR_BLACK); style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_REGULAR_30), findRegion(Atlas.FONT_ROBOTO_REGULAR_30)); base = new Image(getAsset(Asset.UI_PROGRESS_BASE, Texture.class)); base.setPosition(Utils.cell(0), Utils.cell(0)); base.setSize(Utils.cell(8), Utils.cell(1)); fill = new Image(getAsset(Asset.UI_PROGRESS_FILL, Texture.class)); fill.setPosition(Utils.cell(0.125f), Utils.cell(0.125f)); fill.setSize(Utils.cell(0), Utils.cell(0.75f)); label = new Label("0%", style); label.setPosition(Utils.cell(0), Utils.cell(0)); label.setSize(Utils.cell(8), Utils.cell(1)); label.setAlignment(Align.center); addActor(base); addActor(fill); addActor(label); setHeight(Utils.cell(1)); }
From source file:com.jmolina.orb.widgets.ui.Stat.java
License:Open Source License
/** * Constructor/*from w w w. j av a2 s . c o m*/ * * @param am AssetManager * @param name Nombre * @param value Valor del dato * @param unit Unidad del dato */ public Stat(AssetManager am, String name, float value, String unit) { super(am); nameStyle = new Label.LabelStyle(); dataStyle = new Label.LabelStyle(); nameStyle.fontColor = new Color(Var.COLOR_LILAC_DARK); dataStyle.fontColor = new Color(Var.COLOR_BLACK); nameStyle.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_REGULAR_45), findRegion(Atlas.FONT_ROBOTO_REGULAR_45)); dataStyle.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_REGULAR_45), findRegion(Atlas.FONT_ROBOTO_REGULAR_45)); this.name = new Label(name, nameStyle); this.name.setTouchable(Touchable.disabled); this.name.setPosition(0f, 0f); this.name.setHeight(Utils.cell(1)); this.name.setWidth(Utils.cell(6)); this.name.setAlignment(Align.left); this.data = new Label(formatStat(value, unit), dataStyle); this.data.setTouchable(Touchable.disabled); this.data.setPosition(Utils.cell(6), 0f); this.data.setHeight(Utils.cell(1)); this.data.setWidth(Utils.cell(4)); this.data.setAlignment(Align.right); addActor(this.name); addActor(this.data); setTransform(false); setHeight(Utils.cell(1)); }