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

项目:enklave    文件:ProgressBarEnergy.java   
public void updateVisual(){
    Skin skin = new Skin();
    Pixmap pixmap = new Pixmap(1,(int)(Gdx.graphics.getHeight()*0.0175), Pixmap.Format.RGBA8888);
    switch (infoProfile.getDateUserGame().getFaction()){
        case 1:{
            pixmap.setColor(1, 0f, 0f, 1);
            break;
        }
        case 2:{
            pixmap.setColor(0f, 0.831f, 0.969f,1f);
            break;
        }
        case 3:{
            pixmap.setColor(0.129f, 0.996f, 0.29f,1);
            break;
        }
    }
    pixmap.fill();
    skin.add("blue", new Texture(pixmap));
    ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(bar.getStyle().background,skin.newDrawable("blue",Color.WHITE));
    style.knobBefore = style.knob;
    bar.setStyle(style);
}
项目:MMORPG_Prototype    文件:HitPointManaPointDialog.java   
public HitPointManaPointDialog(UserCharacterDataPacket character)
{

    super(character.getNickname(), Settings.DEFAULT_SKIN);
    this.linkedData = character;
    hitPoints = new ProgressBar(0, CharacterStatsCalculator.getMaxHP(character), 1.0f, false, Settings.DEFAULT_SKIN);
    hitPoints.setColor(new Color(1.0f, 0.2f, 0.2f, 0.9f));
    manaPoints = new ProgressBar(0, CharacterStatsCalculator.getMaxMP(character), 1.0f, false, Settings.DEFAULT_SKIN);
    manaPoints.setColor(new Color(0.2f, 0.2f, 1.0f, 0.9f));

    this.getContentTable().row();
    text("HP: ");
    this.getContentTable().add(hitPoints).top().right();
    this.getContentTable().row();
    text("MP: ");
    this.getContentTable().add(manaPoints).top().right();
    update();
}
项目:bobbybird    文件:LoadingState.java   
@Override
public void start() {
    finishedLoading = false;

    stage = new Stage(new ScreenViewport());

    skin = createSkin();

    Image image= new Image(skin, "bg");
    image.setScaling(Scaling.stretch);
    image.setFillParent(true);
    stage.addActor(image);

    root = new Table();
    root.setFillParent(true);
    stage.addActor(root);

    progressBar = new ProgressBar(0, 1, .01f, false, skin);
    progressBar.setAnimateDuration(.1f);
    root.add(progressBar).growX().expandY().pad(20.0f);
}
项目:arcadelegends-gg    文件:DefaultLoadingScreen.java   
public void show() {
    if (!init) {
        loadingScreenAssets = new Assets.LoadingScreenAssets();
        AL.getAssetManager().loadAssetFields(loadingScreenAssets);
        AL.getAssetManager().finishLoading();
        font = new BitmapFont();
        batch = new SpriteBatch();

        cam = new OrthographicCamera();
        viewport = new FitViewport(1920, 1080);
        viewport.setCamera(cam);
        stage = new Stage(viewport);
        stage.setViewport(viewport);
        skin = loadingScreenAssets.styles_json;

        loadingScreenBar = new ProgressBar(0, 100, 1, false, skin);
        loadingScreenBar.setPosition(25, -10);
        loadingScreenBar.setSize(1890, 50);

        stage.addActor(loadingScreenBar);
    }
    init = true;
}
项目:GangsterSquirrel    文件:MenuScreen.java   
public MenuScreen(MainGameClass game) {
    this.game = game;

    stage = new Stage(new ScreenViewport());
    Gdx.input.setInputProcessor(stage);

    skin = new Skin(Gdx.files.internal("skins/Flat_Earth_UI_Skin/flatearthui/flat-earth-ui.json"));

    progressBarStyle = skin.get("fancy", ProgressBar.ProgressBarStyle.class);
    TiledDrawable tiledDrawable = skin.getTiledDrawable("slider-fancy-knob").tint(skin.getColor("selection"));
    tiledDrawable.setMinWidth(0);
    progressBarStyle.knobBefore = tiledDrawable;

    sliderStyle = skin.get("fancy", Slider.SliderStyle.class);
    sliderStyle.knobBefore = tiledDrawable;

    layoutTable = new Table();
    layoutTable.top();
    layoutTable.setFillParent(true);
    layoutTable.pad(getPixelSizeFromDensityIndependentPixels(50));
}
项目:GDefence    文件:LoadingStage.java   
public LoadingStage() {
        GDefence.getInstance().assetLoader.load("MainMenuBg.png", Texture.class);//TODO
        GDefence.getInstance().assetLoader.load("mobHpBarBg.png", Texture.class);
        GDefence.getInstance().assetLoader.load("mobHpBarKnob.png", Texture.class);
//        I18NBundleLoader.I18NBundleParameter param = new I18NBundleLoader.I18NBundleParameter(/*new Locale("ru")*/Locale.US, "UTF-8");//TODO move to another place
//        GDefence.getInstance().assetLoader.load("Language/text", I18NBundle.class, param);
//        GDefence.getInstance().assetLoader.finishLoading();
        GDefence.getInstance().assetLoader.initLang("en");


        Image bg = new Image(GDefence.getInstance().assetLoader.get("MainMenuBg.png", Texture.class));
        addActor(bg);
        loadBar = new ProgressBar(0, 100, 1, false, GDefence.getInstance().assetLoader.getMobHpBarStyle());
        loadBar.setSize(300, 50);
        loadBar.getStyle().background.setMinHeight(loadBar.getHeight());
        loadBar.getStyle().knob.setMinHeight(loadBar.getHeight());
        loadBar.setPosition(Gdx.graphics.getWidth()/2 - loadBar.getWidth()/2, Gdx.graphics.getHeight()/2 - loadBar.getHeight()/2);
        addActor(loadBar);
        I18NBundle b = GDefence.getInstance().assetLoader.get("Language/text", I18NBundle.class);
        Label loading = new Label(b.get("loading"), FontLoader.generateStyle(34, Color.BLACK));//
        loading.setPosition(loadBar.getX() + loadBar.getWidth()/2 - loading.getWidth()/2,
                            loadBar.getY() - loadBar.getHeight());
        addActor(loading);
    }
