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

x33g5p2x  于2022-02-03 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(143)

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

WidgetGroup.draw介绍

[英]If this method is overridden, the super method or #validate() should be called to ensure the widget group is laid out.
[中]如果覆盖了此方法,则应调用super方法或#validate()以确保小部件组的布局。

代码示例

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

public void draw (Batch batch, float parentAlpha) {
  drawBackground(batch, parentAlpha);
  Color color = getColor();
  batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
  float plusMinusWidth = Math.max(style.plus.getMinWidth(), style.minus.getMinWidth());
  draw(batch, rootNodes, padding, plusMinusWidth);
  super.draw(batch, parentAlpha); // Draw actors.
}

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

public void draw (Batch batch, float parentAlpha) {
  drawBackground(batch, parentAlpha);
  Color color = getColor();
  batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
  float plusMinusWidth = Math.max(style.plus.getMinWidth(), style.minus.getMinWidth());
  draw(batch, rootNodes, padding, plusMinusWidth);
  super.draw(batch, parentAlpha); // Draw actors.
}

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

public void draw (Batch batch, float parentAlpha) {
  validate();
  if (isTransform()) {
    applyTransform(batch, computeTransform());
    drawBackground(batch, parentAlpha, 0, 0);
    if (clip) {
      batch.flush();
      float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
      if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
        getHeight() - padBottom - padTop.get(this))) {
        drawChildren(batch, parentAlpha);
        batch.flush();
        clipEnd();
      }
    } else
      drawChildren(batch, parentAlpha);
    resetTransform(batch);
  } else {
    drawBackground(batch, parentAlpha, getX(), getY());
    super.draw(batch, parentAlpha);
  }
}

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

public void draw (Batch batch, float parentAlpha) {
  validate();
  if (isTransform()) {
    applyTransform(batch, computeTransform());
    drawBackground(batch, parentAlpha, 0, 0);
    if (clip) {
      batch.flush();
      float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
      if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
        getHeight() - padBottom - padTop.get(this))) {
        drawChildren(batch, parentAlpha);
        batch.flush();
        clipEnd();
      }
    } else
      drawChildren(batch, parentAlpha);
    resetTransform(batch);
  } else {
    drawBackground(batch, parentAlpha, getX(), getY());
    super.draw(batch, parentAlpha);
  }
}

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

public void draw (Batch batch, float parentAlpha) {
  validate();
  if (isTransform()) {
    applyTransform(batch, computeTransform());
    drawBackground(batch, parentAlpha, 0, 0);
    if (clip) {
      batch.flush();
      float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
      if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
        getHeight() - padBottom - padTop.get(this))) {
        drawChildren(batch, parentAlpha);
        batch.flush();
        clipEnd();
      }
    } else
      drawChildren(batch, parentAlpha);
    resetTransform(batch);
  } else {
    drawBackground(batch, parentAlpha, getX(), getY());
    super.draw(batch, parentAlpha);
  }
}

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

public void draw (Batch batch, float parentAlpha) {
  validate();
  if (isTransform()) {
    applyTransform(batch, computeTransform());
    drawBackground(batch, parentAlpha, 0, 0);
    if (clip) {
      batch.flush();
      float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
      if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
        getHeight() - padBottom - padTop.get(this))) {
        drawChildren(batch, parentAlpha);
        batch.flush();
        clipEnd();
      }
    } else
      drawChildren(batch, parentAlpha);
    resetTransform(batch);
  } else {
    drawBackground(batch, parentAlpha, getX(), getY());
    super.draw(batch, parentAlpha);
  }
}

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

public void draw (Batch batch, float parentAlpha) {
  drawBackground(batch, parentAlpha);
  Color color = getColor();
  batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
  float plusMinusWidth = Math.max(style.plus.getMinWidth(), style.minus.getMinWidth());
  draw(batch, rootNodes, padding, plusMinusWidth);
  super.draw(batch, parentAlpha); // Draw actors.
}

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

@Override
public void draw (Batch batch, float parentAlpha) {
  if (currentHeight > 1) {
    batch.flush();
    boolean clipEnabled = clipBegin(getX(), getY(), getWidth(), currentHeight);
    super.draw(batch, parentAlpha);
    batch.flush();
    if (clipEnabled) clipEnd();
  }
}

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

@Override
public void draw (Batch batch, float parentAlpha) {
  if (currentWidth > 1) {
    batch.flush();
    boolean clipEnabled = clipBegin(getX(), getY(), currentWidth, getHeight());
    super.draw(batch, parentAlpha);
    batch.flush();
    if (clipEnabled) clipEnd();
  }
}

代码示例来源:origin: mbrlabs/Mundus

@Override
public void draw(Batch batch, float parentAlpha) {
  if (currentHeight > 1) {
    batch.flush();
    boolean clipEnabled = clipBegin(getX(), getY(), getWidth(), currentHeight);
    super.draw(batch, parentAlpha);
    batch.flush();
    if (clipEnabled) clipEnd();
  }
}

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

@Override
public void draw(Batch batch, float parentAlpha) {
  if (!disabled && lineDragListener.isHovered() && !lineDragListener.isDragging()) {
    int screenX = Gdx.input.getX();
    int screenY = Gdx.input.getY();
    Vector2 localCoord = screenToLocalCoordinates(tmpVec2.set(screenX, screenY));
    updateLinesHover(localCoord.x, localCoord.y);
  }
  if (!disabled) drawAreaGraphics(batch, parentAlpha);
  super.draw(batch, parentAlpha);
  drawGridNodes(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: peakgames/libgdx-stagebuilder

@Override
public void draw(Batch batch, float parentAlpha) {
  batch.flush();
  clipBegin();
  super.draw(batch, parentAlpha);
  clipEnd();
  if (this.drawDebug) {
    batch.end();
    debugRenderer.setProjectionMatrix(batch.getProjectionMatrix());
    debugRenderer.begin(ShapeRenderer.ShapeType.Line);
    debugRenderer.rect(getX() + getParent().getX(), getY() + getParent().getY(), getWidth(), getHeight());
    debugRenderer.setColor(Color.YELLOW);
    debugRenderer.end();
    batch.begin();
  }
}

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

public void draw (Batch batch, float parentAlpha) {
  validate();
  if (isTransform()) {
    applyTransform(batch, computeTransform());
    drawBackground(batch, parentAlpha, 0, 0);
    if (clip) {
      batch.flush();
      float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
      if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
        getHeight() - padBottom - padTop.get(this))) {
        drawChildren(batch, parentAlpha);
        batch.flush();
        clipEnd();
      }
    } else
      drawChildren(batch, parentAlpha);
    resetTransform(batch);
  } else {
    drawBackground(batch, parentAlpha, getX(), getY());
    super.draw(batch, parentAlpha);
  }
}

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

public void draw (Batch batch, float parentAlpha) {
  validate();
  if (isTransform()) {
    applyTransform(batch, computeTransform());
    drawBackground(batch, parentAlpha, 0, 0);
    if (clip) {
      batch.flush();
      float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
      if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
        getHeight() - padBottom - padTop.get(this))) {
        drawChildren(batch, parentAlpha);
        batch.flush();
        clipEnd();
      }
    } else
      drawChildren(batch, parentAlpha);
    resetTransform(batch);
  } else {
    drawBackground(batch, parentAlpha, getX(), getY());
    super.draw(batch, parentAlpha);
  }
}

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

Gdx.gl.glDisable(GL20.GL_BLEND);
batch.begin();
super.draw(batch, parentAlpha );

相关文章