コード例 #1
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();
  }
コード例 #2
0
ファイル: PlayState.java プロジェクト: SamHindson/Ultranaut
  @Override
  public void render(float delta) {
    update(delta);

    Gdx.gl20.glClear(
        GL20.GL_COLOR_BUFFER_BIT
            | (Gdx.graphics.getBufferFormat().coverageSampling
                ? GL20.GL_COVERAGE_BUFFER_BIT_NV
                : 0));
    Gdx.gl20.glClearColor(0.0f, 0.0f, 0.1f, 1.0f);

    universe.render();

    pauseMenuBatch.begin();
    if (paused) {
      pauseMenuBatch.draw(
          pauseBackground, 0, UltranautGame.HEIGHT / 2 - 200, UltranautGame.WIDTH, 400);
      pauseFont.draw(
          pauseMenuBatch,
          "Stasis",
          UltranautGame.WIDTH / 2 - new GlyphLayout(pauseFont, "Stasis").width / 2,
          UltranautGame.HEIGHT / 2 + 150);
      resume.draw(pauseMenuBatch);
      mainMenu.draw(pauseMenuBatch);
      exit.draw(pauseMenuBatch);
    }

    if (UltranautGame.debug) {
      pauseFont.draw(
          pauseMenuBatch, Gdx.graphics.getFramesPerSecond() + "fps", 5, Gdx.graphics.getHeight());
    }
    pauseMenuBatch.end();
  }
コード例 #3
0
  @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);
    }
  }
コード例 #4
0
ファイル: OptionsScreen.java プロジェクト: agmcleod/ld25
  @Override
  public void render(float arg0) {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    camera.update();
    if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
      if (focused) {
        focused = false;
      } else {
        goBack();
      }
    }

    if (focused) {
      shapeRenderer.begin(ShapeType.FilledRectangle);
      Color c = new Color(0.15f, 0.4f, 0.15f, 1f);
      shapeRenderer.setColor(c);
      shapeRenderer.filledRect(focusedBox.x, focusedBox.y, focusedBox.width, focusedBox.height);
      shapeRenderer.end();
    }

    batch.begin();
    ObjectMap.Entries<String, Rectangle> it = bindingButtons.entries();
    // draw back button text
    font.draw(batch, "Back", backButton.x, backButton.y + backButton.height);
    // draw option texts
    while (it.hasNext()) {
      ObjectMap.Entry<String, Rectangle> entry = it.next();
      Rectangle bounds = entry.value;
      font.draw(batch, entry.key, bounds.x, bounds.y + bounds.height);
      Binding binding = game.getBindings().get(entry.key);
      font.draw(batch, binding.character, bounds.x + 200.0f, bounds.y + bounds.height);
    }
    batch.end();
  }
コード例 #5
0
ファイル: Button.java プロジェクト: vik-goel/waterwater
  public boolean draw(float dt, SpriteBatch batch) {
    boolean result = false;

    if (Gdx.input.isTouched()) {
      if (inside()) {
        // scale = Math.max(minScale, scale - dt * 1.1f);
        down = true;
      } else {
        // scale = Math.min(1, scale + dt * 0.3f);
        down = false;
      }
    } else if (down) {
      result = true;
      down = false;
    } else {
      down = false;
    }

    batch.begin();

    TextureRegion tex = down ? pressed : regular;
    batch.draw(tex, x, y, width * 0.5f, height * 0.5f, width, height, 1, 1, 0);
    batch.end();

    return result;
  }
コード例 #6
0
ファイル: GameScreenMulti.java プロジェクト: h4a/SuperJumper
 public void draw(float deltaTime) {
   GLCommon gl = Gdx.gl;
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   renderer.render();
   guiCam.update();
   batcher.setProjectionMatrix(guiCam.combined);
   batcher.enableBlending();
   batcher.begin();
   switch (state) {
     case GAME_READY:
       presentReady();
       break;
     case GAME_RUNNING:
       presentRunning();
       break;
     case GAME_PAUSED:
       presentPaused();
       break;
     case GAME_LEVEL_END:
       presentLevelEnd();
       break;
     case GAME_OVER:
       presentGameOver();
       break;
   }
   batcher.end();
 }
コード例 #7
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()) {}
 }
