Java 类com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle 实例源码

项目:Cubes_2    文件:ScrollInventoryActor.java   
public ScrollInventoryActor(Inventory inventory, int slots) {
    defaults().space(4f);

    add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
    row();

    inner = new Table();
    inner.defaults().space(4f);
    for (int i = 0; i < inventory.itemStacks.length; i++) {
        SlotActor slotActor = new SlotActor(inventory, i);
        inner.add(slotActor);

        if ((i + 1) % inventory.width == 0) {
            inner.row();
        }
    }
    inner.pack();

    scrollPane = new ScrollPane(inner);
    scrollPane.setScrollingDisabled(true, false);
    add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
    row();
    pack();
}
项目:Cubes_2    文件:InventoryActor.java   
public InventoryActor(Inventory inventory) {
    defaults().space(4f);

    add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE))).colspan(inventory.width);
    row();

    SlotActor slotActor;
    for (int i = 0; i < inventory.itemStacks.length; i++) {
        slotActor = new SlotActor(inventory, i);
        add(slotActor);

        if ((i + 1) % inventory.width == 0) {
            row();
        }
    }

    pack();
}
项目:Cubes    文件:ScrollInventoryActor.java   
public ScrollInventoryActor(Inventory inventory, int slots) {
  defaults().space(4f);

  add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
  row();

  inner = new Table();
  inner.defaults().space(4f);
  for (int i = 0; i < inventory.itemStacks.length; i++) {
    SlotActor slotActor = new SlotActor(inventory, i);
    inner.add(slotActor);

    if ((i + 1) % inventory.width == 0) {
      inner.row();
    }
  }
  inner.pack();

  scrollPane = new ScrollPane(inner);
  scrollPane.setScrollingDisabled(true, false);
  add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
  row();
  pack();
}
项目:Cubes    文件:InventoryActor.java   
public InventoryActor(Inventory inventory) {
  defaults().space(4f);

  add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE))).colspan(inventory.width);
  row();

  for (int i = 0; i < inventory.itemStacks.length; i++) {
    SlotActor slotActor = new SlotActor(inventory, i);
    add(slotActor);

    if ((i + 1) % inventory.width == 0) {
      row();
    }
  }

  pack();
}
项目:joe    文件:HUD.java   
private void createInfoLabel() {
    infoBackground = new Image();
    TextureRegionDrawable image =
            new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default"));
    infoBackground.setDrawable(image.tint(new Color(0, 0, 0, 0.6f)));
    infoBackground.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getWidth() / 20);
    stage.addActor(infoBackground);

    infoLabel = new Label("", skin);
    FreeTypeFontParameter fontParameter = new FreeTypeFontParameter();
    fontParameter.size = Gdx.graphics.getWidth() / 30;
    LabelStyle style = new LabelStyle();
    style.font = fontGenerator.generateFont(fontParameter);
    style.fontColor = Color.WHITE;
    infoLabel.setStyle(style);
    infoLabel.setWidth(Gdx.graphics.getWidth());
    stage.addActor(infoLabel);
}
项目:skin-composer    文件:MainListener.java   
@Override
public void stylePropertyChanged(StyleProperty styleProperty,
        Actor styleActor) {
    if (styleProperty.type == Drawable.class) {
        dialogFactory.showDialogDrawables(styleProperty);
    } else if (styleProperty.type == Color.class) {
        dialogFactory.showDialogColors(styleProperty);
    } else if (styleProperty.type == BitmapFont.class) {
        dialogFactory.showDialogFonts(styleProperty);
    } else if (styleProperty.type == Float.TYPE) {
        main.getUndoableManager().addUndoable(new UndoableManager.DoubleUndoable(main, styleProperty, ((Spinner) styleActor).getValue()), false);
    } else if (styleProperty.type == ScrollPaneStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == LabelStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == ListStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    }
}
项目:cachebox3.0    文件:Tooltips.java   
public void showTooltip(Actor actor) {
    Vector2 v = new Vector2();
    actor.localToStageCoordinates(v);
    if (tooltip == null) {
        LabelStyle style = new LabelStyle();
        style.font = tooltipStyle.font;
        style.background = tooltipStyle.background;
        style.fontColor = tooltipStyle.fontColor;
        tooltip = new Label(tooltips.get(actor), style);
        tooltip.setStyle(style);
        tooltip.pack();
        tooltip.setPosition(v.x + 7.5f, v.y - tooltip.getPrefHeight() - 15);

        tooltip.setOriginY(tooltip.getPrefHeight());
        tooltip.setColor(1, 1, 1, 0);
        tooltip.setScale(1, 0);
        tooltip.addAction(parallel(fadeIn(0.15f), scaleTo(1, 1, 0.15f)));
    } else {
        tooltip.setText(tooltips.get(actor));
        tooltip.pack();
        tooltip.setPosition(v.x + 7.5f, v.y - tooltip.getPrefHeight() - 15);
    }
    stage.addActor(tooltip);
}
项目:fabulae    文件:CompositeTooltip.java   
/**
 * Adds a new line of text to the tooltip.
 * 
 * This will create a new label, add it as new row
 * to the tooltip and then return it.
 * 
 * The created label will use the supplied style.
 * 
 * If the supplied text is empty or null, this will return null;
 * 
 * @param newText
 * @return
 */
