示例#1
0
  @Override
  public void render(float delta) {
    if (this.handleInput(delta)) {
      myGame.setScreen(BaseGame.screens.get("main"));
      return;
    }

    // Make a black background
    if (Settings.getRetro()) {
      GL10 g1 = Gdx.graphics.getGL10();
      Gdx.gl.glClearColor(0, 0, 0, 1);
      g1.glClear(GL20.GL_COLOR_BUFFER_BIT);
    } else {
      GL10 g1 = Gdx.graphics.getGL10();
      Gdx.gl.glClearColor(.19f, .19f, .19f, 1f);
      g1.glClear(GL20.GL_COLOR_BUFFER_BIT);
    }

    float dpi = Gdx.graphics.getDensity() * 160f;
    float inchHeight = ((float) Gdx.graphics.getHeight()) / dpi;

    spriteBatch.begin();
    font.setScale(2 * dpi * (inchHeight / 22f) / 72f);
    font.draw(spriteBatch, "High Scores", xx * .40f, yy * .98f);
    font.setScale(dpi * (inchHeight / 22f) / 72f);
    for (int i = 0; i < 10; i++) {
      font.draw(spriteBatch, scores[i][0], xx * .05f, yy * (.85f - i * .08f));
      font.draw(spriteBatch, scores[i][1], xx * .20f, yy * (.85f - i * .08f));
      font.draw(spriteBatch, scores[i][2], xx * .70f, yy * (.85f - i * .08f));
    }
    spriteBatch.end();
  }
示例#2
0
  @Override
  public void render() {
    GL10 gl = Gdx.graphics.getGL10();
    gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    gl.glClearColor(0.7f, 0.7f, 0.7f, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
    gl.glRotatef(angle, 0, 0, 1);
    angle += angleIncrement;
    gl.glEnable(GL10.GL_TEXTURE_2D);

    gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
    vertices.position(0);
    gl.glColorPointer(4, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    gl.glClientActiveTexture(GL10.GL_TEXTURE0);
    gl.glActiveTexture(GL10.GL_TEXTURE0);
    tex.bind();
    vertices.position(4);
    gl.glTexCoordPointer(2, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glClientActiveTexture(GL10.GL_TEXTURE1);
    gl.glActiveTexture(GL10.GL_TEXTURE1);
    tex2.bind();
    vertices.position(6);
    gl.glTexCoordPointer(2, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    vertices.position(8);
    gl.glVertexPointer(3, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);
  }
示例#3
0
  @Override
  public void render() {
    GL10 gl = Gdx.app.getGraphics().getGL10();

    gl.glClearColor(r, g, b, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
  }
  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub

    if (Gdx.input.justTouched()) {
      guiCam.unproject(touch.set(Gdx.input.getX(), Gdx.input.getY(), 0));
      if (startbutton.contains(touch)) {
        maingame.setScreen(maingame.mainscene);
        return;
      }
    }

    GL10 gl = Gdx.graphics.getGL10();
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    /*
     * Actualiza los parametros de la camara
     * y los enlaza al objeto de renderizado batcher
     * */
    guiCam.update();
    this.batcher.setProjectionMatrix(this.guiCam.combined);
    /*
     * Desactiva las trasnparencias
     * */
    batcher.disableBlending();
    batcher.begin();
    batcher.draw(Assets.background, 0, 0, 10, 15);
    batcher.end();
    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.title, 1, 6, 8, 8);
    batcher.draw(Assets.start, x, 3, 6, 3);
    x += c;
    batcher.end();
  }
  @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();
  }
  @Override
  public void render(float delta) {
    GL10 gl = Gdx.graphics.getGL10();

    // Update model
    gameLogic.update((int) (delta * 1000.0f));

    // clear previous frame
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();
  }
  @Override
  public void render() {
    GL10 gl = Gdx.gl10;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glDepthFunc(GL10.GL_LEQUAL);
    gl.glEnable(GL10.GL_COLOR_MATERIAL);
    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_LIGHT0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, lightAmbient, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPosition, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lightDiffuse, 0);

    camera.apply(Gdx.gl10);

    world.update();
  }
示例#8
0
  /** Dibuja en pantalla, lo que se cargo previamente en el metodo cargar, de esta clase. */
  public void Render() {
    GL10 gl = Gdx.gl10;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    for (int i = 0; i < LAYERS; i++) {
      SpriteCache cache = caches[i];
      cache.setProjectionMatrix(cam.combined);
      cache.begin();
      for (int j = 0; j < TILES_PER_LAYER; j += BLOCK_TILES) {
        cache.draw(layers[i], j, BLOCK_TILES);
      }
      cache.end();
    }

    if (System.nanoTime() - startTime >= 1000000000) {
      // Gdx.app.log("TileTest", "fps: " + Gdx.graphics.getFramesPerSecond());
      startTime = System.nanoTime();
    }
  }
 private void renderInsideStation(Application app) {
   GL10 gl = app.getGraphics().getGL10();
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
   gl.glViewport(0, 0, app.getGraphics().getWidth(), app.getGraphics().getHeight());
   gl.glEnable(GL10.GL_BLEND);
   gl.glDisable(GL10.GL_DITHER);
   gl.glEnable(GL10.GL_DEPTH_TEST);
   gl.glEnable(GL10.GL_CULL_FACE);
   setStaticProjectionAndCamera(app.getGraphics(), app, gl);
   setLighting(gl);
   gl.glEnable(GL10.GL_TEXTURE_2D);
   renderSky(gl);
   renderPlanet(gl, "sun", true, 1737f, Splash.planetmove - 150, 0, -2500, app);
   renderSky(gl);
   gl.glDisable(GL10.GL_DITHER);
   gl.glDisable(GL10.GL_CULL_FACE);
   // do alpha models after this
   renderStaticShip(gl, app);
   renderSun(gl, 70000f, -1600, 0, -4500, app);
   gl.glDisable(GL10.GL_TEXTURE_2D);
   renderHud(gl);
 }
 public void render() {
   spriteBatch
       .getProjectionMatrix()
       .setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   float delta = Gdx.graphics.getDeltaTime();
   GL10 gl = Gdx.graphics.getGL10();
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   spriteBatch.begin();
   effect.draw(spriteBatch, delta);
   spriteBatch.end();
   fpsCounter += delta;
   if (fpsCounter > 3) {
     fpsCounter = 0;
     int activeCount = emitters.get(emitterIndex).getActiveCount();
     System.out.println(
         activeCount
             + "/"
             + particleCount
             + " particles, FPS: "
             + Gdx.graphics.getFramesPerSecond());
   }
 }
示例#11
0
文件: Game.java 项目: buremba/space
 @Override
 public void render() {
   GL10 gl = Gdx.graphics.getGL10();
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
 }
 @Override
 public void render(float delta, GL10 gl) {
   gl.glClearColor(1, 0, 0, 1);
   gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
 }