Java 类com.badlogic.gdx.scenes.scene2d.utils.Align 实例源码

项目:GDX-Engine    文件:TabPane.java   
public void addTab(String tabTitle, final ITabContent tabContent,
        Skin skin) {

    TextButton button = new TextButton(tabTitle, skin);
    button.align(Align.left);
    //button.setFillParent(true);
    button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            tabContent.setContent(content);
            content.pack();
            setWidth(preferedContentWidth);
            setHeight(preferedContentHeight);

        }
    });

    tabHeaders.add(button);
    contents.add(tabContent);

    preferedContentWidth = Math.max(preferedContentWidth, tabContent.getWidth());
    preferedContentHeight = Math.max(preferedContentHeight, tabContent.getHeight() + tabHeaders.get(0).getHeight());
}
项目:eamaster    文件:BulletTestCollection.java   
@Override
public void create () {
    if (app == null) {
        app = Gdx.app;
        tests[testIndex].create();
    }

    cameraController = new CameraInputController(tests[testIndex].camera);
    cameraController.activateKey = Keys.CONTROL_LEFT;
    cameraController.autoUpdate = false;
    cameraController.forwardTarget = false;
    cameraController.translateTarget = false;
    Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));

    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
    hud = new Stage();
    hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
    fpsLabel.setPosition(0, 0);
    hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
    titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
    hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
    instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
    instructLabel.setAlignment(Align.top | Align.left);
    instructLabel.setText(tests[testIndex].instructions);
}
项目:Dodgy-Dot    文件:DodgyDot.java   
@Override
public void create () {
    pref = Gdx.app.getPreferences("DATA");
    highScore = pref.getInteger("Score", -1);
    if (highScore == -1) {
        highScore = 0;
        pref.putInteger("Score", 0);
        pref.flush();
    }

    batch = new SpriteBatch();
    font = new BitmapFont(Gdx.files.internal("ChicagoFLF.fnt"));
    //font.setScale(5f);
    labelStyle = new Label.LabelStyle(font, new Color(124 / 255.0f, 199 / 255.0f, 72 / 255.0f, 1));

    highScoreWordsLabel = new  Label("Score:\n\nHigh Score:", labelStyle);
    highScoreWordsLabel.setFontScale(0.7f);
    highScoreWordsLabel.setHeight((float) highScoreWordsLabel.getHeight() * 0.7f);
    highScoreWordsLabel.setPosition(0, VIRTUAL_HEIGHT - highScoreWordsLabel.getHeight());
    highScoreWordsLabel.setAlignment(Align.left);
    //debugRenderer = new Box2DDebugRenderer();
    Assets.load();
    this.setScreen(new GameScreen(this));
}
项目:Dodgy-Dot    文件:GameScreen.java   
public void updateRunning (float delta) {
    world.step(delta, 6, 2);
    timeGap += delta;
    playTime += delta;
    if (timeGap >= SQUARE_FALL_INTERVAL) {
        createEnemy();
        timeGap -= SQUARE_FALL_INTERVAL;
    }
    if (state == GAME_RUNNING) {
        //scoreLabel.addAction(Actions.moveTo(540, 990, 1f));
        scoreLabel.setText((Integer.toString((int) playTime)));
        //scoreLabel.setPosition(0, 0);
        scoreLabel.setPosition(VIRTUAL_WIDTH - scoreLabel.getWidth(), VIRTUAL_HEIGHT - scoreLabel.getHeight());
        scoreLabel.setAlignment(Align.right);
        //scoreLabel.setVisible(true);
        //stage.addActor(scoreLabel);
        //logger.info("scoreLabel text: ".concat(scoreLabel.getText().toString()));
        //logger.info("score: ".concat((Integer.toString((int) (playTime)))));
    }
}
项目:Dodgy-Dot    文件:GameScreen.java   
public void gameOverSetup () {
    retry = new Retry();
    retry.getColor().a = 0;
    retry.addAction(Actions.parallel(Actions.fadeIn(1f),Actions.moveTo(RETRY_X * 100, RETRY_Y * 100, 1f, Interpolation.bounceOut)));
    stage.addActor(retry);
    retry.setZIndex(50);

    if ((int) playTime > game.highScore) {
        game.highScore = (int) playTime;
        game.pref.putInteger("Score", game.highScore);
        game.pref.flush();
    }

    highScoreLabel = new Label(Integer.toString(game.highScore), game.labelStyle);
    highScoreLabel.setFontScale(1.5f);
    highScoreLabel.setPosition(VIRTUAL_WIDTH - highScoreLabel.getWidth(),  VIRTUAL_HEIGHT - highScoreLabel.getHeight() - 300);
    highScoreLabel.setAlignment(Align.right);
    stage.addActor(highScoreLabel);
    stage.addActor(game.highScoreWordsLabel);
    highScoreLabel.getColor().a = game.highScoreWordsLabel.getColor().a = 0;
    highScoreLabel.setZIndex(50);
    game.highScoreWordsLabel.setZIndex(50);
    highScoreLabel.addAction(Actions.fadeIn(0.25f));
    game.highScoreWordsLabel.addAction(Actions.fadeIn(0.25f));
}
项目:Point-and-Hit    文件:NoCompassScreen.java   
@Override
public void show() {
    stage = new Stage();
    table = new Table();
    float padding = 50 * scale;
    BitmapFont font = new BitmapFont(Gdx.files.internal("fonts/deja_vu_sans_medium.fnt"));
    Vector2 screenSize = new Vector2(Gdx.graphics.getWidth()
                , Gdx.graphics.getHeight());
    font.setScale(scale);
    Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE);
    messageLabel = new Label(text, labelStyle);
    messageLabel.setWrap(true);
    messageLabel.setWidth(screenSize.x - padding * 2);
    messageLabel.setAlignment(Align.center);

    table.setFillParent(true);
    table.defaults().pad(padding);
    table.add(messageLabel)
        .width(screenSize.x - padding * 2);
    stage.addActor(table);
}
项目:lets-code-game    文件:GameResultScreen.java   
public GameResultScreen(Context context, String winner) {
    super(context.app);
    hasPlayerWon = context.getPlayerNickname().equals(winner);

    String text = hasPlayerWon ? "You have won!" : "Player " + winner + " has won."; 
    Label label = new Label(text, app.skin); 
    label.setAlignment(Align.center); 
    mainTable.add(label).expand().fill(); 

    if (hasPlayerWon) {
        leftSystem = new ParticleSystem("winner.ps");
        rightSystem = new ParticleSystem("winner.ps");

        leftSystem.setPosition(Gdx.graphics.getWidth() / 4, Gdx.graphics.getHeight() / 2);
        rightSystem.setPosition(Gdx.graphics.getWidth() / 4 * 3, Gdx.graphics.getHeight() / 2);
        addActor(leftSystem);
        addActor(rightSystem);
    }

    mainTable.layout(); 
}
项目: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());
}
项目:libgdxcn    文件:Table.java   
/** Removes all actors and cells from the table (same as {@link #clear()}) and additionally resets all table properties and
 * cell, column, and row defaults. */
