public void draw(SpriteBatch batch) {

    if (!hidden) {
      fadedBG.draw(batch);
      dialogSprite.draw(batch);
    }
  }
Example #2
0
 /** Draw 描画 */
 public void Draw() {
   hp.draw(GameMain.spriteBatch);
   scrollRight.draw(GameMain.spriteBatch);
   scroll.draw(GameMain.spriteBatch);
   chakra.draw(GameMain.spriteBatch);
   hyoutan.draw(GameMain.spriteBatch);
 }
Example #3
0
  /** Draw everything. Called by render() */
  private void draw() {
    // Clear screen.
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    // Apply normal camera.
    tappy.getSpriteBatch().setProjectionMatrix(orthographicCamera.combined);
    tappy.getSpriteBatch().begin();
    // Draw background.
    splashHeadphone.draw(tappy.getSpriteBatch());
    splashBackground.draw(tappy.getSpriteBatch());
    tappy.getSpriteBatch().end();
  }
Example #4
0
  @Override
  public void render() {
    // Update
    //		Gdx.graphics.getGL10().glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    world.step(1 / 60f, 10, 10);
    for (int i = 0; i < MAX_BALL_COUNT; i++) {
      Vector2 pos =
          ballModels[i]
              .getPosition()
              .sub(ballSprites[i].getWidth() / 2, ballSprites[i].getHeight() / 2);
      float angleDeg = ballModels[i].getAngle() * MathUtils.radiansToDegrees;

      ballSprites[i].setPosition(pos.x, pos.y);
      ballSprites[i].setRotation(angleDeg);
    }

    // Render
    //		GL10 gl = Gdx.gl10;
    //		gl.glClearColor(1, 1, 1, 1);
    //		gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    spriteBatch.setProjectionMatrix(camera.combined);
    spriteBatch.begin();
    vialSprite.draw(spriteBatch);
    for (int i = 0; i < MAX_BALL_COUNT; i++) ballSprites[i].draw(spriteBatch);
    spriteBatch.end();

    spriteBatch
        .getProjectionMatrix()
        .setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    spriteBatch.begin();
    font.draw(spriteBatch, "Touch the screen to restart", 5, 25);
    spriteBatch.end();
  }
Example #5
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0.39f, 0.58f, 0.92f, 1.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // Update deltaTime & animationTime
    deltaTime = Gdx.graphics.getDeltaTime();
    animationTime += Gdx.graphics.getDeltaTime();

    // Store Spritesheet to sprite
    sprite = new Sprite(animation.getKeyFrame(animationTime, true));
    sprite.setPosition(xPosition, 0);
    sprite.setScale(1.8f);

    // Set camera to batch and undate camera
    batch.setProjectionMatrix(camera.combined);
    camera.update();

    tiledMapRenderer.setView(camera);
    tiledMapRenderer.render(background);
    tiledMapRenderer.render(foreground);

    // Display on Screen
    batch.begin();
    sprite.draw(batch);
    batch.end();

    // update xPosition
    xPosition = xPosition + (speed * deltaTime);

    HUDBatch.begin();
    font1.draw(HUDBatch, "SCORE:100", 100, 450);
    HUDBatch.end();
  }