项目:GDefence    文件:Mob.java   
protected void setHealth(int health) {
        this.maxHealth = health;
        this.health = health;
        hpBar = new ProgressBar(0, getHealth(), 1, false, GDefence.getInstance().assetLoader.getMobHpBarStyle()/*GDefence.getInstance().assetLoader.getSkin(), "health-bar2"*/);
//        hpBar.getStyle().knob = hpBar.getStyle().knobBefore;

        hpBar.getStyle().background.setMinWidth(getWidth());
        hpBar.getStyle().knobBefore.setMinWidth(getWidth() - 2);
//        hpBar.getStyle().background.setMinHeight(getHeight()/5);//.setSize(getWidth(), getHeight()/5);
//        hpBar.getStyle().knobBefore.setMinHeight(getHeight()/5);

//        hpBar.getStyle().background.setMinHeight(10);
//        hpBar.getStyle().knobBefore.setMinHeight(10 - 2);
////        hpBar.setPosition(getX(), getY());
//        //setPosition(Gdx.graphics.getWidth() - expBarSize[0], userlevelButton.getY() - expBarSize[1] - 4);
////        hpBar.setSize(width, height);
//        hpBar.setValue(getHealth());
//        hpBar.setAnimateDuration(0.5f);
//        hpBar.pack();
//        hpBar.
    }