public Label addLine(CharSequence newText, LabelStyle style) {
    if (newText == null || newText.length() < 1) {
        return null;
    }
    Label label = newLabel(newText, style);
    Cell<?> cell = add(label).prefWidth(this.style.width).fill().align(Align.left).padLeft(this.style.padLeft).padRight(this.style.padRight).padTop(getRows() == 0 ? this.style.padTop : 0).padBottom(this.style.padBottom);
    row();
    if (getRows() > 1) {
        getCells().get(getRows()-2).padBottom(0);
    }
    pack();
    cell.width(label.getGlyphLayout().width);
    invalidateHierarchy();
    this.pack();
    return label;
}
项目:DropTheCube-LD32    文件:BasicGUI.java   
public void init(){
    stage = new Stage(new ScreenViewport());
    Gdx.input.setInputProcessor(stage);

    mainTable = new Table();
    mainTable.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    stage.addActor(mainTable);

    font = new BitmapFont(Gdx.files.internal("font2.fnt"));

    blueTextButtonStyle = new TextButtonStyle();
    blueTextButtonStyle.up = TextureUtils.createDrawable(new Color(52f / 255f, 73f / 255f, 94f / 255f, 1.0f), 300, 75);
    blueTextButtonStyle.down = TextureUtils.createDrawable(new Color(44f / 255f, 62f / 255f, 80f / 255f, 1.0f), 300, 75);
    blueTextButtonStyle.over = TextureUtils.createDrawable(new Color(60f / 255f, 84f / 255f, 108f / 255f, 1.0f), 300, 75);
    blueTextButtonStyle.font = font;
    blueTextButtonStyle.fontColor = Color.BLACK;

    labelStyle = new LabelStyle();
    labelStyle.background = blueTextButtonStyle.up;
    labelStyle.font = font;
    labelStyle.fontColor = Color.WHITE;
}
项目:network-poker    文件:LoadScreen.java   
@Override
public void show() {
    //��ʼ
    float width = 800;
       float height = 480; 
    //��̨
       stage = new Stage(width, height,true);  
       //��Դ
       AssetManager manager = HjGame.getManager();
       HjGame.load(manager);
       //����
       bitmapFont = new BitmapFont();
       style = new LabelStyle(bitmapFont, bitmapFont.getColor()); 
       loadLabel=new Label("loading... 0%", style);
       loadLabel.setPosition(width/2-loadLabel.getWidth()/2, height/3);
       Image imageBg = new Image(new Texture(Gdx.files.internal("data/loading.png")));  
       imageBg.setPosition(width/2-imageBg.getWidth()/2, height/2-imageBg.getHeight()/2);
       stage.addActor(imageBg); 
       stage.addActor(loadLabel);


       Gdx.input.setInputProcessor(stage);
}
项目:OdysseeDesMaths    文件:MiniGameUI.java   
/**
 * Ajoute un timer à l'interface.
 *
 * @param aTimer Le Timer à utiliser
 */
public void addTimer(final Timer aTimer) {
    LabelStyle timerStyle = new LabelStyle();
    timerStyle.font = skin.getFont("timer");
    timerStyle.background = skin.getDrawable("frame_left");
    skin.add("timer", timerStyle);

    aTimer.addObserver(this);
    timerColorAction = new ColorAction();
    timerColorAction.setEndColor(Color.WHITE);
    timerColorAction.setDuration(0.5f);
    timerLabel = new Label(aTimer.toString(), skin, "timer");

    timerContainer.setActor(timerLabel);
    timerContainer.height(48);
}
项目:OdysseeDesMaths    文件:MiniGameUI.java   
/**
 * Ajoute des items actifs à l'interface.
 */
