com.badlogic.gdx.scenes.scene2d.Actor.isVisible()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(140)

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

Actor.isVisible介绍

暂无

代码示例

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

/** Returns true if this actor and all ancestors are visible. */
public boolean ancestorsVisible () {
  Actor actor = this;
  do {
    if (!actor.isVisible()) return false;
    actor = actor.parent;
  } while (actor != null);
  return true;
}

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

/** Returns true if this actor and all ancestors are visible. */
public boolean ancestorsVisible () {
  Actor actor = this;
  do {
    if (!actor.isVisible()) return false;
    actor = actor.parent;
  } while (actor != null);
  return true;
}

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

/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains
 * the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the
 * bottom left of the actor and width,height is the upper right).
 * <p>
 * This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not
 * occur on this Actor.
 * <p>
 * The default implementation returns this actor if the point is within this actor's bounds and this actor is visible.
 * @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}.
 * @see Touchable */
public Actor hit (float x, float y, boolean touchable) {
  if (touchable && this.touchable != Touchable.enabled) return null;
  if (!isVisible()) return null;
  return x >= 0 && x < width && y >= 0 && y < height ? this : null;
}

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

/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains
 * the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the
 * bottom left of the actor and width,height is the upper right).
 * <p>
 * This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not
 * occur on this Actor.
 * <p>
 * The default implementation returns this actor if the point is within this actor's bounds and this actor is visible.
 * @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}.
 * @see Touchable */
public Actor hit (float x, float y, boolean touchable) {
  if (touchable && this.touchable != Touchable.enabled) return null;
  if (!isVisible()) return null;
  return x >= 0 && x < width && y >= 0 && y < height ? this : null;
}

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

for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  float cx = child.x, cy = child.y;
  if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom)
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  float cx = child.x, cy = child.y;
  if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom) {
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  child.draw(batch, parentAlpha);
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  float cx = child.x, cy = child.y;
  child.x = cx + offsetX;

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

for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  float cx = child.x, cy = child.y;
  if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom)
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  float cx = child.x, cy = child.y;
  if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom) {
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  child.draw(batch, parentAlpha);
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  float cx = child.x, cy = child.y;
  child.x = cx + offsetX;

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

for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  if (!child.getDebug() && !(child instanceof Group)) continue;
  child.drawDebug(shapes);
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  if (!child.getDebug() && !(child instanceof Group)) continue;
  float cx = child.x, cy = child.y;

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

for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  if (!child.getDebug() && !(child instanceof Group)) continue;
  child.drawDebug(shapes);
for (int i = 0, n = children.size; i < n; i++) {
  Actor child = actors[i];
  if (!child.isVisible()) continue;
  if (!child.getDebug() && !(child instanceof Group)) continue;
  float cx = child.x, cy = child.y;

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

@Override
public void draw (Batch batch, float parentAlpha) {
  validate();
  Color color = getColor();
  float alpha = color.a * parentAlpha;
  applyTransform(batch, computeTransform());
  if (firstWidget != null && firstWidget.isVisible()) {
    batch.flush();
    getStage().calculateScissors(firstWidgetBounds, tempScissors);
    if (ScissorStack.pushScissors(tempScissors)) {
      firstWidget.draw(batch, alpha);
      batch.flush();
      ScissorStack.popScissors();
    }
  }
  if (secondWidget != null && secondWidget.isVisible()) {
    batch.flush();
    getStage().calculateScissors(secondWidgetBounds, tempScissors);
    if (ScissorStack.pushScissors(tempScissors)) {
      secondWidget.draw(batch, alpha);
      batch.flush();
      ScissorStack.popScissors();
    }
  }
  batch.setColor(color.r, color.g, color.b, alpha);
  style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height);
  resetTransform(batch);
}

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

@Override
public void draw (Batch batch, float parentAlpha) {
  validate();
  Color color = getColor();
  float alpha = color.a * parentAlpha;
  applyTransform(batch, computeTransform());
  if (firstWidget != null && firstWidget.isVisible()) {
    batch.flush();
    getStage().calculateScissors(firstWidgetBounds, tempScissors);
    if (ScissorStack.pushScissors(tempScissors)) {
      firstWidget.draw(batch, alpha);
      batch.flush();
      ScissorStack.popScissors();
    }
  }
  if (secondWidget != null && secondWidget.isVisible()) {
    batch.flush();
    getStage().calculateScissors(secondWidgetBounds, tempScissors);
    if (ScissorStack.pushScissors(tempScissors)) {
      secondWidget.draw(batch, alpha);
      batch.flush();
      ScissorStack.popScissors();
    }
  }
  batch.setColor(color.r, color.g, color.b, alpha);
  style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height);
  resetTransform(batch);
}

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

@Override
  public float get (Actor context) {
    if (actor != null) context = actor;
    return context.isVisible() ? constant : 0;
  }
}

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