项目:Roguelike    文件:LoadingScreen.java   
private void create()
{
    skin = Global.loadSkin();

    stage = new Stage( new ScreenViewport() );
    batch = new SpriteBatch();

    Table table = new Table();

    label = new Label( "Loading", skin, "title" );
    progressBar = new ProgressBar( 0, 100, 1, false, skin );

    table.add( progressBar ).expand().fillX().bottom().pad( 20 );
    table.row();
    table.add( label ).expand().top().pad( 20 );

    table.setFillParent( true );
    stage.addActor( table );
}
项目:Alien-Ark    文件:RocketMainTable.java   
public RocketMainTable(Skin skin) {
    setSkin(skin);

    shieldLabel = new Label("", skin);
    add(shieldLabel);
    shieldBar = new ProgressBar(0, 100, 0.1f, false, getSkin());
    add(shieldBar);

    row();
    fuelLabel = new Label("", skin);
    add(fuelLabel);
    fuelBar = new ProgressBar(0, 100, 0.1f, false, getSkin());
    add(fuelBar);

    pack();
}
项目:gdx-lml    文件:OnCompleteLmlAtrribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final ProgressBar actor,
        final String rawAttributeData) {
    final ActorConsumer<?, ProgressBar> action = parser.parseAction(rawAttributeData, actor);
    if (action == null) {
        parser.throwErrorIfStrict(
                "Unable to attach listener for " + actor + " with invalid action ID: " + rawAttributeData);
        return;
    }
    actor.addListener(new ChangeListener() {
        @Override
        public void changed(final ChangeEvent event, final Actor widget) {
            if (actor.getValue() >= actor.getMaxValue()) {
                final Object result = action.consume(actor);
                if (result instanceof Boolean && ((Boolean) result).booleanValue()) {
                    actor.removeListener(this);
                }
            }
        }
    });
}
项目: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    文件:TestVertical.java   
private void addNormalWidgets () {
    ProgressBar progressbar = new ProgressBar(0, 100, 1, true, VisUI.getSkin());
    Slider slider = new Slider(0, 100, 1, true, VisUI.getSkin());
    Slider sliderDisabled = new Slider(0, 100, 1, true, VisUI.getSkin());

    progressbar.setValue(50);
    slider.setValue(50);
    sliderDisabled.setValue(50);
    sliderDisabled.setDisabled(true);

    VisTable progressbarTable = new VisTable(true);
    progressbarTable.add(progressbar);
    progressbarTable.add(slider);
    progressbarTable.add(sliderDisabled);

    add(progressbarTable);
}
项目:GDefence    文件:EnegryBar.java   
public EnegryBar(int width, int height, int x, int y) {
    energyBar = new ProgressBar(0, LevelMap.getLevel().getMaxEnergy(), 0.5f, true, /*GDefence.getInstance().assetLoader.getEnergyBarSkin()*/ GDefence.getInstance().assetLoader.getSkin(), "energy-bar");
    energyBar.getStyle().background.setMinWidth(width);
    energyBar.getStyle().knobBefore.setMinWidth(width - 2);
    energyBar.setPosition(x, y);
    //setPosition(Gdx.graphics.getWidth() - expBarSize[0], userlevelButton.getY() - expBarSize[1] - 4);
    energyBar.setSize(width, height);
    energyBar.setValue(LevelMap.getLevel().getEnergyNumber());
    energyBar.setAnimateDuration(0.5f);
    addActor(energyBar);
    initLabel();
}
项目:GDefence    文件:TowerTooltip.java   
public void init(){
        getTitleLabel().setText(tower.getTowerPrototype().getName());

        info = new Label("", skin, "description");
        info.getStyle().font.getData().markupEnabled = true;
        level = new Label("", skin, "description");

        levelString = GDefence.getInstance().assetLoader.getWord("level") + " ";
        levelNum = tower.getTowerPrototype().getLevel();

        final float width = getWidth();
        expBar = new ProgressBar(0, tower.getTowerPrototype().exp2nextLevel()[tower.getTowerPrototype().getLevel() - 1], 0.2f, false,
                GDefence.getInstance().assetLoader.getExpBarSkin()) {
            @Override
            public float getPrefWidth() {
                return width - 10;
            }
        };//add text inside
        expBar.getStyle().background.setMinHeight(20);
        expBar.getStyle().knob.setMinHeight(20);
//        expBar.getStyle().background.setMinWidth(width - 10);
        expBar.getStyle().knob.setMinWidth(0.1f);
//                expBar.setSize(80, 20);//dont work first argument
        expBar.setValue(tower.getTowerPrototype().getCurrentExp());


        add(info).row();
        add(level).align(Align.center).row();
        add(expBar).align(Align.center);


        hasChanged();

        pack();

        tower.getStage().addActor(this);

        setVisible(false);
    }