public void addItems() {
    skin.add("itemCounter", new LabelStyle(skin.getFont("itemCounter"), null));

    activeItems = new HashMap<Sprite, Integer>();
    itemsGroup = new Table();
    itemsGroup.addAction(new Action() {
        @Override
        public boolean act(float delta) {
            itemsGroup.clearChildren();

            for (Map.Entry<Sprite, Integer> entry : activeItems.entrySet()) {
                itemImage = new Image(entry.getKey());
                itemsGroup.add(itemImage).padRight(Gdx.graphics.getWidth() / 50);
                itemCounter = new Label(entry.getValue().toString(), skin, "itemCounter");
                itemsGroup.add(itemCounter).padRight(Gdx.graphics.getWidth() / 15);
            }

            return false;
        }
    });

    itemsContainer.setActor(itemsGroup);
}
项目:OdysseeDesMaths    文件:MenuPrincipal.java   
public MenuPrincipal(OdysseeDesMaths jeu) {
    this.jeu = jeu;

    this.currentState = State.NORMAL;
    this.viewport = new StretchViewport(WIDTH, HEIGHT);
    this.stage = new Stage(viewport);
    this.tableau = new Table();
    this.skin = new Skin();
    this.skin.addRegions(Assets.getManager().get(Assets.UI_MAIN, TextureAtlas.class));
    this.skin.addRegions(Assets.getManager().get(Assets.UI_ORANGE, TextureAtlas.class));
    this.skin.add("background", Assets.getManager().get(Assets.MAIN_MENU_BACKGROUND, Texture.class));

    //propriétés relatives à la police
    this.ftfp = new FreeTypeFontParameter();
    this.menuFont = new BitmapFont();
    this.fontButton = new BitmapFont();

    this.playButtonStyle = new TextButtonStyle();
    this.gameTitleStyle = new LabelStyle();
    this.audioButtons = new AudioButtons();

    this.createUI();
}
项目:Protoman-vs-Megaman    文件:GameMenuPage.java   
/**
 * adds an option to the menu page. Each menu page must have at least one option.
 * An option can either be enabled or disabled.
 * <br><br>
 * If it is disabled then it will be ignored for the {@link GameMenu#increaseSelection()} and {@link GameMenu#decreaseSelection()} calls and for the
 * {@link #getInitialOptionIndex()} method.
 * 
 * @param label         text of the option
 * @param enabled       <b>true</b> to enable the option. <b>false</b> to disable the option and to
 *                      exclude it from the increase-/decreaseSelection() and getInitialOptioinIndex() calls 
 * @param style         LabelStyle of the option taken from the skin
 * @param padTop        top padding of the option
 * @param padRight      right padding of the option
 * @param padBottom     bottom padding of the option
 * @param padLeft       left padding of the option
 */
