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

x33g5p2x  于2022-01-24 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(127)

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

Label.setColor介绍

暂无

代码示例

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

public Payload dragStart (InputEvent event, float x, float y, int pointer) {
    Payload payload = new Payload();
    payload.setObject("Some payload!");
    payload.setDragActor(new Label("Some payload!", skin));
    Label validLabel = new Label("Some payload!", skin);
    validLabel.setColor(0, 1, 0, 1);
    payload.setValidDragActor(validLabel);
    Label invalidLabel = new Label("Some payload!", skin);
    invalidLabel.setColor(1, 0, 0, 1);
    payload.setInvalidDragActor(invalidLabel);
    return payload;
  }
});

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

fps.setColor(0, 1, 0, 1);
ui.addActor(fps);

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

statusLabel.setAlignment(Align.center);
statusLabel.setPosition(Gdx.graphics.getWidth() * 0.5f - statusLabel.getWidth() * 0.5f, 30f);
statusLabel.setColor(Color.CYAN);
stage.addActor(statusLabel);

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

label.setColor(Color.GREEN);
label.setAlignment(Align.bottom | Align.right);
table.add(label).minWidth(200 * scale).minHeight(110 * scale).fill().row();

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-plugin-profiler

private void setChildColor(Color color) {
  name.setColor(color);
  max.setColor(color);
  localMax.setColor(color);
  avg.setColor(color);
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

private void setChildColor(Color color) {
  name.setColor(color);
  max.setColor(color);
  localMax.setColor(color);
  avg.setColor(color);
}

代码示例来源:origin: peakgames/libgdx-stagebuilder

public void setShadowColor(Color color){
  shadowLabel.setColor(color);
}

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

public void setColor(float r, float g, float b, float a) {
  super.setColor(r, g, b, a);
  if (isStroke) strokeColor.set(r, g, b, a);
}

代码示例来源:origin: langurmonkey/gaiasky

@Override
public void setDisabled(boolean isDisabled) {
  super.setDisabled(isDisabled);
  if (isDisabled) {
    getLabel().setColor(Color.GRAY);
  } else {
    getLabel().setColor(regularColor);
  }
}

代码示例来源:origin: LonamiWebs/Klooni1010

@Override
public void draw(SpriteBatch batch) {
  super.draw(batch);
  int timeLeft = pausedTimeLeft < 0 ? getTimeLeft() : pausedTimeLeft;
  timeLeftLabel.setText(Integer.toString(timeLeft));
  timeLeftLabel.setColor(Klooni.theme.currentScore);
  timeLeftLabel.draw(batch, 1f);
}

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

/**
 * 创建TextButton
 */
public UI<VTextButton> getTextButton(String text, Color fontColor, Color up) {
  UI<VTextButton> ui = getTextButton(text, up);
  VTextButton button = ui.getActor();
  button.getLabel().setColor(fontColor);
  return ui;
}

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

/**
 * 创建TextButton
 */
public UI<VTextButton> getTextButton(String text, Color fontColor, String up) {
  UI<VTextButton> ui = getTextButton(text, up);
  VTextButton button = ui.getActor();
  button.getLabel().setColor(fontColor);
  return ui;
}

代码示例来源:origin: LonamiWebs/Klooni1010

ShopCard(final Klooni game, final GameLayout layout,
     final String itemName, final Color backgroundColor) {
  this.game = game;
  Label.LabelStyle labelStyle = new Label.LabelStyle();
  labelStyle.font = game.skin.getFont("font_small");
  priceLabel = new Label("", labelStyle);
  nameLabel = new Label(itemName, labelStyle);
  Color labelColor = Theme.shouldUseWhite(backgroundColor) ? Color.WHITE : Color.BLACK;
  priceLabel.setColor(labelColor);
  nameLabel.setColor(labelColor);
  priceBounds = new Rectangle();
  nameBounds = new Rectangle();
  layout.update(this);
}

代码示例来源:origin: LonamiWebs/Klooni1010

public void draw(SpriteBatch batch) {
  // If we beat a new record, the cup color will linear interpolate to the high score color
  cupColor.lerp(isNewRecord() ? Klooni.theme.highScore : Klooni.theme.currentScore, 0.05f);
  batch.setColor(cupColor);
  batch.draw(cupTexture, cupArea.x, cupArea.y, cupArea.width, cupArea.height);
  int roundShown = MathUtils.round(shownScore);
  if (roundShown != currentScore) {
    shownScore = Interpolation.linear.apply(shownScore, currentScore, 0.1f);
    currentScoreLabel.setText(Integer.toString(MathUtils.round(shownScore)));
  }
  currentScoreLabel.setColor(Klooni.theme.currentScore);
  currentScoreLabel.draw(batch, 1f);
  highScoreLabel.setColor(Klooni.theme.highScore);
  highScoreLabel.draw(batch, 1f);
}

代码示例来源:origin: LonamiWebs/Klooni1010

void run(final Batch batch) {
  // Update
  lifetime += SPEED * Gdx.graphics.getDeltaTime();
  if (lifetime > 1f)
    lifetime = 1f;
  // Render
  label.setColor(Klooni.theme.bonus);
  label.setFontScale(Interpolation.elasticOut.apply(0f, 1f, lifetime));
  float opacity = Interpolation.linear.apply(1f, 0f, lifetime);
  label.draw(batch, opacity);
}

代码示例来源:origin: langurmonkey/gaiasky

public MessagesInterface(Skin skin, Object lock) {
  super(skin);
  customElements = new HashMap<Integer, Widget>();
  headline = new OwnLabel("", skin, "headline");
  headline.setColor(1, 1, 0, 1);
  subhead = new OwnLabel("", skin, "subhead");
  this.add(headline).left();
  this.row();
  this.add(subhead).left();
  this.lock = lock;
  EventManager.instance.subscribe(this, Events.POST_HEADLINE_MESSAGE, Events.CLEAR_HEADLINE_MESSAGE, Events.POST_SUBHEAD_MESSAGE, Events.CLEAR_SUBHEAD_MESSAGE, Events.CLEAR_MESSAGES);
}

代码示例来源:origin: kotcrab/vis-ui

private void updateWidgets () {
  for (Disableable disableable : disableTargets) {
    disableable.setDisabled(formInvalid);
  }
  if (messageLabel != null) {
    if (errorMsgText != null) {
      messageLabel.setText(errorMsgText);
    } else {
      messageLabel.setText(successMsg); //setText will default to "" if successMsg is null
    }
    Color targetColor = errorMsgText != null ? style.errorLabelColor : style.validLabelColor;
    if (targetColor != null && style.colorTransitionDuration != 0) {
      messageLabel.addAction(Actions.color(targetColor, style.colorTransitionDuration));
    } else {
      messageLabel.setColor(targetColor);
    }
  }
}

代码示例来源:origin: LonamiWebs/Klooni1010

@Override
public void draw(Batch batch, float parentAlpha) {
  long now = TimeUtils.millis();
  if (now > nextTextUpdate) {
    interpolateText();
    nextTextUpdate = TimeUtils.millis() + SHOW_ONE_CHARACTER_EVERY;
    if (now > nextTempRevertUpdate && showingTemp) {
      // We won't be showing temp anymore if the current money is shown
      showCurrentMoney();
    }
  }
  setColor(Klooni.theme.bandColor);
  infoLabel.setColor(Klooni.theme.textColor);
  super.draw(batch, parentAlpha);
}

代码示例来源:origin: langurmonkey/gaiasky

private Array<Node> createTree(Array<SceneGraphNode> nodes) {
  Array<Node> treeNodes = new Array<Node>(nodes.size);
  for (SceneGraphNode node : nodes) {
    Label l = new Label(node.name, skin, "ui-10");
    l.setColor(Color.BLACK);
    Node treeNode = new Node(l);
    if (node.children != null && node.children.size != 0) {
      treeNode.addAll(createTree(node.children));
    }
    treeNodes.add(treeNode);
    treeToModel.add(node, treeNode);
  }
  return treeNodes;
}

代码示例来源:origin: LonamiWebs/Klooni1010

ShareScoreScreen(final Klooni game, final Screen lastScreen,
         final int score, final boolean timeMode) {
  this.game = game;
  this.lastScreen = lastScreen;
  this.score = score;
  this.timeMode = timeMode;
  final Label.LabelStyle labelStyle = new Label.LabelStyle();
  labelStyle.font = game.skin.getFont("font_small");
  infoLabel = new Label("Generating image...", labelStyle);
  infoLabel.setColor(Klooni.theme.textColor);
  infoLabel.setAlignment(Align.center);
  infoLabel.layout();
  infoLabel.setPosition(
      (Gdx.graphics.getWidth() - infoLabel.getWidth()) * 0.5f,
      (Gdx.graphics.getHeight() - infoLabel.getHeight()) * 0.5f);
  spriteBatch = new SpriteBatch();
}

相关文章