public void reset () {
    clear();
    padTop = backgroundTop;
    padLeft = backgroundLeft;
    padBottom = backgroundBottom;
    padRight = backgroundRight;
    align = Align.center;
    debug(Debug.none);
    cellDefaults.defaults();
    for (int i = 0, n = columnDefaults.size; i < n; i++) {
        Cell columnCell = columnDefaults.get(i);
        if (columnCell != null) cellPool.free(columnCell);
    }
    columnDefaults.clear();
}
项目:libgdxcn    文件:Image.java   
public void layout () {
    if (drawable == null) return;

    float regionWidth = drawable.getMinWidth();
    float regionHeight = drawable.getMinHeight();
    float width = getWidth();
    float height = getHeight();

    Vector2 size = scaling.apply(regionWidth, regionHeight, width, height);
    imageWidth = size.x;
    imageHeight = size.y;

    if ((align & Align.left) != 0)
        imageX = 0;
    else if ((align & Align.right) != 0)
        imageX = (int)(width - imageWidth);
    else
        imageX = (int)(width / 2 - imageWidth / 2);

    if ((align & Align.top) != 0)
        imageY = (int)(height - imageHeight);
    else if ((align & Align.bottom) != 0)
        imageY = 0;
    else
        imageY = (int)(height / 2 - imageHeight / 2);
}
项目:libgdxcn    文件:BulletTestCollection.java   
@Override
public void create () {
    if (app == null) {
        app = Gdx.app;
        tests[testIndex].create();
    }

    cameraController = new CameraInputController(tests[testIndex].camera);
    cameraController.activateKey = Keys.CONTROL_LEFT;
    cameraController.autoUpdate = false;
    cameraController.forwardTarget = false;
    cameraController.translateTarget = false;
    Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));

    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
    hud = new Stage();
    hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
    fpsLabel.setPosition(0, 0);
    hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
    titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
    hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
    instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
    instructLabel.setAlignment(Align.top | Align.left);
    instructLabel.setText(tests[testIndex].instructions);
}
项目:droidtowers    文件:ProgressPanel.java   
public ProgressPanel() {
    super();

    messagesUsed = Sets.newHashSet();

    loadingMessage = FontManager.Roboto32.makeLabel(selectRandomMessage(), Color.WHITE, Align.center);
    loadingMessage.setColor(Color.DARK_GRAY);
    loadingMessage.setAlignment(Align.center);

    progressLabel = FontManager.Roboto64.makeLabel("0%", Color.WHITE, Align.center);
    progressLabel.setColor(Color.DARK_GRAY);
    progressLabel.setAlignment(Align.center);

    row();
    add(loadingMessage).center();
    row();
    add(progressLabel).center();
}
项目:droidtowers    文件:PopOver.java   
protected void show(Actor parentWidget, Actor relativeTo) {
    setVisible(true);
    content.setVisible(true);

    parentWidget.getStage().addActor(this);
    parentWidget.getStage().addActor(content);

    content.pack();
    pack();
    float relativeX = relativeTo.getX() + parentWidget.getX();
    if ((arrowAlignment & Align.right) != 0) {
        setX(relativeX - getWidth() + relativeTo.getWidth() - ((relativeTo.getWidth() - triangle.getWidth()) / 2) + 8);
    } else {
        setX(relativeX + ((relativeTo.getWidth() - triangle.getWidth()) / 2) - 8);
    }
    setY(relativeTo.getY() + parentWidget.getY() - getHeight() - relativeTo.getHeight() / 2);
    content.setX(getX() + Display.devicePixel(10));
    content.setY(getY() + Display.devicePixel(10));

    InputSystem.instance().bind(new int[] { ESCAPE, BACK }, inputCallback);
    InputSystem.instance().addInputProcessor(clickCallback, 0);

    addAction(Actions.fadeIn(BUTTON_FADE_DURATION));
    content.addAction(Actions.fadeIn(BUTTON_FADE_DURATION));
}
项目:droidtowers    文件:RequirementsTable.java   
@SuppressWarnings("unchecked")
private void addRequirement(Requirement requirement) {
    row().fillX().pad(12, 0, 12, 0);
    Label label = Roboto18.makeLabel(requirement.displayString());
    label.setWrap(true);
    add(label).expandX();

    Cell amountCell = add().center();
    if (requirement.getAmount() > 0) {
        Label amountValue = RobotoBold18.makeLabel(String.format("%d/%d", requirement.getCurrentWeight(), requirement.getAmount()));
        amountValue.setAlignment(Align.center);
        amountCell.setWidget(amountValue);
    }

    ProgressBar progressBar = new ProgressBar(requirement.getProgress());
    add(progressBar).width(200).right().center();

    row();
    add(new HorizontalRule(Color.DARK_GRAY, 1)).colspan(3);
}
项目:droidtowers    文件:RatingBar.java   
public RatingBar(float stars, int maxValue) {
    super();
    this.stars = stars;
    this.maxValue = maxValue;

    defaults().left().space(Display.devicePixel(2));

    setTextures(STAR_ICON);

    starPlaceholder = new NoOpWidget();
    valueLabel = FontManager.RobotoBold18.makeLabel("5.0");
    valueLabel.setAlignment(Align.center);

    setValue(stars);
    textureHeight = maskTexture.getHeight();

    updateLayout();
}
项目:HAW-SE2-projecthorse    文件:LootGallery.java   
/**
 * Initialisiert die UI-Elemente.
 */