/** Returns true if this actor and all ancestors are visible. */
public boolean ancestorsVisible () {
  Actor actor = this;
  do {
    if (!actor.isVisible()) return false;
    actor = actor.parent;
  } while (actor != null);
  return true;
}

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

/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains
 * the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the
 * bottom left of the actor and width,height is the upper right).
 * <p>
 * This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not
 * occur on this Actor.
 * <p>
 * The default implementation returns this actor if the point is within this actor's bounds and this actor is visible.
 * @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}.
 * @see Touchable */
public Actor hit (float x, float y, boolean touchable) {
  if (touchable && this.touchable != Touchable.enabled) return null;
  if (!isVisible()) return null;
  return x >= 0 && x < width && y >= 0 && y < height ? this : null;
}

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

public boolean visible(){
  return t.isVisible();
}

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

/**
 * Checks if actor is visible in stage acknowledging parent visibility.
 * If any parent returns false from isVisible then this method return false.
 * True is returned when this actor and all its parent are visible.
 */
private boolean isActorVisibleInStage (Actor actor) {
  if (actor == null) return true;
  if (actor.isVisible() == false) return false;
  return isActorVisibleInStage(actor.getParent());
}

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

@Override
  public void clicked(InputEvent event, float x, float y) {
    Actor popup = findActor("popup");
    if (popup.isVisible()) {
      button.setText("Show Popup");
      popup.setVisible(false);
    } else {
      button.setText("Hide Popup");
      popup.setVisible(true);
      popup.addAction(Actions.sequence(Actions.alpha(0), Actions.alpha(1, 0.5f)));
    }
  }
});

代码示例来源:origin: jsjolund/GdxDemo3D

@Override
public void draw() {
  batch.begin();
  for (Actor actor : getActors()) {
    if (actor.isVisible()) {
      actor.draw(batch, 1);
    }
  }
  batch.end();
  if (DebugViewSettings.drawUIDebug) {
    shapeRenderer.begin();
    rootTable.drawDebug(shapeRenderer);
    shapeRenderer.end();
  }
  cameraController.update();
}

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

@Override
public Actor hit(float x, float y, boolean touchable) {
  if (touchable && getTouchable() == Touchable.disabled) return null;
  Vector2 point = tmpVec2;
  Actor[] childrenArray = getChildren().items;
  for (int i = getChildren().size - 1; i >= 0; i--) {
    Actor child = childrenArray[i];
    if (!child.isVisible()) continue;
    child.parentToLocalCoordinates(point.set(x, y));
    Actor hit = child.hit(point.x, point.y, touchable);
    if (hit != null) return hit;
  }
  // Extend regular touch area by EXTRA_TOUCH_SPACE (to allow line snap beyond PatchGrid borders)
  if (touchable && this.getTouchable() != Touchable.enabled) return null;
  return x >= -EXTRA_TOUCH_SPACE &&
      x < getWidth() + EXTRA_TOUCH_SPACE *2f &&
      y >= -EXTRA_TOUCH_SPACE &&
      y < getHeight() + EXTRA_TOUCH_SPACE *2f ?
      this : null;
}

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

@Override
public Actor hit (float x, float y, boolean touchable) {
  if (touchable && getTouchable() == Touchable.disabled) return null;
  Vector2 point = tmpVec2;
  SnapshotArray<Actor> children = getChildren();
  Actor[] childrenArray = children.items;
  for (int i = children.size - 1; i >= 0; i--) {
    Actor child = childrenArray[i];
    if (!child.isVisible()) continue;
    child.parentToLocalCoordinates(point.set(x, y));
    Actor hit = child.hit(point.x, point.y, touchable);
    if (hit != null) return hit;
  }
  if (touchable && getTouchable() != Touchable.enabled) return null;
  return x >= 0 && x < getWidth() / getScaleX() && y >= 0 && y < getHeight() / getScaleY() ? this : null;
}

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

@Override
public void draw (Batch batch, float parentAlpha) {
  validate();
  Color color = getColor();
  float alpha = color.a * parentAlpha;
  applyTransform(batch, computeTransform());
  if (firstWidget != null && firstWidget.isVisible()) {
    batch.flush();
    getStage().calculateScissors(firstWidgetBounds, tempScissors);
    if (ScissorStack.pushScissors(tempScissors)) {
      firstWidget.draw(batch, alpha);
      batch.flush();
      ScissorStack.popScissors();
    }
  }
  if (secondWidget != null && secondWidget.isVisible()) {
    batch.flush();
    getStage().calculateScissors(secondWidgetBounds, tempScissors);
    if (ScissorStack.pushScissors(tempScissors)) {
      secondWidget.draw(batch, alpha);
      batch.flush();
      ScissorStack.popScissors();
    }
  }
  batch.setColor(color.r, color.g, color.b, alpha);
  style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height);
  resetTransform(batch);
}

相关文章