public void addOption(String label, boolean enabled, LabelStyle style, int padTop, int padRight, int padBottom, int padLeft) {
    if (options == null) {
        // no options defined yet
        // --> initialize options and optionEnabled arrays
        options = new Array<Label>();
        optionEnabled = new Array<Boolean>();
    }

    // create a new label with the specified text and style
    Label lbl = null;
    if (style == null) {
        lbl = new Label(label, skin.get("default", LabelStyle.class));
    } else {
        lbl = new Label(label, style);
    }
    // add the new label to the options and optionEnabled arrays
    options.add(lbl);
    optionEnabled.add(enabled);
    // add the new option to the table instance with the specified padding
    // and also make a call to the row() method to finish one row of the table.
    // This means that only one label is displayed per row
    table.add(lbl).pad(padTop, padLeft, padBottom, padRight).row();
}
项目:Protoman-vs-Megaman    文件:VideoMenuPage.java   
@Override
public void initialize() {
    currentMode = Integer.parseInt(GameUtils.getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_WIDTH));

    availableResolutions43 = new TreeMap<Integer, Integer>();
    availableResolutions43.put(currentMode, Integer.parseInt(GameUtils.getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_HEIGHT)));

    DisplayMode[] displayModes = Gdx.graphics.getDisplayModes();
    // store all remaining 4:3 resolutions
    final double aspect43 = 4.0 / 3.0;
    for (DisplayMode mode : displayModes) {
        // get current game resolution mode
        double aspect = 1.0 * mode.width / mode.height;
        if (aspect == aspect43 && !availableResolutions43.containsKey(mode.width)) {
            availableResolutions43.put(mode.width, mode.height);
        }
    }

    boolean fullscreen = Boolean.parseBoolean(GameUtils.getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_FULLSCREEN));
    addOption(GameUtils.getLocalizedLabel("MainMenu.option.settings.video.fullscreen"), true, MegamanConstants.MENU_OFFSET_TOP, 0, 0, 0);
    addOption("" + fullscreen, false, skin.get("menu_suboption", LabelStyle.class), 0, 0, MegamanConstants.MENU_PADDING_BETWEEN_OPTIONS / 2, 0);
    addOption(GameUtils.getLocalizedLabel("MainMenu.option.settings.video.windowSize"), !fullscreen, !fullscreen ? skin.get("default", LabelStyle.class) : skin.get("menu_option_disabled", LabelStyle.class), 0, 0, 0, 0);
    addOption("" + currentMode + " x " + availableResolutions43.get(currentMode), false, skin.get("menu_suboption", LabelStyle.class), 0, 0, MegamanConstants.MENU_PADDING_BETWEEN_OPTIONS / 2, 0);
    addOption(GameUtils.getLocalizedLabel("MainMenu.option.back"), true, 0, 0, 0, 0);
}
项目:Protoman-vs-Megaman    文件:LanguageMenuPage.java   
@Override
public void initialize() {
    currentLocale = 0;
    availableLocales = new String[] { "de", "en" };
    String currentLanguage = GameUtils.getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_LANGUAGE);
    if (currentLanguage != null) {
        for (int i = 0; i < availableLocales.length; ++i) {
            if (currentLanguage.equals(availableLocales[i])) {
                currentLocale = i;
                break;
            }
        }
    }

    addOption(GameUtils.getLocalizedLabel("MainMenu.option.settings.language.changesinfo"), false, skin.get("menu_option_red", LabelStyle.class), MegamanConstants.MENU_OFFSET_TOP, 0, 30, 0);
    addOption(GameUtils.getLocalizedLabel("MainMenu.option.settings.language.language"), true, 30, 0, 10, 0);
    addOption(GameUtils.getLocalizedLabel("MainMenu.option.settings.language." + availableLocales[currentLocale]), false, skin.get("menu_suboption", LabelStyle.class), 0, 0, MegamanConstants.MENU_PADDING_BETWEEN_OPTIONS / 2, 0);
    addOption(GameUtils.getLocalizedLabel("MainMenu.option.back"), true, 30, 0, MegamanConstants.MENU_OFFSET_BOTTOM, 0);
}
项目:bomberman-libgdx    文件:HighScoresScreen.java   
private Table loadScores() {
    Table table = new Table();
    LabelStyle style = new LabelStyle(Assets.font, Color.WHITE);
    Skin skin = new Skin();
    skin.add("default", style, LabelStyle.class);
    List<Player> players = Settings.getScores();
    Collections.sort(players);
    for (int pos = 0; pos < 10 && pos < players.size(); pos++) {
        Label name = new Label(String.valueOf(pos+1) + ". " + players.get(pos).getPlayerName(), skin);
        Label score = new Label(String.valueOf(players.get(pos).getScore()), skin);
        table.add(name).pad(2).left();
        table.add(score).pad(2).right();
        table.row();
    }
    table.setFillParent(true);
    return table;
}
项目:libgdxcn    文件:ImageTextButton.java   
public ImageTextButton (String text, ImageTextButtonStyle style) {
    super(style);
    this.style = style;

    defaults().space(3);

    image = new Image();
    image.setScaling(Scaling.fit);
    add(image);

    label = new Label(text, new LabelStyle(style.font, style.fontColor));
    label.setAlignment(Align.center);
    add(label);

    setStyle(style);

    setSize(getPrefWidth(), getPrefHeight());
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
public <E> void addSelectBox(String label, E selected, E[] values, Consumer<E> lis) {
  LabelStyle style = skin.get(LabelStyle.class);
  Label l = new Label(label, style);
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  SelectBox<E> sb = new SelectBox<E>(skin.get(SelectBoxStyle.class));
  sb.setItems(values);
  sb.setSelected(selected);
  sb.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      lis.accept(sb.getSelected());
    }
  });
  Cell<SelectBox<E>> right = table.add(sb).minHeight(sb.getMinHeight()).prefHeight(sb.getMinHeight());
  if (nbColumns > 2)
    right.colspan(nbColumns - 1);

  table.row();
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
public void addBooleanSelectBox(String label, boolean selected, Consumer<Boolean> lis) {
  LabelStyle style = skin.get(LabelStyle.class);
  Label l = new Label(label, style);
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  SelectBox<Boolean> sb = new SelectBox<Boolean>(skin.get(SelectBoxStyle.class));
  sb.setItems(Boolean.TRUE, Boolean.FALSE);
  sb.setSelected(selected);
  sb.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      lis.accept(sb.getSelected());
    }
  });
  Cell<SelectBox<Boolean>> right = table.add(sb).minHeight(sb.getMinHeight()).prefHeight(sb.getMinHeight());
  if (nbColumns > 2)
    right.colspan(nbColumns - 1);

  table.row();
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
public void addButton(LabelStyle style, String label, String secondaryLabel, Runnable action, boolean active) {
  Button b = new Button(skin.get(ButtonStyle.class));
  if (action != null)
    b.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        action.run();
      }
    });
  b.setDisabled(!active);

  b.add(new Label(label, style)).left();
  if (secondaryLabel != null && !secondaryLabel.isEmpty())
    b.add(new Label(secondaryLabel, style)).padRight(15f);

  table.add(b).minHeight(b.getMinHeight()).prefHeight(b.getPrefHeight()).left().padLeft(1f).colspan(nbColumns);
  table.row();
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
/**
 * Adds a button to the menu, with an icon on the left and label on the right.
 */
