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

项目:ingress-indonesia-dev    文件:ScrollPane.java   
public void draw(SpriteBatch paramSpriteBatch, float paramFloat)
{
  if (this.widget == null)
    return;
  validate();
  applyTransform(paramSpriteBatch, computeTransform());
  if (this.scrollX)
    this.hKnobBounds.x = (this.hScrollBounds.x + (int)((this.hScrollBounds.width - this.hKnobBounds.width) * getScrollPercentX()));
  if (this.scrollY)
    this.vKnobBounds.y = (this.vScrollBounds.y + (int)((this.vScrollBounds.height - this.vKnobBounds.height) * (1.0F - getScrollPercentY())));
  float f1 = this.widgetAreaBounds.y;
  if (!this.scrollY);
  for (float f2 = f1 - (int)this.maxY; ; f2 = f1 - (int)(this.maxY * (1.0F - this.amountY / this.maxY)))
  {
    float f3 = this.widgetAreaBounds.x;
    if (this.scrollX)
      f3 -= (int)(this.maxX * this.amountX / this.maxX);
    this.widget.setPosition(f3, f2);
    if ((this.widget instanceof Cullable))
    {
      this.widgetCullingArea.x = (-this.widget.getX() + this.widgetAreaBounds.x);
      this.widgetCullingArea.y = (-this.widget.getY() + this.widgetAreaBounds.y);
      this.widgetCullingArea.width = this.widgetAreaBounds.width;
      this.widgetCullingArea.height = this.widgetAreaBounds.height;
      ((Cullable)this.widget).setCullingArea(this.widgetCullingArea);
    }
    ScissorStack.calculateScissors(getStage().getCamera(), paramSpriteBatch.getTransformMatrix(), this.widgetAreaBounds, this.scissorBounds);
    Color localColor = getColor();
    paramSpriteBatch.setColor(localColor.r, localColor.g, localColor.b, paramFloat * localColor.a);
    if (this.style.background != null)
      this.style.background.draw(paramSpriteBatch, 0.0F, 0.0F, getWidth(), getHeight());
    paramSpriteBatch.flush();
    if (ScissorStack.pushScissors(this.scissorBounds))
    {
      drawChildren(paramSpriteBatch, paramFloat);
      ScissorStack.popScissors();
    }
    paramSpriteBatch.setColor(localColor.r, localColor.g, localColor.b, paramFloat * localColor.a * Interpolation.fade.apply(this.fadeAlpha / this.fadeAlphaSeconds));
    if (this.scrollX)
    {
      if (this.style.hScroll != null)
        this.style.hScroll.draw(paramSpriteBatch, this.hScrollBounds.x, this.hScrollBounds.y, this.hScrollBounds.width, this.hScrollBounds.height);
      if (this.style.hScrollKnob != null)
        this.style.hScrollKnob.draw(paramSpriteBatch, this.hKnobBounds.x, this.hKnobBounds.y, this.hKnobBounds.width, this.hKnobBounds.height);
    }
    if (this.scrollY)
    {
      if (this.style.vScroll != null)
        this.style.vScroll.draw(paramSpriteBatch, this.vScrollBounds.x, this.vScrollBounds.y, this.vScrollBounds.width, this.vScrollBounds.height);
      if (this.style.vScrollKnob != null)
        this.style.vScrollKnob.draw(paramSpriteBatch, this.vKnobBounds.x, this.vKnobBounds.y, this.vKnobBounds.width, this.vKnobBounds.height);
    }
    resetTransform(paramSpriteBatch);
    return;
  }
}