private void initializeUiElements() {
    DefaultScrollPane tableContainer;

    tableWidth = width - 150;
    tableHeight = height - 300;
    lootTable = new VerticalGroup();
    lootTable.space(10);
    lootTable.align(Align.left + Align.top);
    lootTable.setWidth(tableWidth);

    tableContainer = new DefaultScrollPane(lootTable, tableHeight,
            tableWidth);
    tableContainer.setPosition(75, 50);
    tableContainer.toFront();

    stage.addActor(tableContainer);

    // switch button erstellen
    stage.addActor(createSwitchButton());
}
项目:TDA367    文件:PlayerPanel.java   
public PlayerPanel(Alignment align) {
    super(Common.getSkin());

    lblName = new Label("", Common.getSkin());
    imgNationality = new Image();
    turnLabel = new Label("", Common.getSkin());

    Pixmap pix = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pix.setColor(Color.GRAY);
    pix.fill();
    setBackground(new TextureRegionDrawable(new TextureRegion(new Texture(pix))));

    if (align == Alignment.LEFT) {
        align(Align.left);
        add(imgNationality).padRight(8f);
        add(lblName);
        add(turnLabel).expandX().right().pad(8f);
    } else {
        align(Align.right);
        add(turnLabel).expandX().left().pad(8f);
        add(lblName).padRight(8f);
        add(imgNationality);
    }
    //debug();

}
项目:GdxStudio    文件:SceneEditor.java   
@Override
public void onTouchDown(Actor actor) {
    if (Scene.mouseButton == 0) {
        edge = 0;
        float x = Scene.mouse.x;
        float y = Scene.mouse.y;
        if (x > actor.getX() + actor.getWidth() - 10) edge |= Align.right;
        if (y > actor.getY() + actor.getHeight() - 10) edge |= Align.top;
        //if (x < actor.getX() + 20 && y < actor.getY() + 20) edge = Align.left; no rotation
        dragging = edge != 0;
        startX = x;
        startY = y;
        lastX = x;
        lastY = y;
    }
}
项目:Vloxlands    文件:NonStackingInventoryListItem.java   
public NonStackingInventoryListItem(Stage stage, Item item, int amount, boolean hideOnZero, boolean format, boolean showName) {
    setWidth(200);
    setName((item.getId() + 128) + "");
    this.hideOnZero = hideOnZero;
    this.format = format;
    this.showName = showName;
    this.item = item;
    this.amount = amount;
    left();
    row();

    tooltip = new Tooltip(amount + " " + item.getName(), item.getDescription(), this);
    stage.addActor(tooltip);
    image = new Image();
    add(image).size(24, 24);

    label = new Label(amount + " " + item.getName(), Vloxlands.skin);
    if (!showName) {
        label.setAlignment(Align.right);
        add(label).right().expandX();
    } else add(label);

    onChange();
}
项目:GarbageCollector    文件:FinalMenuStage.java   
/**
 * inits stage actors
 */