项目:fabulae    文件:ProgressDialog.java   
public ProgressDialog(ProgressDialogStyle style) {
    super(style);
    current = new Label("", style.textStyle);
    progressBar = new ProgressBar(0, 1, 1, false, style.progressBarStyle);
    progressBar.setHeight(style.barHeight);
    progressBar.setAnimateDuration(0.1f);
    textLabel = new Label("", style.textStyle);
}
项目:gdx-texture-packer-gui    文件:PackDialogController.java   
@Override
public void onProcessingFinished() {
    btnClose.setDisabled(false);
    btnClose.setColor(Color.WHITE);

    FocusManager.switchFocus(stage, btnClose);

    window.closeOnEscape();

    if (!errors && cbAutoClose.isChecked()) {
        window.hide();
        showReopenLastDialogNotification();
    }

    // If there is only one pack, show log on error
    if (errors && adapter.size() == 1) {
        adapter.getView(adapter.get(0)).showLogWindow();
    }

    // Indicate total result by changing progress bar color
    {
        ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(progressBar.getStyle());
        Drawable fill = errors ?
                VisUI.getSkin().getDrawable("progressBarErr") :
                VisUI.getSkin().getDrawable("progressBarSucc");
        style.knob = fill;
        style.knobBefore = fill;
        progressBar.setStyle(style);
    }
}
项目:gdx-lml    文件:ProgressBarLmlTag.java   
@Override
protected Actor getNewInstanceOfActor(final LmlActorBuilder builder) {
    final FloatRangeLmlActorBuilder rangeBuilder = (FloatRangeLmlActorBuilder) builder;
    rangeBuilder.validateRange(getParser());
    final ProgressBar actor = getNewInstanceOfProgressBar(rangeBuilder);
    actor.setValue(rangeBuilder.getValue());
    return actor;
}
项目:Cubes_2    文件:WorldLoadingMenu.java   
public WorldLoadingMenu() {
  super(Localization.get("menu.general.loading"), false);

  progressBar = new ProgressBar(0f, 1f, 0.001f, false, PROGRESS_BAR_STYLE);
  stage.addActor(progressBar);
}
项目:enklave    文件:DrawAttachers.java   
private Group DrawOneAttachers(String typeFrame, String name, Color type, String photo, float energy,float energymax) {
    Group gr = new Group();
    Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
    Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
    final Image frame = new Image(new TextureRegion(txt));
    frame.setName("frame");
    frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frame.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    gr.addActor(frame);
    if(InformationProfile.getInstance().getDateUserGame().getFaction() != InformationEnklave.getInstance().getFaction())
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
    else
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image frameselect = new Image(new TextureRegion(txt));
    frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frameselect.setName("frameselect");
    frameselect.toFront();
    frameselect.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    frameselect.setVisible(false);
    gr.addActor(frameselect);
    Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()), new Label.LabelStyle(bt, type));
    labelName.setAlignment(Align.center);
    labelName.setWidth(crop.x*0.18f);
    labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
    gr.addActor(labelName);
    txt = managerAssets.getAssetsCombat().getTexture(photo);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image profile = new Image(new TextureRegion(txt));
    profile.setColor(type);
    profile.setSize(crop.x * 0.07f, crop.y * 0.07f);
    profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
    gr.addActor(profile);
    Skin skin = new Skin();
    skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite), 0, 0, (int) (WIDTH * 0.014), (int) (WIDTH * 0.014)));
    ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white", type));
    barStyle.knobBefore = barStyle.knob;
    ProgressBar bar = new ProgressBar(0,energymax, 1, false, barStyle);
    bar.setSize(WIDTH * 0.14f,HEIGHT * 0.012f);
    bar.setPosition(frame.getX() + frame.getWidth() * 0.07f, frame.getY() + frame.getHeight() * 0.07f);
    bar.setValue(energy);
    gr.addActor(bar);
    return gr;
}
项目:enklave    文件:DrawDefenders.java   
private Group drawoneDefenders(String typeFrame,String name,Color type,String photo,float energy,float energymax){
        Group gr = new Group();
        Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
        Vector2 crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frame = new Image(new TextureRegion(txt));
        frame.setName("frame");
        frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frame.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        gr.addActor(frame);
        if(InformationProfile.getInstance().getDateUserGame().getFaction() == InformationEnklave.getInstance().getFaction())
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
        else
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frameselect = new Image(new TextureRegion(txt));
        frameselect.setName("frameselect");
        frameselect.toFront();
        frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frameselect.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        frameselect.setVisible(false);
        gr.addActor(frameselect);
        Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()),new Label.LabelStyle(bt,type));
        labelName.setAlignment(Align.center);
        labelName.setSize(WIDTH * 0.18f, HEIGHT * 0.02f);
        labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
        gr.addActor(labelName);
        txt = managerAssets.getAssetsCombat().getTexture(photo);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image profile = new Image(new TextureRegion(txt));
