Пример #1
0
  @Override
  public void update(float deltaTime) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    int width = Gdx.graphics.getWidth();
    int height = Gdx.graphics.getHeight();

    viewport.update(width, height);

    renderMap();

    batch.begin();
    renderWorldEntities();
    batch.end();

    renderParticles();

    uiViewport.update(width, height);
    uiCamera.position.set(
        uiViewport.getWorldWidth() * 0.5f, uiViewport.getWorldHeight() * 0.5f, 0.0f);
    Env.game.getStage().draw();

    viewport.update(width, height);
    debugDrawWorld();

    uiViewport.update(width, height);
    debugDrawUI();

    if (previousWidth != width || previousHeight != height) {
      Env.game.resize(width, height);
      previousWidth = width;
      previousHeight = height;
    }
  }
  public GameStateManager(States s) {
    sb = new SpriteBatch();
    sr = new ShapeRenderer();
    setState(s, true);
    left = new Rectangle();
    right = new Rectangle();
    shoot = new Ellipse();
    jump = new Ellipse();
    start = new Rectangle();
    leftSt = new Rectangle();
    rightSt = new Rectangle();
    shootSt = new Ellipse();
    jumpSt = new Ellipse();
    startSt = new Rectangle();
    lefts = new boolean[MyConstants.NUM_TOUCHES];
    rights = new boolean[MyConstants.NUM_TOUCHES];
    shoots = new boolean[MyConstants.NUM_TOUCHES];
    jumps = new boolean[MyConstants.NUM_TOUCHES];
    starts = new boolean[MyConstants.NUM_TOUCHES];

    cam = new MyCamera();
    view = new StretchViewport(MyConstants.WOLRD_WIDTH, MyConstants.WORLD_HEIGHT, cam);
    view.apply(true);
    view.update((int) Game.SIZE.x, (int) Game.SIZE.y, true);
  }
Пример #3
0
 @Override
 // this does not do anything
 public void resize(int nWidth, int nHeight) {
   dAspect = nWidth / nHeight;
   nViewH = (int) (nViewW / dAspect);
   viewport.update(nViewW, nViewH);
   camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
 }
 @Override
 public void resize(int width, int height) {
   // Whenever a resize event occurs, the viewport needs to be informed
   // about it and updated. This will automatically recalculate the
   // viewport parameters and update the camera (centered to the screen)
   Gdx.app.log(TAG, "Resizing to " + width + "x" + height);
   viewport.update(width, height, true);
 }
Пример #5
0
  /**
   * Creates a stage with the specified viewport and batch. This can be used to avoid creating a new
   * batch (which can be somewhat slow) if multiple stages are used during an application's life
   * time.
   *
   * @param batch Will not be disposed if {@link #dispose()} is called, handle disposal yourself.
   */
  public Stage(Viewport viewport, Batch batch) {
    if (viewport == null) throw new IllegalArgumentException("viewport cannot be null.");
    if (batch == null) throw new IllegalArgumentException("batch cannot be null.");
    this.viewport = viewport;
    this.batch = batch;

    root = new Group();
    root.setStage(this);

    viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
  }
 @Override
 public void resize(int width, int height) {
   gamePort.update(width, height);
 }
Пример #7
0
 @Override
 public void resize(int width, int height) {
   viewport.update(width, height);
   stage.getViewport().update(width, height, true);
   stageCharacters.getViewport().update(width, height, true);
 }
Пример #8
0
 @Override
 public void resize(final int width, final int height) {
   viewport.update(width, height);
 }
 @Override
 public void resize(int width, int height) {
   vista.update(width, height);
 }
Пример #10
0
 @Override
 public void resize(int width, int height) {
   viewport.update(width, height);
   camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
 }
 public void resize(int width, int height) {
   gs.resize(width, height);
   view.update(width, height, true);
 }
Пример #12
0
 @Override
 public void resize(int width, int height) {
   viewport.update(width, height, false);
 }