public void init(){
    Label.LabelStyle style = new Label.LabelStyle();
    style.font = new BitmapFont();
    scoreLabel = new Label("City drown in garbage :) ", style);
    scoreLabel.setWidth(getWidth() - getWidth() / 10);
    scoreLabel.setFontScale(2f * Gdx.graphics.getDensity());
    scoreLabel.setScale(2f * Gdx.graphics.getDensity());
    scoreLabel.setWrap(true);
    scoreLabel.setAlignment(Align.center);
    scoreLabel.setColor(1, 0, 0, 1);
    scoreLabel.setX(getWidth() / 2 - scoreLabel.getWidth() / 2);
    scoreLabel.setY(getHeight() / 2 - scoreLabel.getHeight() / 2);
    addActor(scoreLabel);

    initTryAgain();

}
项目:gdx-soundboard    文件:AddStateDialog.java   
public AddStateDialog(final Stage stage, final Skin skin, final MusicEventManager eventManager) {

        super("Add State", skin);
        this.stage = stage;
        this.skin = skin;
        this.eventManager = eventManager;


        Table content = this.getContentTable();
        Label label = new Label("State name", skin);
        label.setAlignment(Align.left);
        content.add(label).left().fillX().expandX().row();

        eventName = new TextField("", skin);
        content.add(eventName).right().fillX().expandX().row();

        Table buttons = this.getButtonTable();
        buttons.defaults().fillX().expandX();

        this.button("Ok", true);
        this.button("Cancel", false);


        key(Keys.ENTER, true);
        key(Keys.ESCAPE, false);
    }