//        profile.setColor(Color.BLUE);
        profile.setSize(crop.x*0.07f, crop.y*0.07f);
        profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
        gr.addActor(profile);
        Skin skin = new Skin();
        skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite),0,0,(int)(WIDTH*0.004),(int)(WIDTH*0.014)));
        ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white",type));
        barStyle.knobBefore = barStyle.knob;
        ProgressBar bar = new ProgressBar(0, energymax, 1, false, barStyle);
        bar.setSize(WIDTH * 0.14f, HEIGHT * 0.012f);
        bar.setPosition(frame.getX()+frame.getWidth()*0.1f, frame.getY()+frame.getHeight()*0.07f);
        bar.setValue(energy);
        gr.addActor(bar);
        return gr;
    }
项目:Cubes    文件:WorldLoadingMenu.java   
public WorldLoadingMenu() {
  super(Localization.get("menu.general.loading"), false);

  progressBar = new ProgressBar(0f, 1f, 0.001f, false, PROGRESS_BAR_STYLE);
  stage.addActor(progressBar);
}
项目:skin-composer    文件:StyleData.java   
public void resetProperties() {
    properties.clear();

    if (clazz.equals(Button.class)) {
        newStyleProperties(ButtonStyle.class);
    } else if (clazz.equals(CheckBox.class)) {
        newStyleProperties(CheckBoxStyle.class);
        properties.get("checkboxOn").optional = false;
        properties.get("checkboxOff").optional = false;
        properties.get("font").optional = false;
    } else if (clazz.equals(ImageButton.class)) {
        newStyleProperties(ImageButtonStyle.class);
    } else if (clazz.equals(ImageTextButton.class)) {
        newStyleProperties(ImageTextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(Label.class)) {
        newStyleProperties(LabelStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(List.class)) {
        newStyleProperties(ListStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColorSelected").optional = false;
        properties.get("fontColorUnselected").optional = false;
        properties.get("selection").optional = false;
    } else if (clazz.equals(ProgressBar.class)) {
        newStyleProperties(ProgressBarStyle.class);

        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(ScrollPane.class)) {
        newStyleProperties(ScrollPaneStyle.class);
    } else if (clazz.equals(SelectBox.class)) {
        newStyleProperties(SelectBoxStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
        properties.get("scrollStyle").optional = false;
        properties.get("scrollStyle").value = "default";
        properties.get("listStyle").optional = false;
        properties.get("listStyle").value = "default";
    } else if (clazz.equals(Slider.class)) {
        newStyleProperties(SliderStyle.class);

        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(SplitPane.class)) {
        newStyleProperties(SplitPaneStyle.class);
        properties.get("handle").optional = false;
    } else if (clazz.equals(TextButton.class)) {
        newStyleProperties(TextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(TextField.class)) {
        newStyleProperties(TextFieldStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
    } else if (clazz.equals(TextTooltip.class)) {
        newStyleProperties(TextTooltipStyle.class);
        properties.get("label").optional = false;
        properties.get("label").value = "default";
    } else if (clazz.equals(Touchpad.class)) {
        newStyleProperties(TouchpadStyle.class);
    } else if (clazz.equals(Tree.class)) {
        newStyleProperties(TreeStyle.class);
        properties.get("plus").optional = false;
        properties.get("minus").optional = false;
    } else if (clazz.equals(Window.class)) {
        newStyleProperties(WindowStyle.class);
        properties.get("titleFont").optional = false;
    }
}
项目:cachebox3.0    文件:Splash.java   
private void InitialView() {

        // create SVG image from Cachbox Logo
        try {
            InputStream stream = Gdx.files.internal("cb_logo.svg").read();
            float targetWidth = Gdx.graphics.getWidth() * 0.8f;
            Bitmap svgBitmap = PlatformConnector.getSvg("", stream, PlatformConnector.SvgScaleType.SCALED_TO_WIDTH, targetWidth);
            if (svgBitmap != null) {
                CB.CB_Logo = new Image(new Texture(Utils.getPixmapFromBitmap(svgBitmap)));
                CB.CB_Logo.setPosition((Gdx.graphics.getWidth() - svgBitmap.getWidth()) / 2, svgBitmap.getHeight() * 2);
                this.addActor(CB.CB_Logo);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


        ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle();

        style.background = SvgSkinUtil.getSvgNinePatchDrawable(-1, -1, -1, -1
                , 0, 0, -1, -1
                , Utils.getTextureRegion(Gdx.files.internal("progress_back.svg").read()));

        style.knobBefore = SvgSkinUtil.getSvgNinePatchDrawable(-1, -1, -1, -1
                , -1, -1, -1, -1
                , Utils.getTextureRegion(Gdx.files.internal("progress_foreground.svg").read()));


        progress = new VisProgressBar(0f, 100f, 1f, false, style);
        float margin = 40 * (CanvasAdapter.dpi / 240);
        float progressWidth = Gdx.graphics.getWidth() - (margin * 2);

        progress.setBounds(margin, margin, progressWidth, ((SvgNinePatchDrawable) style.background).getPatch().getTotalHeight());
        this.addActor(progress);

        progress.setValue(0);

        Label.LabelStyle labelStyle = new Label.LabelStyle();
        String path = "skins/day/fonts/DroidSans.ttf";
        labelStyle.fontColor = Color.BLACK;
        labelStyle.font = new SkinFont(path, Gdx.files.internal(path), 20, null);
        workLabel = new Label(" \n ", labelStyle);
        workLabel.setBounds(margin, margin + progress.getHeight() + margin, progressWidth, workLabel.getPrefHeight());
        this.addActor(workLabel);

        // Init loader tasks
        initTaskList.add(new InitialWorkPathTask("InitialWorkPAth"));
        initTaskList.add(new SkinLoaderTask("Load UI"));
        initTaskList.add(new TranslationLoaderTask("Load Translations"));
        initTaskList.add(new GdxInitialTask("Initial GDX"));
        initTaskList.add(new InitialLocationListenerTask("Initial Loacation Reciver"));
        initTaskList.add(new LoadDbTask("Load Database"));

        // Use classpath for Desktop or assets for iOS and Android
        assets = (CanvasAdapter.platform.isDesktop()) ?
                new AssetManager(new ClasspathFileHandleResolver())
                : new AssetManager();

        Gdx.graphics.requestRendering();
    }
项目:libgdxjam    文件:LoadingScreen.java   
private void createProgressBar(Skin skin, Table mainTable)
{
    progressBar = new ProgressBar(0f, 1f, 0.001f, false, skin, "loading");
    mainTable.add(progressBar).fillX();
}
项目:ZombieGame    文件:Hud.java   
public Hud(GameScreen screen) {
    this.screen = screen;


    viewport = new FitViewport(16, 9, screen.camera);

    stage = new Stage();
    skin = new Skin(Gdx.files.internal("ui/uiskin.json"));

    table = new Table();
    table.top().left();
    table.setFillParent(true);

    staminaLabel = new Label("Stamina", skin);
    staminaLabel.setFontScale(0.5f);

    table.add(staminaLabel).pad(10);

    stamina = new ProgressBar(0, 100, 1, false, skin);

    table.add(stamina).pad(10);

    stage.addActor(table);
}
项目:gdx-lml    文件:MainView.java   
@LmlAction("load")
public void advanceLoadingProgress(final ProgressBar progressBar) {
    progressBar.setValue(progressBar.getValue() + progressBar.getStepSize() * 5f);
}
项目:gdx-lml    文件:MainView.java   
/** @param bar will have a random initial value set. */
public void setInitialValue(final ProgressBar bar) {
    bar.setValue(MathUtils.random(bar.getMinValue(), bar.getMaxValue()));
}
项目:gdx-lml    文件:MainView.java   
@LmlAction("load")
public void advanceLoadingProgress(final ProgressBar progressBar) {
    progressBar.setValue(progressBar.getValue() + progressBar.getStepSize() * 5f);
}
项目:gdx-lml    文件:MainView.java   
/** @param bar will have a random initial value set. */
public void setInitialValue(final ProgressBar bar) {
    bar.setValue(MathUtils.random(bar.getMinValue(), bar.getMaxValue()));
}
项目:gdx-lml    文件:ProgressBarOnChangeProcessor.java   
@Override
public boolean canProcess(final Field field, final Object actor) {
    return actor instanceof ProgressBar
            && (field.getType().equals(float.class) || field.getType().equals(Float.class));
}
项目:gdx-lml    文件:ProgressBarOnChangeProcessor.java   
@Override
protected Object extractValueFromActor(final ProgressBar actor) {
    return actor.getValue();
}
项目:gdx-lml    文件:AnimateDurationLmlAttribute.java   
@Override
public Class<ProgressBar> getHandledType() {
    return ProgressBar.class;
}
项目:gdx-lml    文件:AnimateDurationLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final ProgressBar actor,
        final String rawAttributeData) {
    actor.setAnimateDuration(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml    文件:OnCompleteLmlAtrribute.java   
@Override
public Class<ProgressBar> getHandledType() {
    return ProgressBar.class;
}
项目:gdx-lml    文件:SliderLmlTag.java   
@Override
protected ProgressBar getNewInstanceOfProgressBar(final FloatRangeLmlActorBuilder rangeBuilder) {
    return new Slider(rangeBuilder.getMin(), rangeBuilder.getMax(), rangeBuilder.getStepSize(),
            rangeBuilder.isVertical(), getSkin(rangeBuilder), rangeBuilder.getStyleName());
}
项目:gdx-lml    文件:ProgressBarLmlTag.java   
/** @return actor instance, casted for convenience. */
protected ProgressBar getProgessBar() {
    return (ProgressBar) getActor();
}
项目:gdx-lml    文件:ProgressBarLmlTag.java   
/** @param rangeBuilder contains data necessary to construct a float-range-based widget.
 * @return a new instance of progress bar. */
protected ProgressBar getNewInstanceOfProgressBar(final FloatRangeLmlActorBuilder rangeBuilder) {
    return new ProgressBar(rangeBuilder.getMin(), rangeBuilder.getMax(), rangeBuilder.getStepSize(),
            rangeBuilder.isVertical(), getSkin(rangeBuilder), rangeBuilder.getStyleName());
}