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

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

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

Label.draw介绍

暂无

代码示例

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

public void draw (Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    drawn++;
  }
});

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

@Override
public void draw(Batch batch, float parentAlpha) {
  shadowLabel.draw(batch, parentAlpha);
  super.draw(batch, parentAlpha);
}

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

@Override
public void draw(Batch batch, float parentAlpha) {
  super.draw(batch, parentAlpha);
  final float x = getX(), y = getY();
  nameLabel.setBounds(x + nameBounds.x, y + nameBounds.y, nameBounds.width, nameBounds.height);
  nameLabel.draw(batch, parentAlpha);
  priceLabel.setBounds(x + priceBounds.x, y + priceBounds.y, priceBounds.width, priceBounds.height);
  priceLabel.draw(batch, parentAlpha);
}

代码示例来源: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: LonamiWebs/Klooni1010

@Override
public void render(float delta) {
  Klooni.theme.glClearBackground();
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  spriteBatch.begin();
  infoLabel.draw(spriteBatch, 1);
  spriteBatch.end();
}

代码示例来源:origin: dingjibang/GDX-RPG

@Override
public void draw(Batch batch, float parentAlpha) {
  if (warp && maxWidth != null) {
    int width = Text.getTextWidth(getStyle().font, oldText.toString());
    if (width > maxWidth)
      setWidth(maxWidth);
  }
  if (overflow && !oldText.equals(getText().toString())) {
    oldText = getText().toString();// cpy
    if (Text.getTextWidth(getStyle().font, oldText.toString()) > getWidth())
      for (int i = 0; i < oldText.length(); i++) {
        CharSequence sub = oldText.subSequence(0, oldText.length() - i);
        int width = Text.getTextWidth(getStyle().font, sub.toString());
        if (width < getWidth()) {
          overflowd = (sub.length() <= 3 ? sub : sub.subSequence(0, sub.length() - 3) + "…");
          break;
        }
      }
    else
      overflowd = oldText;
  }
  if (overflow) {
    setText(overflowd);
    super.draw(batch, parentAlpha);
    setText(oldText);
  } else {
    super.draw(batch, parentAlpha);
  }
}

代码示例来源: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: LonamiWebs/Klooni1010

@Override
public void draw(Batch batch, float parentAlpha) {
  // TODO This is not the best way to apply the transformation, but, oh well
  float x = getParent().getX();
  float y = getParent().getY();
  // TODO For some strange reason, the texture coordinates and label coordinates are different
  Vector2 pos = localToStageCoordinates(new Vector2(x, y));
  batch.setColor(Klooni.theme.bandColor);
  batch.draw(bandTexture, pos.x, pos.y, getWidth(), getHeight());
  scoreLabel.setBounds(x + scoreBounds.x, y + scoreBounds.y, scoreBounds.width, scoreBounds.height);
  scoreLabel.setText(Integer.toString(scorer.getCurrentScore()));
  scoreLabel.setColor(Klooni.theme.textColor);
  scoreLabel.draw(batch, parentAlpha);
  infoLabel.setBounds(x + infoBounds.x, y + infoBounds.y, infoBounds.width, infoBounds.height);
  infoLabel.setColor(Klooni.theme.textColor);
  infoLabel.draw(batch, parentAlpha);
}

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

@Override
public void draw (Batch batch, float parentAlpha) {
  super.draw(batch, parentAlpha);
  foregroundImage.rotateBy(5);
  if(fullScreen) {
    batch.end();
    
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    
    shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
    shapeRenderer.begin(ShapeType.Filled);
    shapeRenderer.setColor(0f, 0f, 0f, alpha);
    shapeRenderer.rect(0, 0, boundaryWidth, boundaryHeight);
    shapeRenderer.end();
    
    Gdx.gl.glDisable(GL20.GL_BLEND);
    
    batch.begin();
    
    this.backgroundImage.draw(batch, parentAlpha);
    this.foregroundImage.draw(batch, parentAlpha);
    if(messageLabel != null) {				
      this.messageLabel.draw(batch, parentAlpha);
    }
  }
  if (timeOutDuration > 0 && this.showTime + this.timeOutDuration < System.currentTimeMillis()) {
    this.hide();
  }
}

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

label.setColor(Color.BLACK);
label.setPosition(40, 500);
label.draw(batch, 1);
label.draw(batch, 1);

相关文章