Package com.badlogic.gdx.scenes.scene2d

Examples of com.badlogic.gdx.scenes.scene2d.Stage


  public void hideList () {
    if (!scroll.hasParent()) return;
    selected = null;
    scroll.list.setTouchable(Touchable.disabled);
    Stage stage = scroll.getStage();
    if (stage != null) {
      if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
      Actor actor = stage.getScrollFocus();
      if (actor == null || actor.isDescendantOf(scroll)) stage.setScrollFocus(previousScrollFocus);
    }
    scroll.addAction(sequence(fadeOut(0.15f, Interpolation.fade), removeActor()));
  }
View Full Code Here


      assetManager.get(DEFAULT_MODEL_PARTICLE, Model.class).materials.get(0).set(new BlendingAttribute(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA, 1));
     
      //Ui
      stringBuilder = new StringBuilder();
      Skin skin = assetManager.get(DEFAULT_SKIN, Skin.class);
      ui = new Stage();
      fpsLabel = new Label("", skin);
      pointCountLabel = new Label("", skin);
      billboardCountLabel = new Label("", skin);
      modelInstanceCountLabel = new Label("", skin);
     
View Full Code Here

  public void hideList () {
    if (!scroll.hasParent()) return;
    selected = null;
    scroll.list.setTouchable(Touchable.disabled);
    Stage stage = scroll.getStage();
    if (stage != null) {
      if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
      Actor actor = stage.getScrollFocus();
      if (actor == null || actor.isDescendantOf(scroll)) stage.setScrollFocus(previousScrollFocus);
    }
    scroll.addAction(sequence(fadeOut(0.15f, Interpolation.fade), removeActor()));
  }
View Full Code Here

    fadeDelay = fadeDelaySeconds;
  }

  void cancelTouchFocusedChild (InputEvent event) {
    if (!cancelTouchFocus) return;
    Stage stage = getStage();
    if (stage != null) stage.cancelTouchFocus(flickScrollListener, this);
  }
View Full Code Here

      public void scrollFocusChanged (FocusEvent event, Actor actor, boolean focused) {
        if (!focused) focusChanged(event);
      }

      private void focusChanged (FocusEvent event) {
        Stage stage = getStage();
        if (isModal && stage != null && stage.getRoot().getChildren().size > 0
          && stage.getRoot().getChildren().peek() == Dialog.this) { // Dialog is top most actor.
          Actor newFocusedActor = event.getRelatedActor();
          if (newFocusedActor != null && !newFocusedActor.isDescendantOf(Dialog.this)) event.cancel();
        }
      }
    });
View Full Code Here

    return this;
  }

  /** Hides the dialog with the given action and then removes it from the stage. */
  public void hide (Action action) {
    Stage stage = getStage();
    if (stage != null) {
      if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null;
      Actor actor = stage.getKeyboardFocus();
      if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus);

      if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
      actor = stage.getScrollFocus();
      if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus);
    }
    if (action != null) {
      addCaptureListener(ignoreTouchDown);
      addAction(sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor()));
    } else
View Full Code Here

        float width = getWidth(), height = getHeight();
        float windowX = getX(), windowY = getY();

        float minWidth = getMinWidth(), maxWidth = getMaxWidth();
        float minHeight = getMinHeight(), maxHeight = getMaxHeight();
        Stage stage = getStage();
        boolean clampPosition = keepWithinStage && getParent() == stage.getRoot();

        if ((edge & MOVE) != 0) {
          float amountX = x - startX, amountY = y - startY;
          windowX += amountX;
          windowY += amountY;
        }
        if ((edge & Align.left) != 0) {
          float amountX = x - startX;
          if (width - amountX < minWidth) amountX = -(minWidth - width);
          if (clampPosition && windowX + amountX < 0) amountX = -windowX;
          width -= amountX;
          windowX += amountX;
        }
        if ((edge & Align.bottom) != 0) {
          float amountY = y - startY;
          if (height - amountY < minHeight) amountY = -(minHeight - height);
          if (clampPosition && windowY + amountY < 0) amountY = -windowY;
          height -= amountY;
          windowY += amountY;
        }
        if ((edge & Align.right) != 0) {
          float amountX = x - lastX;
          if (width + amountX < minWidth) amountX = minWidth - width;
          if (clampPosition && windowX + width + amountX > stage.getWidth()) amountX = stage.getWidth() - windowX - width;
          width += amountX;
        }
        if ((edge & Align.top) != 0) {
          float amountY = y - lastY;
          if (height + amountY < minHeight) amountY = minHeight - height;
          if (clampPosition && windowY + height + amountY > stage.getHeight())
            amountY = stage.getHeight() - windowY - height;
          height += amountY;
        }
        lastX = x;
        lastY = y;
        setBounds(Math.round(windowX), Math.round(windowY), Math.round(width), Math.round(height));
View Full Code Here

    return style;
  }

  void keepWithinStage () {
    if (!keepWithinStage) return;
    Stage stage = getStage();
    if (getParent() == stage.getRoot()) {
      float parentWidth = stage.getWidth();
      float parentHeight = stage.getHeight();
      if (getX() < 0) setX(0);
      if (getRight() > parentWidth) setX(parentWidth - getWidth());
      if (getY() < 0) setY(0);
      if (getTop() > parentHeight) setY(parentHeight - getHeight());
    }
View Full Code Here

      if (getTop() > parentHeight) setY(parentHeight - getHeight());
    }
  }

  public void draw (Batch batch, float parentAlpha) {
    Stage stage = getStage();
    if (stage.getKeyboardFocus() == null) stage.setKeyboardFocus(this);

    keepWithinStage();

    if (style.stageBackground != null) {
      stageToLocalCoordinates(tmpPosition.set(0, 0));
      stageToLocalCoordinates(tmpSize.set(stage.getWidth(), stage.getHeight()));
      drawStageBackground(batch, parentAlpha, getX() + tmpPosition.x, getY() + tmpPosition.y, getX() + tmpSize.x, getY()
        + tmpSize.y);
    }

    super.draw(batch, parentAlpha);
View Full Code Here

    }
  }

  @Override
  public void draw (Batch batch, float parentAlpha) {
    Stage stage = getStage();
    boolean focused = stage != null && stage.getKeyboardFocus() == this;

    final BitmapFont font = style.font;
    final Color fontColor = (disabled && style.disabledFontColor != null) ? style.disabledFontColor
      : ((focused && style.focusedFontColor != null) ? style.focusedFontColor : style.fontColor);
    final Drawable selection = style.selection;
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.scenes.scene2d.Stage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.