com.badlogic.gdx.scenes.scene2d.ui.Button.add()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Button.add()方法的一些代码示例,展示了Button.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.add()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Button
类名称:Button
方法名:add

Button.add介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

public Button (Actor child, ButtonStyle style) {
  initialize();
  add(child);
  setStyle(style);
  setSize(getPrefWidth(), getPrefHeight());
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

button.add(getScreenshot(slot)).maxSize(slotWidth * .95f, slotHeight * .95f);
} else {
  Image fg = new Image(skin.getDrawable("plus"));
  button.add(fg).maxSize(slotHeight / 2, slotHeight / 2);
label.setAlignment(Align.center);
button.add(label).fillX();

代码示例来源:origin: Var3D/var3dframe

btn_back.add(game.getLabel("返回").setFontScale(0.6f).getActor());
btn_back.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_dialog.add(game.getLabel("等比例舞台").setFontScale(0.6f).getActor());
btn_dialog.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_unRatio.add(game.getLabel("非等比例舞台").setFontScale(0.6f).getActor());
btn_unRatio.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_more.add(game.getLabel("等待添加...").setFontScale(0.6f).getActor());
btn_more.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {

代码示例来源:origin: libgdx/libgdx

public Button (Actor child, ButtonStyle style) {
  initialize();
  add(child);
  setStyle(style);
  setSize(getPrefWidth(), getPrefHeight());
}

代码示例来源:origin: Var3D/var3dframe

@Override
public void init() {
  //设置背景
  setBackground(400, 300, Color.valueOf("0075ed"));
  //设置标题
  game.getLabel("非等比例对话框").touchOff().setFontScale(1.3f).setPosition(getWidth() / 2, getHeight() - 30, Align.top).show();
  //对话框堆叠测试
  Button btn_dialog = game.getButton().setColor(Color.ORANGE).setSize(120, 40)
      .setPosition(getWidth() / 2, getHeight() / 2, Align.center).addClicAction().show();
  btn_dialog.add(game.getLabel("对话框堆叠测试").setFontScale(0.5f).getActor());
  btn_dialog.addListener(new ClickListener() {
    public void clicked(InputEvent event, float x, float y) {
      game.showDialog(DialogRatio.class);
    }
  });
  //关闭按钮
  Button btn_close = game.getTextButton("关闭", Color.WHITE, Color.valueOf("ff2266"))
      .setSize(100, 40).addClicAction().setPosition(getWidth() / 2, 50, Align.bottom).show();
  btn_close.addListener(new ClickListener() {
    public void clicked(InputEvent event, float x, float y) {
      game.removeDialog();
    }
  });
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public Button (Actor child, ButtonStyle style) {
  initialize();
  add(child);
  setStyle(style);
  setSize(getPrefWidth(), getPrefHeight());
}

代码示例来源:origin: Var3D/var3dframe

btn_back.add(game.getLabel("返回").setFontScale(0.6f).getActor());
btn_back.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_dialog.add(game.getLabel("等比例对话框").setFontScale(0.6f).getActor());
btn_dialog.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_unRatio.add(game.getLabel("非等比例对话框").setFontScale(0.6f).getActor());
btn_unRatio.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_full.add(game.getLabel("全屏对话框").setFontScale(0.6f).getActor());
btn_full.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_login.add(game.getLabel("登录对话框").setFontScale(0.6f).getActor());
btn_login.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_tost.add(game.getLabel("Tost测试").setFontScale(0.6f).getActor());
btn_tost.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_ad.add(game.getLabel("自推广广告").setFontScale(0.6f).getActor());
btn_ad.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_more.add(game.getLabel("等待添加...").setFontScale(0.6f).getActor());

代码示例来源:origin: Var3D/var3dframe

btn_dialog.add(game.getLabel("对话框例子").setFontScale(0.6f).getActor());
btn_dialog.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_stage.add(game.getLabel("舞台例子").setFontScale(0.6f).getActor());
btn_stage.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_actors.add(game.getLabel("常用控件").setFontScale(0.6f).getActor());
btn_actors.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_card.add(game.getLabel("VCard示例").setFontScale(0.6f).getActor());
btn_card.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_share .add(game.getLabel("分享示例").setFontScale(0.6f).getActor());
btn_share .addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_touchpad.add(game.getLabel("摇杆示例").setFontScale(0.6f).getActor());
btn_touchpad.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_more.add(game.getLabel("等待添加...").setFontScale(0.6f).getActor());
btn_more.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {

代码示例来源:origin: Var3D/var3dframe

btn_tost.add(game.getLabel(R.strings.tost).getActor());
btn_tost.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_dialog.add(game.getLabel("等比例对话框").getActor());
btn_dialog.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {
btn_dialogfull.add(game.getLabel("拉伸全屏对话框").getActor());
btn_dialogfull.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {

代码示例来源:origin: Var3D/var3dframe

@Override
public void init()
{
  //设置背景
  setBackground(Color.DARK_GRAY);
  //创建标题
  VLabel lab_title = game.getLabel("VCard示例").setPosition(getWidth() / 2, getTop() - 10, Align.top).touchOff().show();
  //返回
  Button btn_back = game.getButton().setColor(Color.valueOf("ff2266")).setSize(120, 40)
      .setPosition(getLeft(), pref().getY() - 10, Align.topLeft).addClicAction().show();
  btn_back.add(game.getLabel("返回").setFontScale(0.6f).getActor());
  btn_back.addListener(new ClickListener() {
    public void clicked(InputEvent event, float x, float y) {
      //stage跳转
      game.setStage(StageMain.class);
    }
  });
  final VCard vCard = new VCard(labels[0], new NinePatchDrawable(game.getNinePatch("image/card_background.png", 8)).tint(Color.GRAY));
  game.getUI(vCard).setPosition(200,200).show();
  addAction(Actions.forever(Actions.delay(1f,Actions.run(new Runnable() {
    @Override
    public void run() {
      vCard.changeActor(labels[labelsIndex = (labelsIndex + 1) % labels.length]);
    }
  }))));
}

代码示例来源:origin: Var3D/var3dframe

btn_back.add(game.getLabel("返回").setFontScale(0.6f).getActor());
btn_back.addListener(new ClickListener() {
  public void clicked(InputEvent event, float x, float y) {

相关文章