public Button addButtonSprite(Drawable icon, String label, Runnable action, boolean active) {
  LabelStyle style = active ? skin.get(LabelStyle.class) : skin.get("inactive", LabelStyle.class);

  Button b = new Button(skin.get(ButtonStyle.class));
  if (action != null)
    b.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        action.run();
      }
    });
  b.setDisabled(!active);

  b.add(new Image(icon, Scaling.fit)).left();
  Label l = new Label(label, style);
  l.setWrap(true);
  b.add(l).padLeft(8).right().expandX().fillX();

  table.add(b).minHeight(b.getMinHeight()).prefHeight(b.getPrefHeight()).left().padLeft(1f).colspan(nbColumns);
  table.row();

  return b;
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
/** Adds a label followed by a sprite to the menu. */
public Label addLabelSprite(String label, TextureRegion region, Color color) {
  LabelStyle style = skin.get(LabelStyle.class);
  Label l = new Label(label, style);
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  Image i = new Image(region);
  i.setColor(color);
  i.setScaling(Scaling.fit);
  Cell<Image> right = table.add(i).minHeight(region.getRegionHeight()).prefHeight(region.getRegionHeight()).right();
  if (nbColumns > 2)
    right.colspan(nbColumns - 1);

  table.row();
  return l;
}
项目:HAW-SE2-projecthorse    文件:AchievmentPopup.java   
/**
 * Erzeugt die Elemente für den Namen und das Bild des Loots.
 * 
 * @param name
 *            Name des Loots
 * @param img
 *            Bild des Loots
 */