コード例 #8
0
  private void helpFreezAnimation(float delta) {
    batch.begin();
    if (ice.animation == animBlick && ice.animation.isAnimationFinished(stateTime)) {
      ice.animation = null;
      gameState = GameState.PLAY;
    }
    if (ice.animation != null && !ice.animation.isAnimationFinished(stateTime)) {

      ice.setRegion(ice.animation.getKeyFrame(stateTime += delta, false));

      batch.draw(
          ice.getTexture(),
          ice.position.x,
          ice.position.y,
          ice.origin.x,
          ice.origin.y,
          ice.dimension.x,
          ice.dimension.y,
          ice.scale.x,
          ice.scale.y,
          ice.rotation,
          ice.getRegionX(),
          ice.getRegionY(),
          ice.getRegionWidth(),
          ice.getRegionHeight(),
          ice.flipX,
          ice.flipY);

      if (ice.animation != animBlick && ice.animation.isAnimationFinished(stateTime)) {
        setAnimation(animBlick);
      }
    }
    batch.end();
  }
コード例 #9
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.begin();
    levelBuilder.update(delta);
    levelBuilder.render(batch);
    batch.end();

    stage.act();
    stage.draw();
    if (addHelp) helpFreezAnimation(delta);

    if (gameState == GameState.WINNER && !winnerUi.isVisible) {
      winnerUi.showWindow(true);
      winnerUi.setTime(time);
    }
    if (gameState == GameState.PLAY || gameState == GameState.MOVING) {
      updateGameTime(delta);
    }
    if (freezers != LevelData.freezers) {
      updateFreeze();
    }
  }
コード例 #10
0
  public void draw(float deltaTime) {
    renderer.render();

    guiCam.update();
    batcher.setProjectionMatrix(guiCam.combined);
    batcher.enableBlending();
    batcher.begin();

    drawUI(deltaTime);

    switch (state) {
      case GAME_READY:
        presentReady();
        break;
        // case ROUND_START
        // case COUNT_DUCKS
        // case NEXT_ROUND
      case GAME_RUNNING:
        presentRunning();
        break;
      case GAME_OVER_1:
      case GAME_OVER_2:
        presentGameOver();
        break;
    }

    batcher.end();
  }
コード例 #11
0
 public void drawVictory(int x, int y, int pid, float xoff, float yoff) {
   if (numRed == 0) {
     if (pid == BLUE_TEAM)
       spriteBatch.draw(
           victoryB,
           (x / 2 - victoryB.getWidth() / 2 + xoff),
           y / 2 - victoryB.getHeight() / 2 + yoff);
     else
       spriteBatch.draw(
           defeatR,
           (x / 2 - defeatR.getWidth() / 2 + xoff),
           y / 2 - defeatR.getHeight() / 2 + yoff);
   } else if (numBlue == 0) {
     if (pid == RED_TEAM)
       spriteBatch.draw(
           victoryR,
           (x / 2 - victoryR.getWidth() / 2 + xoff),
           y / 2 - victoryR.getHeight() / 2 + yoff);
     else
       spriteBatch.draw(
           defeatB,
           (x / 2 - defeatB.getWidth() / 2 + xoff),
           y / 2 - defeatB.getHeight() / 2 + yoff);
   }
 }
コード例 #12
0
  @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();
  }
コード例 #13
0
ファイル: Group.java プロジェクト: btdiehr/libgdx
 /**
  * Transforms the SpriteBatch to this group's coordinate system. Note this causes the batch to be
  * flushed.
  */
 protected void applyTransform(SpriteBatch batch) {
   updateTransform();
   batch.end();
   oldBatchTransform.set(batch.getTransformMatrix());
   batch.setTransformMatrix(batchTransform);
   batch.begin();
 }