Example #6
0
 public void draw(GL20 gl, SpriteBatch batch) {
   if (isHit()) {
     textureHit.draw(batch);
   } else {
     texture.draw(batch);
   }
 }
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0.2f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // tell the camera to update its matrices.
    camera.update(
        car.body.getPosition().x * PIXELS_PER_METER, car.body.getPosition().y * PIXELS_PER_METER);

    spriteBatch.setProjectionMatrix(camera.getCombined());

    if (Gdx.input.isKeyPressed(Input.Keys.UP) || Gdx.input.isTouched()) {
      car.setAccelerate(Car.ACC_ACCELERATE);
    } else if (Gdx.input.isKeyPressed(Input.Keys.DOWN)) {
      car.setAccelerate(Car.ACC_BRAKE);
    } else {
      car.setAccelerate(Car.ACC_NONE);
    }

    if (Gdx.input.isKeyPressed(Input.Keys.LEFT) || Gdx.input.getAccelerometerY() < -2.5) {
      car.setSteer(Car.STEER_HARD_LEFT);
    } else if (Gdx.input.getAccelerometerY() < -1) {
      car.setSteer(Car.STEER_LEFT);
    } else if (Gdx.input.isKeyPressed(Input.Keys.RIGHT) || Gdx.input.getAccelerometerY() > 2.5) {
      car.setSteer(Car.STEER_HARD_RIGHT);
    } else if (Gdx.input.getAccelerometerY() > 1) {
      car.setSteer(Car.STEER_RIGHT);
    } else {
      car.setSteer(Car.STEER_NONE);
    }

    car.update(Gdx.app.getGraphics().getDeltaTime());

    /**
     * Have box2d update the positions and velocities (and etc) of all tracked objects. The second
     * and third argument specify the number of iterations of velocity and position tests to perform
     * -- higher is more accurate but is also slower.
     */
    world.step(Gdx.app.getGraphics().getDeltaTime(), 3, 3);

    world.clearForces();

    // draw the sprites
    spriteBatch.begin();

    playerSprite.setPosition(
        PIXELS_PER_METER * car.body.getPosition().x - playerTexture.getRegionWidth() / 2,
        PIXELS_PER_METER * car.body.getPosition().y - playerTexture.getRegionHeight() / 2);
    playerSprite.setRotation((MathUtils.radiansToDegrees * car.body.getAngle()));

    playerSprite.setFlip(false, true);
    playerSprite.setScale(0.3f);

    playerSprite.draw(spriteBatch);

    spriteBatch.end();

    /** Draw this last, so we can see the collision boundaries on top of the sprites and map. */
    debugRenderer.render(
        world, camera.getCombined().scale(PIXELS_PER_METER, PIXELS_PER_METER, PIXELS_PER_METER));
  }
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(Color.BLUE.r, Color.BLUE.g, Color.BLUE.b, Color.BLUE.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();
    game.batch.setProjectionMatrix(camera.combined);

    batch.begin();
    font.draw(batch, "Loading Game", 32, 32);
    background.draw(batch);
    batch.end();

    if (licenseVerified) {
      if (Gdx.input.isTouched()) {
        Logger.logMsg("transitioning to main menu screen");
        game.setGameScreen(this, game.mainMenuScreen);
        dispose();
      }
    } else {
      Dialog dialog =
          new Dialog("license key invalid", game.uiSkin) {
            protected void result(Object object) {
              Logger.logMsg("exiting");
              Gdx.app.exit();
            }
          };
      dialog.text("Your license key is invalid, exiting...");
      dialog.button("OK", true);
      dialog.show(stage);
    }
  }
Example #9
0
 @Override
 public void draw(float delta, SpriteBatch spriteBatch) {
   for (Sprite cell : cells) {
     cell.draw(spriteBatch);
   }
   super.draw(delta, spriteBatch);
 }
  @Override
  public void render() {
    red.a = (red.a + Gdx.graphics.getDeltaTime() * 0.1f) % 1;

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    spriteBatch.begin();
    logoSprite.draw(spriteBatch);
    switch (renderMode) {
      case 0:
        font.getData().setScale(1);
        renderNormal("normal");
        break;
      case 1:
        font.getData().setScale(1);
        renderCached();
        break;
      case 2:
        font.getData().setScale(red.a + 0.5f);
        renderNormal("normal scaled");
        break;
      case 3:
        font.getData().setScale(1);
        renderCachedScaled();
        break;
    }
    spriteBatch.end();
  }
Example #11
0
  @Override
  public void render(float delta) {
    // this should make the background blueish
    Gdx.gl.glClearColor((float) .1, (float) .1, (float) .66, (float) .8);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // this draws the background image and the title
    batch.begin();
    sprite.draw(batch);
    // texture, starting x, starting y, width, height
    // the title img is originally 128 by 32
    //        batch.draw(titleimg, -50, Gdx.graphics.getHeight()/2, 1028, 256);
    float titleWidth = 2056;
    float titleHeight = 512;
    float width = Gdx.graphics.getWidth();
    float height = Gdx.graphics.getHeight();
    batch.draw(
        titleimg,
        width / 2 - titleWidth / 2,
        (float) (height * 0.7) - titleHeight / 2,
        titleWidth,
        titleHeight);
    batch.end();

    // draws the buttons
    stage.act(delta);
    stage.draw();
  }