项目:the-erder    文件:GUITarget.java   
public GUITarget(float w, float h)
{
    table = new Table();
    table.setWidth(w);
    table.setHeight(h);

    this.w = w;

    target = new Image(GameManager.getSkin(GameManager.selectedSkin).get(
            "lwindow", Texture.class));
    target.setFillParent(true);

    bar = new Image(GameManager.getSkin(GameManager.selectedSkin).get(
            "lbutton", Texture.class));
    bar.setFillParent(true);
    bar.setAlign(Align.left);
    bar.setWidth(w);

    table.align(Align.left);

    table.add(target);
    table.row();
    table.add(bar);
}
项目:craft    文件:Dialog.java   
Dialog(Pair<String, ClickListener> submit, Pair<String, ClickListener> abort, Actor content) {
  SharedInjector.get().injectMembers(this);
  window = new Table();
  add(window);
  if (content != null) {
    contentCell = window.add(content).fill().align(Align.center).pad(PADDING);
  }
  if (submit != null || abort != null) {
    buttonLayout = new Table();
    window.row().row().padTop(PADDING);
    window.add(buttonLayout);
  }
  if (abort != null) {
    initAbort(abort);
  }
  if (submit != null) {
    Cell<?> c = initSubmit(submit);
    if (abort != null) {
      c.padLeft(PADDING);
    }
  }
  background = GraphicsFactory.createNinePatch(Assets.TEX_PANEL_BLACK_9patch, Sizes.panelTransparentRadius());
}
项目:craft    文件:ItemWidget.java   
private Actor generateRight(Item item) {
  VerticalGroup layout = new VerticalGroup();
  layout.align(Align.left);
  layout.padLeft(15f);
  name.setColor(item.getRarity().getColor());
  name.setFontScale(0.90f);
  layout.addActor(name);
  Table descContainer = new Table();
  level = new StarLevelWidget(item.getLevel(), 7);
  availability = new AvailabilityIcon(item);
  descContainer.add(level);
  descContainer.right().add(availability).padLeft(70f).padTop(27f);
  layout.addActor(descContainer);
  layout.setTouchable(Touchable.disabled);
  return layout;
}
项目:craft    文件:RecipeWidget.java   
private Actor generateTop(Item item) {
  HorizontalGroup group = new HorizontalGroup();
  group.align(Align.left);
  IconWidget icon = new IconWidget(item, 0);
  icon.setHandle(icon.new DefaultIconHandle() {
    @Override
    public boolean isDraggable(int amount) {
      return false;
    }

    @Override
    public boolean isVisible(int currentAmount) {
      return false;
    }
  });
  group.addActor(icon);
  HorizontalGroup wrapper = new HorizontalGroup();
  Label caption = new Label(Bundles.items.get(item.getId().toString()), Styles.LBL_ITEM);
  caption.setColor(item.getRarity().getColor());
  icon.setWidth(caption.getHeight() * 4);
  icon.setHeight(caption.getHeight() * 4);
  wrapper.addActor(caption);
  wrapper.padLeft(15f);
  group.addActor(wrapper);
  return group;
}
项目:Cardshifter    文件:UsersList.java   
public void handleUserStatus(UserStatusMessage message) {
    switch (message.getStatus()) {
        case OFFLINE:
            UserTable table = userMap.get(message.getUserId());
            if (table != null) {
                table.remove();
            }
            break;
        case ONLINE:
            table = userMap.get(message.getUserId());
            if (table == null) {
                final UserTable userTable = new UserTable(skin, message.getUserId(), message.getName());
                userMap.put(message.getUserId(), userTable);
                userTable.getTable().addListener(new ClickListener() {
                    @Override
                    public void clicked(InputEvent event, float x, float y) {
                        UsersList.this.selectUser(userTable);

                    }
                });
                this.table.add(userTable.getTable()).align(Align.left).row();
            }
            break;
    }
}
项目:GLXY    文件:MainMenuScreen.java   
public MainMenuScreen(GlxyGame gm) {
    super(gm);
    logoTex = new Texture(Gdx.files.internal("data/glxy-logo.png"));
    Image logo = new Image(logoTex);
    logo.setScaling(Scaling.fit);
    add(logo);

    TextButton t = new TextButton("Start!", skin);
    t.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            game.setScreen("GameScreen");
        }
    });
    t.pad(5, 10, 5, 10);
    add(t).expandY();

    Label cpright = new Label(
            "Copyright CHEKAE 2013 - 2017 - All rights reserved", skin);
    cpright.setAlignment(Align.center);
    cpright.setColor(1f, 1f, .8f, 1f);
    add(cpright).pad(10);
}
项目:OverdriveGDX    文件:TestScreen.java   
private void textWindowDemo() {
    BitmapFont plotFont = context.getAssetManager().get( PLOT_FONT, BitmapFont.class );

    String loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, ";
    loremIpsum += "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
    loremIpsum += "\n\nThis window is draggable.";

    rootAtlas = context.getAssetManager().get( ROOT_ATLAS, TextureAtlas.class );
    TextureRegion plotDlgRegion = rootAtlas.findRegion( "box-text1" );
    NinePatchDrawable plotDlgBgDrawable = new NinePatchDrawable( new NinePatch( plotDlgRegion, 20, 20, 35, 20 ) );

    Window plotDlg = new Window( "", new Window.WindowStyle( plotFont, new Color( 1f, 1f, 1f, 1f ), plotDlgBgDrawable ) );
    plotDlg.setKeepWithinStage( true );
    plotDlg.setMovable( true );
    plotDlg.setSize( 200, 250 );
    plotDlg.setPosition( 765, 60 );

    plotDlg.row().top().expand().fill();
    Label plotLbl = new Label( loremIpsum, new Label.LabelStyle( plotFont, new Color( 1f, 1f, 1f, 1f ) ) );
    plotLbl.setAlignment( Align.top|Align.left, Align.center|Align.left );
    plotLbl.setWrap( true );
    plotDlg.add( plotLbl );

    // setKeepWithinStage() only applies if added to the stage root. :/
    popupStage.addActor( plotDlg );
}
项目:ead    文件:AnimationEdition.java   
public AnimationEdition(Controller controller) {
    super();
    skin = controller.getApplicationAssets().getSkin();

    align(Align.top);

    DragAndDrop dragAndDrop = new DragAndDrop();

    buttonReg = new HashMap<IconTextButton, Class<Effect>>();
    drawableReg = new HashMap<Class<Effect>, Drawable>();

    backgroundTweens = skin.getDrawable("bg-dark");

    add(new TweensTypeTab(dragAndDrop, controller)).left();
    row();
    AnimationTimeline timeline = new AnimationTimeline(dragAndDrop,
            controller);
    add(timeline).expandX().fill();
    row();
    add(new Separator(true, skin));
    row();
    add(timeline.getAddButton()).fill().expandX();
    row();
    add(new Separator(true, skin));
}
项目:lilligames    文件:MainMenuScreen.java   
public MainMenuScreen (LilliGame gm) {
    super(gm);
    logoTex = new Texture(Gdx.files.internal("data/logo.png"));
    Image logo = new Image(logoTex);
    logo.setScaling(Scaling.fit);
    add(logo);

    TextButton t = new TextButton("Start!", skin);
    t.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            game.setScreen("GameScreen");
        }
    });
    t.pad(5, 10, 5, 10);
    add(t).expandY();

    Label cpright = new Label("Copyright KaeruCT 2013 - All rights reserved", skin);
    cpright.setAlignment(Align.center);
    cpright.setColor(1f, 1f, .8f, 1f);
    add(cpright).pad(10);
}
项目:DreamsLibGdx    文件:SplashScreen.java   
@Override
public void resize(int width, int height) {
    super.resize(width, height);

    Image splashImage = new Image(new SpriteDrawable(new Sprite(splashTexture)), Scaling.stretch, Align.bottom | Align.left);
    splashImage.setWidth(width);
    splashImage.setHeight(height);
    splashImage.getColor().a = 0f;

    splashImage.addAction(sequence(fadeIn(0.5f), run(new Runnable() {
        public void run() {
            game.menuScreen = new MenuScreen(game);
        }
    }), delay(1f, fadeOut(0.5f)), run(new Runnable() {
        public void run() {
            game.setGameState(GameState.GAME_SHOW_MENU);
        }
    })));

    stage.addActor(splashImage);
}
项目:it.alcacoop.fourinaline    文件:IconButton.java   
public IconButton(String text, TextureRegion icon, TextButtonStyle tl, boolean leftImage, boolean rightImage, boolean centerText) {
  super(tl);
  label = new Label(text, new LabelStyle(tl.font, tl.fontColor));
  label.setAlignment(Align.center);
  this.style = tl;
  if (leftImage && icon != null) {
    Image icon1 = new Image(icon);
    add(icon1).expandY();
  }

  if (centerText)
    add(label).expand().fill();

  if (rightImage && icon != null) {
    Image icon2 = new Image(icon);
    add(icon2).expandY();
  }


  _IconButton();
}
项目:it.alcacoop.fourinaline    文件:IconButton.java   
public IconButton(String text, TextureRegion icon, TextButtonStyle tl) {
  super(tl);
  this.style = tl;
  label = new Label(text, new LabelStyle(tl.font, tl.fontColor));
  label.setAlignment(Align.center);

  if (icon != null) {
    Image icon1 = new Image(icon);
    add(icon1).expandY();
  }

  add(label).expand().fill();

  if (icon != null) {
    Image icon2 = new Image(icon);
    add(icon2).expandY();
  }

  _IconButton();
}
项目:it.alcacoop.fourinaline    文件:BoardImage.java   
public BoardImage(final float imageWidth, final float imageHeight, final int nx, final int ny) {
  setDrawable(new TextureRegionDrawable(FourInALine.Instance.atlas.findRegion("hole")));
  this.scaling = Scaling.stretch;
  this.align = Align.center;
  this.nx = nx;
  this.ny = ny;
  xdim = (int)imageWidth / nx;
  ydim = (int)imageHeight / ny;
  setWidth((int)imageWidth);
  setHeight((int)imageHeight);
  tile = FourInALine.Instance.atlas.findRegion("hole");

  wood = FourInALine.Instance.wood;
  mask = new TextureRegion(FourInALine.Instance.mask);

  shader = new ShaderProgram(Gdx.files.internal("shaders/vertex.s"), Gdx.files.internal("shaders/fragment.s"));
  System.out.println(shader.isCompiled());
  System.out.println(shader.getLog());
}
项目:GDX-Engine    文件:TabPane.java   
@Override
public void pack() {
    this.clear();
    row().fill().expand();
    for (TextButton btn : tabHeaders)
        add(btn).align(Align.left);
    row();

    add(content).colspan(tabHeaders.size);

    super.pack();

    setWidth(preferedContentWidth);
    setHeight(preferedContentHeight);
}
项目:Skyland    文件:Splash.java   
@Override
public void show() {
    queueAssets();

    splashImage = new Image(new Texture(Gdx.files.internal(Textures.TEXTURE_TOXSICK_LOGO)));
    splashImage.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, Align.center);
    Skyland.STAGE.addActor(splashImage);

    addSplashAnimation();
}
项目:TTmath    文件:ProblemScreen.java   
private void createLabel() {
    LabelStyle ls = new LabelStyle();
    ls.font = text;
    ls.fontColor = Color.WHITE;
    label = new Label("Answer to the following question: \n"
            +questions[0],ls);
    label.setWrap(true);
    label.setAlignment(Align.center);
    label.setWidth(10);

    table.add(label).width(Gdx.graphics.getWidth());
    stage.addActor(table);
}
项目:lets-code-game    文件:ErrorScreen.java   
public ErrorScreen(Context context) {
    super(context.app);
    this.context = context;
    EventsInterface.unsubscribeAll();

    String text = "Excuse us but some connection error occured. Please try again :)"; 
    Label label = new Label(text, app.skin); 
    label.setAlignment(Align.center); 
    mainTable.add(label).expand().fill();
}
项目:CodeBase    文件:LogLabel.java   
public LogLabel(String text, Skin skin, Level level) {
    super(text, skin, "console-" + level.toString().toLowerCase());

    this.level = level;

    setAlignment(Align.left | Align.bottom);
    setFillParent(true);
    setWrap(true);
}
项目:CodeBase    文件:DecoImage.java   
public DecoImage(Texture texture) {
    super(null, Scaling.stretch, Align.center);
    region = new TextureRegion(texture);
    setDrawable(new TextureRegionDrawable(region));
    setSize(getPrefWidth(), getPrefHeight());

    setBounds(0, 0, texture.getWidth(), texture.getHeight());
    setOrigin(texture.getWidth() / 2, texture.getHeight() / 2);
    setTouchable(Touchable.disabled);
}