コード例 #14
0
  public void draw(SpriteBatch batch) {
    batch.end();

    stage.getBatch().setProjectionMatrix(stage.getCamera().combined);
    if (eff != null) {
      if (lastHeroPositionX == 0) lastHeroPositionX = (int) RPG.ctrl.hero.getHeadHero().position.x;
      else {
        if (lastHeroPositionX != RPG.ctrl.hero.getHeadHero().position.x) {
          if (lastHeroPositionX > RPG.ctrl.hero.getHeadHero().position.x) { // LEFT
            eff.getEmitters().get(0).getVelocity().setHigh(500, 500);
          } else {
            eff.getEmitters().get(0).getVelocity().setHigh(-500, -500);
          }
        } else {
          eff.getEmitters().get(0).getVelocity().setHigh(0, 0);
        }
        lastHeroPositionX = (int) RPG.ctrl.hero.getHeadHero().position.x;
      }
      eff.setPosition(0, GameUtil.getScreenHeight());

      stage.getBatch().begin();
      eff.draw(stage.getBatch(), Gdx.graphics.getDeltaTime());
      stage.getBatch().end();

      if (eff.isComplete()) eff.reset();
    }

    batch.begin();
  }
コード例 #15
0
ファイル: DeathGame.java プロジェクト: 0x17/DeathJam
  private void renderTextOverlay() {
    fsb.begin();

    String curStr;

    curStr = "Score " + player.score;
    TextBounds txtBounds = bigFont.getBounds(curStr);

    bigFont.setColor(Color.WHITE);
    bigFont.draw(fsb, curStr, 40, Globals.PSCR_H - txtBounds.height);

    curStr = "Shield " + player.shield;
    txtBounds = bigFont.getBounds(curStr);
    bigFont.draw(fsb, curStr, Globals.PSCR_W - 600, Globals.PSCR_H - txtBounds.height);

    curStr = "Health " + player.hp;
    txtBounds = bigFont.getBounds(curStr);
    bigFont.draw(
        fsb, curStr, Globals.PSCR_W - txtBounds.width - 100, Globals.PSCR_H - txtBounds.height);

    curStr = player.alive ? "ALIVE" : "DEAD";
    txtBounds = bigFont.getBounds(curStr);

    bigFont.setColor(player.alive ? Color.GREEN : Color.RED);
    bigFont.draw(fsb, curStr, Globals.PSCR_W - txtBounds.width, txtBounds.height + 40);

    if (player.gameover) {
      txtBounds = hugeFont.getBounds("GAME OVER!");
      float gx = (Globals.PSCR_W - txtBounds.width) / 2.0f;
      float gy = (Globals.PSCR_H - txtBounds.height) / 2.0f;
      hugeFont.draw(fsb, "GAME OVER!", gx, gy);
    }

    fsb.end();
  }
コード例 #16
0
ファイル: RenderingSystem.java プロジェクト: vladsvs/sioncore
  @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;
    }
  }
コード例 #17
0
  @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();
  }
コード例 #18
0
ファイル: Player.java プロジェクト: ochi12/Not-There-Yet
  public void drawUi(SpriteBatch batch) {
    float x = GameScreen.playerPos.x;
    float y = GameScreen.playerPos.y;

    // Hardcoded UI:
    batch.setColor(1, 0, 0, 1);
    if (hp > 0) batch.draw(Inventory.tex, x + 300, y + 290, 9, 26, 380, 236, 9, 26, false, false);

    batch.draw(
        Inventory.tex,
        x + 309,
        y + 290,
        100 - ((500 - hp) / 5),
        26,
        399,
        262,
        16,
        26,
        false,
        false);

    if (hp >= 500)
      batch.draw(Inventory.tex, x + 409, y + 290, 9, 26, 390, 236, 9, 26, false, false);
    batch.setColor(1, 1, 1, 1);
  }
コード例 #19
0
  @Override
  public void render() {
    frameBuffer.begin();
    Gdx.graphics.getGL20().glViewport(0, 0, frameBuffer.getWidth(), frameBuffer.getHeight());
    Gdx.graphics.getGL20().glClearColor(0f, 1f, 0f, 1);
    Gdx.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.graphics.getGL20().glEnable(GL20.GL_TEXTURE_2D);
    texture.bind();
    meshShader.begin();
    meshShader.setUniformi("u_texture", 0);
    mesh.render(meshShader, GL20.GL_TRIANGLES);
    meshShader.end();
    frameBuffer.end();

    Gdx.graphics.getGL20().glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.graphics.getGL20().glClearColor(0.2f, 0.2f, 0.2f, 1);
    Gdx.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT);

    spriteBatch.begin();
    spriteBatch.draw(
        frameBuffer.getColorBufferTexture(),
        0,
        0,
        256,
        256,
        0,
        0,
        frameBuffer.getColorBufferTexture().getWidth(),
        frameBuffer.getColorBufferTexture().getHeight(),
        false,
        true);
    spriteBatch.end();
  }