Example #12
0
 @Override
 public void render() {
   if (selectedOption != -1) {
     RectangleRenderer.begin();
     RectangleRenderer.setColor(StripesMatrix.darkCell);
     RectangleRenderer.setAlpha(0.8f);
     RectangleRenderer.setBounds(
         selectionBounds.getX(),
         selectionBounds.getY() + lineH * (selectedOption),
         selectionBounds.getWidth(),
         selectionBounds.getHeight());
     RectangleRenderer.renderRect();
     RectangleRenderer.end();
   }
   StaticBitmapFont.begin();
   titleText.render();
   pricesText.render();
   currencyText.render();
   ammountsText.render();
   StaticBitmapFont.end();
   arrowsColumn.render();
   goldBatch.begin();
   goldSprite.draw(goldBatch);
   goldBatch.end();
   if (buttonChangeCurrency.checkButton()) {}
 }
Example #13
0
  public void draw(SpriteBatch sb) {
    if (mCogs_ReallyBig.size() > 0) {
      mCogs_ReallyBig.get(0).setCenterX(121);
      mCogs_ReallyBig.get(0).setCenterY(156);
      mCogs_ReallyBig.get(0).draw(sb);
    }

    if (mCogs_Big.size() > 0) {
      mCogs_Big.get(0).setCenterX(326);
      mCogs_Big.get(0).setCenterY(112);
      mCogs_Big.get(0).draw(sb);
    }

    if (mCogs_Medium.size() > 0) {
      mCogs_Medium.get(0).setCenterX(498);
      mCogs_Medium.get(0).setCenterY(95);
      mCogs_Medium.get(0).draw(sb);
    }

    if (mCogs_Small.size() > 0) {
      mCogs_Small.get(0).setCenterX(633);
      mCogs_Small.get(0).setCenterY(83);
      mCogs_Small.get(0).draw(sb);
    }

    if (mCogs_Tiny.size() > 0) {
      mCogs_Tiny.get(0).setCenterX(732);
      mCogs_Tiny.get(0).setCenterY(69);
      mCogs_Tiny.get(0).draw(sb);
    }

    mSprite.setPosition(0, 0);
    mSprite.draw(sb);
  }
  @Override
  protected void process(Entity e) {
    if (cullableMapper.get(e).culled) return;

    Sprite sprite = renderableMapper.get(e).sprite;
    sprite.draw(batch);
  }
  public static void wyswietlBitmape(Sprite sprite, int x, int y) {

    PrzechowalniaAssets.spriteBatch.begin();
    sprite.setPosition(x, y);
    sprite.draw(PrzechowalniaAssets.spriteBatch);
    PrzechowalniaAssets.spriteBatch.end();
  }
  @Override
  public void render() {
    Gdx.gl.glClearColor(0, 0, 0, 0);
    Gdx.gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    lote.setProjectionMatrix(camara.combined);

    stateTime += Gdx.graphics.getDeltaTime();

    Sprite ciano = animadoCiano.getKeyFrame(stateTime, true);
    // ciano.setPosition(-ciano.getWidth() / 2,
    //		-ciano.getHeight() / 2);
    // ciano.setRotation(stateTime * 10);

    // inanimadoVerde.setSize(0.5f, 0.5f);
    // inanimadoVerde.setPosition(-inanimadoVerde.getWidth() / 2,
    //		-inanimadoVerde.getHeight() / 2);

    lote.setProjectionMatrix(camara.combined);
    lote.setBlendFunction(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

    lote.begin();
    ciano.draw(lote);
    // inanimadoCastanho.draw(lote);
    lote.end();
  }
Example #17
0
 public void draw(Batch batch, float x, float y, float width, float height) {
   sprite.setBounds(x, y, width, height);
   Color color = sprite.getColor();
   sprite.setColor(Color.tmp.set(color).mul(batch.getColor()));
   sprite.draw(batch);
   sprite.setColor(color);
 }
  @Override
  public void draw(SpriteBatch spriteBatch) {
    delta = Math.min(0.06f, Gdx.graphics.getDeltaTime());

    this.setOrigin(0, 0);
    for (int i = particles.size - 1; i >= 0; i--) {
      Particle particle = particles.get(i);
      if (particle.life > 0) {
        updateParticle(particle);
        float dx = this.getWidth() / 2 * particle.scale;
        float dy = this.getHeight() / 2 * particle.scale;
        this.setColor(1, 1, 1, Math.max(particle.life / this.life, 0));
        this.setScale(particle.scale);
        this.setPosition(particle.position.x - dx, particle.position.y - dy);
        if (!(particle.position.y - dy >= -10 && particle.position.y - dy <= 10)
            && !(particle.position.x - dx >= -10 && particle.position.x - dx <= 10)) {
          super.draw(spriteBatch);
        } else {
          particle.life = 0;
        }
      } else {
        particles.removeIndex(i);
        freeParticles.free(particle);
      }
    }
  }
Example #19
0
  public void draw(SpriteBatch batch, float dt) {
    breakOutTimer += dt;
    fly_sprite.draw(batch);
    switch (fly_size) {
      case 1: // small fly
        if (breakOutTimer > 11) {
          escaped = true;
        }
        break;
      case 2: // small fly
        if (breakOutTimer > 11) {
          escaped = true;
        }
        break;
      case 3: // medium fly
        if (breakOutTimer > 8) {
          escaped = true;
        }
        break;
      case 4: // large fly
        if (breakOutTimer > 5) {
          escaped = true;
        }
        break;

      default:
        break;
    }
  }
Example #20
0
 public void draw(Batch batch) {
   if (type == enemyNORMAL) {
     enemySprite.setPosition(enemyRec.x - 2.5f, enemyRec.y - 3);
   } else {
     enemySprite.setPosition(enemyRec.x - 5, enemyRec.y - 8);
   }
   enemySprite.draw(batch);
 }
Example #21
0
  @Override
  public void render() {
    sprite.setRotation(rotacion);
    if (Gdx.input.isTouched()) {
      rotacion++;
    }
    Gdx.gl.glClearColor(0f, 0.5f, 0.75f, 1f);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    sprite.draw(batch);
    sprite.draw(batch);
    sprite2.draw(batch);
    sprite_nave.draw(batch);
    batch.end();
  }
Example #22
0
 private void renderTestObjects() {
   worldController.cameraHelper.applyTo(camera);
   batch.setProjectionMatrix(camera.combined);
   batch.begin();
   for (Sprite sprite : worldController.testSprites) {
     sprite.draw(batch);
   }
   batch.end();
 }
 @Override
 public void render(float delta) {
   manager.update(delta);
   Gdx.gl.glClearColor(1, 1, 1, 1);
   Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   batcher.begin();
   sprite.draw(batcher);
   batcher.end();
 }
Example #24
0
 public void victory() {
   victory.setPosition(
       -victory.getWidth() / 2 + Gdx.graphics.getWidth() / 2,
       -victory.getHeight() / 2 + 50 * HW4.SCALE + Gdx.graphics.getHeight() / 2);
   gameEnd.begin();
   victory.draw(gameEnd);
   gameEnd.end();
   if (rs.getStage() == null) stage.addActor(rs);
 }
  @Override
  public void render() {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    spriteBatch.setProjectionMatrix(worldCamera.projection);
    spriteBatch.setTransformMatrix(worldCamera.view);
    spriteBatch.begin();
    farmSprite.draw(spriteBatch);
    spriteBatch.end();

    shapeRenderer.setProjectionMatrix(worldCamera.projection);
    shapeRenderer.setTransformMatrix(worldCamera.view);

    shapeRenderer.setColor(1f, 1f, 1f, 1f);
    shapeRenderer.begin(ShapeType.Line);
    for (int i = 0; i < convexHull2d.getPointsCount(); i++) {
      float x0 = convexHull2d.getX(i);
      float y0 = convexHull2d.getY(i);
      if (i + 1 == convexHull2d.getPointsCount()) {
        float x1 = convexHull2d.getX(0);
        float y1 = convexHull2d.getY(0);
        shapeRenderer.line(x0, y0, x1, y1);
        break;
      }
      float x1 = convexHull2d.getX(i + 1);
      float y1 = convexHull2d.getY(i + 1);
      shapeRenderer.line(x0, y0, x1, y1);
    }
    shapeRenderer.end();

    shapeRenderer.setColor(0f, 1f, 1f, 1f);
    shapeRenderer.begin(ShapeType.Line);
    for (int i = 0; i < smallConvexHull2d.getPointsCount(); i++) {
      float x0 = smallConvexHull2d.getX(i);
      float y0 = smallConvexHull2d.getY(i);
      if (i + 1 == smallConvexHull2d.getPointsCount()) {
        float x1 = smallConvexHull2d.getX(0);
        float y1 = smallConvexHull2d.getY(0);
        shapeRenderer.line(x0, y0, x1, y1);
        break;
      }
      float x1 = smallConvexHull2d.getX(i + 1);
      float y1 = smallConvexHull2d.getY(i + 1);
      shapeRenderer.line(x0, y0, x1, y1);
    }
    shapeRenderer.end();

    shapeRenderer.setColor(1f, 0f, 0f, 1f);
    shapeRenderer.begin(ShapeType.FilledCircle);
    for (int i = 0; i < convexHull2d.getPointsCount(); i++) {
      float x = convexHull2d.getX(i);
      float y = convexHull2d.getY(i);
      shapeRenderer.filledCircle(x, y, 1f, 5);
    }
    shapeRenderer.end();
  }
Example #26
0
  @Override
  public void render() {
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    sprite.draw(batch);
    batch.end();
  }
Example #27
0
  public void render(SpriteBatch sb) {
    grid.render(sb);
    redCounter.draw(sb);
    blueCounter.draw(sb);
    scoreCounter(sb);
    highScoreCounter(sb);
    if (grid.isGameOver()) {
      backGroundFade.draw(sb);
      gameOverOverlay.draw(sb);
      restartButton.render(sb);
    }

    if (grid.isPaused()) {
      backGroundFade.draw(sb);
      menuButton.render(sb);
      restartButton.render(sb);
      unpauseButton.render(sb);
    }
  }
 @Override
 public void render(float delta) {
   Gdx.gl.glClearColor(0, 0, 0, 1);
   Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   batch.begin();
   sprite.draw(batch);
   batch.end();
   stage.act();
   stage.draw();
 }
Example #29
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    stage.act(delta);

    logoMenuBatch.begin();
    menuBGSprite.draw(logoMenuBatch);
    logoSprite.draw(logoMenuBatch);
    logoMenuBatch.end();

    butBatch.begin();
    stage.draw();
    butBatch.end();

    if (splashYes) {

      splashBatch.begin();
      splashBGSprite.draw(splashBatch);

      if ((fadeInOut < 1) && (fadeInOut > fadeCopy)) {
        System.out.println(fadeInOut);
        fadeCopy = fadeInOut;
        fadeInOut += 0.005;
        if (fadeInOut >= 1) fadeInOut = 1;

      } else {
        if (fadeInOut <= 0) splashYes = false;
        System.out.println(fadeInOut);
        fadeInOut -= 0.005;
        if (fadeInOut <= 0) {
          splashYes = false;
          fadeInOut = 0;
        }
      }

      splashSprite.setColor(1, 1, 1, fadeInOut);
      splashSprite.draw(splashBatch);
      splashBatch.end();
    }
  }
Example #30
0
  @Override
  public void render(SpriteBatch batch) {

    if (!alive) {
      return;
    }

    if (left_throttle) {
      flame.setPosition(x - width / 2, y - height);
      flame.setOrigin(width / 2, height);
      flame.setRotation(rotation);
      flame.draw(batch);
    }
    if (right_throttle) {
      flame.setPosition(x, y - height);
      flame.setOrigin(0, height);
      flame.setRotation(rotation);
      flame.draw(batch);
    }
    sprite.draw(batch);
  }