private void createLabelAndImg(final String name, final Drawable img) {
    Table table = new Table();
    table.setFillParent(true);
    table.left().top();
    table.setBackground(new TextureRegionDrawable(AssetManager
            .getTextureRegion("ui", "buttonBackground")));

    Image icon = new Image(img, Scaling.fit);
    table.add(icon).height(70).maxWidth(120).pad(15, 0, 15, 0);

    Label desc = new Label(name, new LabelStyle(
            AssetManager.getTextFont(FontSize.FORTY), Color.DARK_GRAY));
    desc.setEllipse(true);
    table.add(desc).expandX().left();

    addActor(table);
}
项目:tafl    文件:AboutScreen.java   
private void createInfo(Table table, LabelStyle titleStyle, LabelStyle style) {
    String text = game.localeService.get(LocalizedStrings.MainMenu.GAME_TITLE);
    Label label = new Label(text, titleStyle);
    table.add(label).spaceBottom(game.deviceSettings.menuSpacing / 8);
    table.row();

    text = game.localeService.get(LocalizedStrings.AboutInfo.ABOUT_VERSION);
    label = new Label(text, style);
    table.add(label).spaceBottom(game.deviceSettings.menuSpacing / 8);
    table.row();

    text = game.localeService.get(LocalizedStrings.AboutInfo.ABOUT_COPYRIGHT);
    label = new Label(text, style);
    table.add(label).spaceBottom(game.deviceSettings.menuSpacing / 8);
    table.row();

    text = game.localeService.get(LocalizedStrings.AboutInfo.ABOUT_RIGHTS_RESERVED);
    label = new Label(text, style);
    table.add(label).spaceBottom(game.deviceSettings.menuSpacing);
    table.row();
}
项目:gaiasky    文件:Text2D.java   
@Override
public void notify(Events event, Object... data) {
    switch (event) {
    case UI_THEME_RELOAD_INFO:
        Skin skin = (Skin) data[0];
        // Get new theme color and put it in the label colour
        LabelStyle headerStyle = skin.get("header", LabelStyle.class);
        labelColour[0] = headerStyle.fontColor.r;
        labelColour[1] = headerStyle.fontColor.g;
        labelColour[2] = headerStyle.fontColor.b;
        break;
    default:
        break;
    }

}
项目:PongWithLibgdx    文件:LoadingScreen.java   
public LoadingScreen(PongForAndroid game) {
    this.game = game;
    setupAssetManager();
    Skin skin = new Skin(Gdx.files.internal("uiskin.json"));
    stage = new Stage();
    table = new Table();
    table.setFillParent(true);
    BitmapFont loadingFont = getLoadingFont();
    LabelStyle loadingStyle = new LabelStyle(loadingFont, Color.WHITE);
    Label loadLabel = new Label("Loading...", loadingStyle);

    progressBar = new ProgressBar(0, 100, 1, false, skin);
    progressBar.setAnimateDuration(1f);
    progressBar.setAnimateInterpolation(Interpolation.sine);
    table.add(loadLabel);
    table.row();
    table.add(progressBar).left();

    stage.addActor(table);

}
项目:vis-editor    文件:VisImageTextButton.java   
private void init (String text) {
    defaults().space(3);

    image = new Image();
    image.setScaling(Scaling.fit);
    add(image);

    label = new Label(text, new LabelStyle(style.font, style.fontColor));
    label.setAlignment(Align.center);
    add(label);

    setStyle(style);

    setSize(getPrefWidth(), getPrefHeight());

    addListener(new InputListener() {
        @Override
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisImageTextButton.this);
            return false;
        }
    });
}
项目:plox    文件:ProtectorPowerUp.java   
@Override
public void onCollect(PowerUp powerup, GameContext context) {

    Player player = context.getPlayer();

    int size = Gdx.graphics.getWidth() / 50;
    final int PADDING = 30;

    float pointer = player.getHeight() / 2f + PADDING - size / 2;
    float angle = (float) (Math.random() * 360f);

    float x = (float) (player.getCenterX() + Math.cos(Math.toRadians(angle)) * pointer);
    float y = (float) (player.getCenterY() + Math.sin(Math.toRadians(angle)) * pointer);

    GameObject shot = factory.createShot(x, y, size, protectorDamage, new OrbitStrategy(player, angle, pointer), true);
    context.add(shot);

    PopupManager popupManager = context.getPopupManager();      
    LabelStyle style = new LabelStyle();
    style.font = Resources.get(Resources.BITMAP_FONT_REGULAR, BitmapFont.class);
    style.fontColor = new Color(0.0f, 0.2f, 1f, 1f);
    popupManager.popup(powerup.getCenterX(), powerup.getCenterY(), "Protector", style);
}
项目:plox    文件:IndestructablePowerUp.java   
private void animate(final GameObject o, final PopupManager manager) {
    o.getColor().a = 0.7f;
    tweenManager.killTarget(o);
    Tween.to(o, GameObjectTween.ALPHA, 0.4f).target(0.2f)
            .ease(TweenEquations.easeInOutQuad)
            .setCallback(new TweenCallback() {

                @Override
                public void onEvent(int type, BaseTween<?> source) {
                    if (o.isIndestructable()) {
                        animate(o, manager);
                    } else {
                        o.getColor().a = 1f;
                        LabelStyle style = new LabelStyle();
                        style.font = Resources.get(Resources.BITMAP_FONT_REGULAR, BitmapFont.class);
                        style.fontColor = new Color(0.6f, 0.0f, 1f, 1f);
                        manager.popup(o.getCenterX(), o.getCenterY(), "Immortality (expired)", style);
                    }
                }

            }).setCallbackTriggers(TweenCallback.COMPLETE).repeatYoyo(1, 0)
            .start(tweenManager);

}
项目:plox    文件:PopupManager.java   
public void popup(float x, float y, String text, LabelStyle popupStyle) {
        Label label = new Label(text, popupStyle);
        stage.addActor(label);
        label.setPosition(x - label.getWidth() / 2f, Gdx.graphics.getHeight() - y - label.getHeight() / 2f);

        Tween.to(label, ActorTween.ALPHA, duration)
         .target(0f)
        .ease(TweenEquations.easeInOutQuad)
        .setCallback(this)
        .setCallbackTriggers(TweenCallback.COMPLETE)
        .start(tweenManager);
        Tween.to(label, ActorTween.POPUP, duration)
         .target(y - MOVING_DISTANCE)
        .ease(TweenEquations.easeInOutQuad)
        .start(tweenManager);
        queue.add(label);
}
项目:plox    文件:MenuScreen.java   
@Override
public void resize(int width, int height) {
    if (stage != null) {
        stage.setViewport(width, height);
    } else {
        stage = new MenuControls(width, height, false, game);
        LabelStyle style = new LabelStyle();
        style.font = Resources.get(Resources.BITMAP_FONT_REGULAR, BitmapFont.class);
        style.fontColor = Color.WHITE;
        Label text = new Label("Touch to start", style);
        text.setX(width / 2 - text.getWidth() / 2);
        text.setY(height / 5);
        stage.addActor(text);
        animateLabel(text);
        showGoogleButtons();
        Gdx.input.setInputProcessor(stage);
        Gdx.input.setCatchBackKey(true);
    }
}
项目:craft    文件:CommandLineInterface.java   
private boolean initialize() {
  if (SharedAssetManager.isLoaded(Assets.TEX_PANEL_TRANSPARENT_9patch)
      && SharedAssetManager.isLoaded(Assets.FNT_MONO) && Styles.TXT_COMMANDLINE != null
      && Styles.TXT_COMMANDLINE.font != null) {
    setBackground(new NinePatchDrawable(GraphicsFactory.createNinePatch(Assets.TEX_PANEL_TRANSPARENT_9patch,
        Sizes.panelTransparentRadius())));
    textField = new TextField("", Styles.TXT_COMMANDLINE);
    textField.setWidth(getWidth());
    LabelStyle consoleStyle = new LabelStyle();
    consoleStyle.font = SharedAssetManager.get(Assets.FNT_MONO, BitmapFont.class);
    consoleStyle.fontColor = Color.GRAY;
    add(new Label("$ ", consoleStyle));
    add(textField).width(getWidth());
    setY(Sizes.worldHeight() - textField.getHeight());
    setHeight(textField.getHeight());
    return true;
  } else {
    return false;
  }
}
项目:gdx-ai    文件:ParallelVsSequenceTest.java   
@Override
public Actor createActor (final Skin skin) {
    Table table = new Table();

    LabelStyle labelStyle = new LabelStyle(skin.get(LabelStyle.class));
    labelStyle.background = skin.newDrawable("white", .6f, .6f, .6f, 1);
    String branchChildren = "\n    selectTarget\n    pursue";
    table.add(new Label("parallel policy:\"sequence\" orchestrator:\"resume\"" + branchChildren, labelStyle)).pad(5);
    table.add(new Label("vs", skin)).padLeft(10).padRight(10);
    table.add(new Label("sequence" + branchChildren, labelStyle)).pad(5);

    table.row().padTop(15);

    TextButton startButton = new TextButton("Start", skin);
    startButton.addListener(new ChangeListener() {
        @Override
        public void changed (ChangeEvent event, Actor actor) {
            oldScreen = container.getScreen();
            container.setScreen(new TestScreen(ParallelVsSequenceTest.this, skin));
        }
    });
    table.add();
    table.add(startButton);
    table.add();
    return table;
}
项目:gdx-ai    文件:ResumeVsJoinTest.java   
@Override
public Actor createActor (final Skin skin) {
    Table table = new Table();

    LabelStyle labelStyle = new LabelStyle(skin.get(LabelStyle.class));
    labelStyle.background = skin.newDrawable("white", .6f, .6f, .6f, 1);
    String branchChildren = "\n    spinAround\n    selectTarget\n    pursue";
    table.add(new Label("parallel policy:\"sequence\" orchestrator:\"resume\"" + branchChildren, labelStyle)).pad(5);
    table.add(new Label("vs", skin)).padLeft(10).padRight(10);
    table.add(new Label("parallel policy:\"sequence\" orchestrator:\"join\"" + branchChildren, labelStyle)).pad(5);

    table.row().padTop(15);

    TextButton startButton = new TextButton("Start", skin);
    startButton.addListener(new ChangeListener() {
        @Override
        public void changed (ChangeEvent event, Actor actor) {
            oldScreen = container.getScreen();
            container.setScreen(new TestScreen(ResumeVsJoinTest.this, skin));
        }
    });
    table.add();
    table.add(startButton);
    table.add();
    return table;
}
项目:gdx-skineditor    文件:Tooltips.java   
public void showTooltip(Actor actor) {
    Vector2 v = new Vector2();
    actor.localToStageCoordinates(v);
    if (tooltip == null) {
        LabelStyle style = new LabelStyle();
        style.font = tooltipStyle.font;
        style.background = tooltipStyle.background;
        style.fontColor = tooltipStyle.fontColor;
        tooltip = new Label(tooltips.get(actor), style);
        tooltip.setStyle(style);
        tooltip.pack();
        tooltip.setPosition(v.x+7.5f, v.y - tooltip.getPrefHeight() - 15);

        tooltip.setOriginY(tooltip.getPrefHeight());
        tooltip.setColor(1, 1, 1, 0);
        tooltip.setScale(1,0);
        tooltip.addAction(parallel(fadeIn(0.15f), scaleTo(1, 1, 0.15f)));
    } else {
        tooltip.setText(tooltips.get(actor));
        tooltip.pack();
        tooltip.setPosition(v.x+7.5f, v.y - tooltip.getPrefHeight() - 15);
    }
    stage.addActor(tooltip);
}
项目:c2d-engine    文件:GracefulEffectLabel.java   
public void show(boolean isBoss, String text) {
    this.clear();
    if (isBoss) {
        String[] strs = text.split("");
        float width = 0;
        for (int i = 0; i < strs.length; i++) {
            String s = strs[i];
            Label temp = new Label(s, new LabelStyle(Engine.resource("Font", BitmapFont.class), Color.WHITE));
            temp.setPosition(width, 400);
            temp.addAction(Actions.delay(0.1f * i, Actions.sequence(Actions.moveBy(0, -300, 0.5f, Interpolation.swingOut), Actions.delay(1f, Actions.moveBy(0, 300, 0.3f)))));
            this.addActor(temp);
            width += temp.getPrefWidth();
        }
        this.setPosition(Engine.getWidth() / 2 - width / 2, 100);
    } else {
        Label battleLabel = new Label(text, new LabelStyle(Engine.resource("Font", BitmapFont.class), Color.WHITE));
        this.setSize(battleLabel.getPrefWidth(), battleLabel.getPrefHeight());
        this.setPosition(Engine.getWidth() / 2 - battleLabel.getPrefWidth() / 2, 200);
        this.setOrigin(this.getWidth() / 2, this.getHeight() / 2);
        this.setScale(0);
        this.addAction(sequence(scaleTo(1, 1, 1f, Interpolation.swingOut), delay(1f), Actions.moveBy(50, 0, 0.1f), Actions.moveBy(-1500, 0, 0.3f)));
        this.addActor(battleLabel);
    }
}
项目:geometri-destroyer    文件:IngameStage.java   
public IngameStage(final Core core, World world, GeometriDestroyer geometriDestroyer) {
    this.world = world;
    this.geometriDestroyer = geometriDestroyer;

    setViewport(Constants.STAGE_WIDTH, Constants.STAGE_HEIGHT, false);

    LabelStyle style = new LabelStyle();
    style.font = FontManager.getNormalFont();
    style.fontColor = new Color(0, 0, 0, 1);
    objectCounter = new Label("Total Number Of Objects: " + (world.getBodyCount() - 1) + "\nObject left To Destroy: " + geometriDestroyer.boxesLeft, style);
    objectCounter.setPosition(20, Constants.STAGE_HEIGHT - 120);
    addActor(objectCounter);

    gameOverMenu = new GameOverMenu(core);
    gameOverMenu.setVisible(false);
    addActor(gameOverMenu);

    victoryMenu = new VictoryMenu(core);
    victoryMenu.setVisible(false);
    addActor(victoryMenu);

    pauseMenu = new PauseMenu(core);
    pauseMenu.setVisible(false);
    addActor(pauseMenu);
}
项目:geometri-destroyer    文件:Credits.java   
public Credits(final Core core, InputMultiplexer inputMultiplexer) {
    this.core = core;
    stage = new Stage();
    stage.setViewport(Constants.STAGE_WIDTH, Constants.STAGE_HEIGHT, false);

    inputMultiplexer.addProcessor(this);

    Image ogam = new Image(new TextureRegionDrawable(SpriteManager.getSprite(SpriteManager.Sprites.OGAM)));
    ogam.setPosition((Constants.STAGE_WIDTH - ogam.getWidth()) / 2, 440);
    stage.addActor(ogam);

    LabelStyle style = new LabelStyle();
    style.font = FontManager.getNormalFont();
    style.fontColor = new Color(1, 1, 1, 1);
    Label title = new Label("     Geometri Destroyer was created during\n      February 2013 for One Game A Month.\n\n\n\nProgramming, graphics: Daniel \"MaTachi\" Jonsson,\n                       http://danielj.se\nLibraries: LibGDX and Box2D\nFont: GNUTypewriter, SIL OFL\nMusic: Szymon Matuszewski - Fallen, CC-BY 3.0\nSoftware used: Eclipse, GIMP and\n               Inkscape on Ubuntu", style);
    title.setPosition(50, 10);
    stage.addActor(title);
}
项目:ead    文件:LabelProcessor.java   
@Override
public Component getComponent(Label component) {
    Skin skin = gameAssets.getSkin();
    LabelComponent label = gameLoop.createComponent(LabelComponent.class);
    label.setVariablesManager(variablesManager);

    LabelStyle style = skin.get(component.getStyle(), LabelStyle.class);
    LabelStyle styleCopy = new LabelStyle(style);
    Color color = component.getColor();
    if (color != null) {
        styleCopy.fontColor.set(color.getR(), color.getG(), color.getB(),
                color.getA());
    }
    label.setControl(new com.badlogic.gdx.scenes.scene2d.ui.Label("",
            styleCopy));
    label.getControl().setAlignment(Align.center);
    label.setText(gameAssets.getI18N().m(component.getText()));

    I18nTextComponent textComponent = gameLoop
            .createComponent(I18nTextComponent.class);
    textComponent.setI18nKey(component.getText());
    textComponent.setTextSetter(label);
    return new MultiComponent(label, textComponent);
}