コード例 #20
0
  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));
  }
コード例 #21
0
ファイル: GameRoot.java プロジェクト: Takonan/gdx-ui-app
 /** sets batch to game units to draw and then back to screen */
 @Override
 public void draw(SpriteBatch batch, float parentAlpha) {
   tmpMatrix4.set(batch.getProjectionMatrix());
   batch.setProjectionMatrix(cam.combined);
   super.draw(batch, parentAlpha);
   batch.setProjectionMatrix(tmpMatrix4);
 }
コード例 #22
0
ファイル: SSGame.java プロジェクト: AdamAwan/SpaceShooter
  @Override
  public void render() {
    delta = Gdx.graphics.getDeltaTime() * 60;
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    player.update(delta);
    if (player.atLimit()) backgroundPos -= 20 * delta;
    else backgroundPos -= 10 * delta;

    if (backgroundPos <= -background.getHeight()) backgroundPos = 0;

    spriteBatch.setProjectionMatrix(camera.combined);
    spriteBatch.begin();
    spriteBatch.draw(background, -1080 / 2, +background.getHeight() / 2 + backgroundPos);
    spriteBatch.draw(background, -1080 / 2, -background.getHeight() / 2 + backgroundPos);
    player.draw(spriteBatch);
    enemies.update(spriteBatch, delta);
    tweenManager.update(delta / 60);
    spriteBatch.end();

    rayHandler.setCombinedMatrix(camera.combined);
    rayHandler.updateAndRender();

    controls.handleInput(camera);
  }
コード例 #23
0
ファイル: physics.java プロジェクト: weihanli101/FlickyBall
  public void render() { // the artistic drawing function that draws everything out (such talent)
    // make the frame ticker thing that actually makes pretty pictures move
    // in this case you are updating the world you just made
    // apparently you aren't suppose to update this in the render loop but w/e
    // also have no idea what 6 & 2 mean so again w/e (sensai plssss)
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);

    // move the sprite with the body!
    sprite.setPosition(body.getPosition().x, body.getPosition().y);

    // just a limit for when it falls off the screen since there is no ground LOL
    System.out.println(body.getPosition().y);
    if (body.getPosition().y < (10)) {
      body.setAwake(false);
    } else {
      body.setAwake(true);
    }

    // Again not box2dStuff just cool things I added
    HandleTouch();

    // the Background color
    // This doesn't look like it does anything?    Gdx.gl.glClearColor(1, 1, 1, 1);

    // clears the background after each fram update
    // Same with this?    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // this is where the sprite img is rendered and updated etc.
    batch.begin();
    batch.draw(sprite, sprite.getX(), sprite.getY());
    batch.end();
  }
コード例 #24
0
  /*
   * (non-Javadoc)
   * @see com.badlogic.gdx.Screen#render(float)
   */
  @Override
  public void render(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glClearColor(1, 1, 1, 1);

    batch.setProjectionMatrix(ownCamera.combined);
    batch.begin();
    batch.draw(
        texture,
        ((BattleColorConfig.WIDTH - texture.getWidth()) / 2),
        (BattleColorConfig.HEIGHT - texture.getHeight()) / 2);
    batch.end();

    if (System.currentTimeMillis() - oldTime > 1000) { // Eine Sekunde
      // vergangen
      if (countdown == 1) {
        gameRef.setScreen(gameRef.gameScreen);
      } else {
        oldTime = System.currentTimeMillis();
        countdown--;
        setTexture();
      }
    }
    if (gameRef.toast != null) {
      gameRef.toast.toaster();
    }
  }
コード例 #25
0
ファイル: Enemy.java プロジェクト: pedja1/SMC-Android
  @Override
  public final void _render(SpriteBatch spriteBatch) {
    if (frozen) {
      // set shader
      float brightness = .5f / (freezeCounterMax / freezeCounter);
      spriteBatch.setShader(Shader.FREEZE_SHADER);
      spriteBatch.getShader().setUniformf("u_contrast", 1.1f);
      spriteBatch.getShader().setUniformf("u_brightness", brightness);

      // set color
      frozenColor.a = FROZEN_COLOR_START_ALPHA / (freezeCounterMax / freezeCounter);
      spriteBatch.setColor(frozenColor);

      // render
      doRender(spriteBatch);

      // reset shader
      spriteBatch.setShader(null);

      // reset color
      spriteBatch.setColor(Color.WHITE);
    } else {
      doRender(spriteBatch);
    }
  }
コード例 #26
0
ファイル: MatrixTest.java プロジェクト: avgtivihd/bings-game
 @Override
 public void render() {
   Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   batch.begin();
   font.drawMultiLine(batch, results, 20, 300);
   batch.end();
 }
コード例 #27
0
  @Override
  public void render(SpriteBatch sb) {
    delta = (TimeUtils.millis() - startTime + 700) / 1000;
    tweenManager.update(delta);
    bgManager.render(sb);

    sb.setProjectionMatrix(camera.combined);
    sb.begin();
    backButton.render(sb);
    randomCardButton.draw(sb);
    rareCardButton.draw(sb);

    Fonts.MFont.draw(
        sb, "Cost: " + randomCardCost, randomCardButton.getX(), randomCardButton.getY() - 40);
    Fonts.MFont.draw(
        sb, "Cost: " + rareCardCost, rareCardButton.getX(), rareCardButton.getY() - 40);

    Fonts.MFont.draw(
        sb,
        currGold,
        MainGame.WIDTH - Fonts.MFont.getBounds(currGold).width - 40,
        MainGame.HEIGHT - 50);

    if (showingCard) {
      sb.draw(alpha, 0, 0, MainGame.WIDTH, MainGame.HEIGHT);
      purchasedCard.render(
          new Vector2(
              MainGame.WIDTH / 2 - (Card.WIDTH / 2 * cardAnimSprite.getScaleX()),
              MainGame.HEIGHT / 2 - (Card.HEIGHT / 2 * cardAnimSprite.getScaleX())),
          cardAnimSprite.getScaleX(),
          sb);
      unlockedText.draw(sb);
    }
    sb.end();
  }
コード例 #28
0
ファイル: LoadingScreen.java プロジェクト: rabus/ProjectOne
 @Override
 public void render(float delta) {
   if (assets.update()) // Updates assets loading and returns true is finished
   {
     Gdx.app.log("ProjectOne", "All assets loaded successfully ...");
     // game.setScreen(new MainMenu(game, assets)); // Loads main menu screen after loading assets
     game.setScreen(
         new GameScreen(
             game, assets,
             0)); // If anything pressed or touched (android) moves on and it's playtime :) (loads
     // 0 level)
   } else {
     float progress = assets.getProgress() * 100;
     Gdx.gl.glClearColor(0f, 0f, 0f, 1);
     Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
     batch.begin();
     font.draw(
         batch, Float.toString(progress) + " %", 400, 240); // Progress "bar" (percentage for now)
     font.draw(
         batch,
         Integer.toString(assets.getLoadedAssets())
             + " loaded / "
             + Integer.toString(assets.getQueuedAssets())
             + " to go ...",
         360,
         220);
     batch.end();
   }
 }
コード例 #29
0
ファイル: PayTest.java プロジェクト: Suslik73/gdx-pay
 @Override
 public void render() {
   Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   batch.begin();
   font.drawMultiLine(batch, message, 20, Gdx.graphics.getHeight() - 20);
   batch.end();
 }
コード例 #30
0
ファイル: PantallaJuego.java プロジェクト: sergiodml/trabajos
  @Override
  public void render(float dt) {

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // compara si la aplicacion se ejecuta en escritorio o en android
    if (Gdx.app.getType() == ApplicationType.Desktop) {
      this.entradaEscritorio(dt);
    } else if (Gdx.app.getType() == ApplicationType.Android) {
      this.entradaAndroid(dt);
    }
    // actualizamos
    camara.update();
    this.juegoGanado();
    batch.setProjectionMatrix(camara.combined);
    manejadorDeSprite.update(dt, arcanoid, jugador);

    // renderiza el manejadorDeSprite, fondo de pantalla y fuente de jugador
    batch.begin();
    batch.draw(fondoPantalla, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    jugador.draw(batch);
    batch.end();
    manejadorDeSprite.render();
  }