@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(float delta) {
   if (btnGanaste.meTocaste()) AtsUtil.game.setScreen(AtsScreens.screenMain);
   AtsUtil.limpiarP();
   batch.disableBlending();
   batch.begin();
   btnGanaste.dibujar(batch);
   batch.end();
 }
示例#3
0
  @Override
  public void resize(int width, int height) {
    // TODO Auto-generated method stub

    camara2d.setToOrtho(false, Mundo.TAMANO_MUNDO_ANCHO, Mundo.TAMANO_MUNDO_ALTO);
    camara2d.update();

    spritebatch.setProjectionMatrix(camara2d.combined);
    spritebatch.disableBlending();
  }
示例#4
0
  public void render(SpriteBatch spriteBatch, ShapeRenderer shapeRenderer) {
    this.cullingSystem.cull(Jemge.renderer2D.CAMERAVIEW);

    renderMode = Renderer2D.RenderMode.INACTIVE;
    ArrayList<IRendererObject> transparentObjects = new ArrayList<IRendererObject>();

    spriteBatch.disableBlending();
    renderMode = Renderer2D.RenderMode.DISABLED;

    for (IEntity entity : this.cullingSystem.getFinalRenderList()) {
      if (entity instanceof IShape) {
        ((IShape) entity).renderShape(shapeRenderer);
        continue;
      }
      if (!(entity instanceof IRendererObject)) {
        continue;
      }

      if (((IRendererObject) entity).hasTransparent()) {
        transparentObjects.add((IRendererObject) entity);
        continue; // <- Continue if the object is translucent.
      }
      ((IRendererObject) entity).render(spriteBatch);

      if (entity instanceof Actor) {
        ((Actor) entity).draw(spriteBatch, 1.0f);
      }
    }

    for (Object object : this.RENDEREROBJECTS) {
      if (object instanceof IShape) {
        ((IShape) object).renderShape(shapeRenderer);
        continue;
      }
      if (!(object instanceof IRendererObject)) {
        continue;
      }

      if (((IRendererObject) object).hasTransparent()) {
        transparentObjects.add((IRendererObject) object);
        continue;
      }
      ((IRendererObject) object).render(spriteBatch);
    }

    // Now do the alpha pass:

    for (IRendererObject object : transparentObjects) {
      object.render(spriteBatch);
      if (object instanceof Actor) ((Actor) object).draw(spriteBatch, 1.0f);
    }

    this.cullingSystem.postRender();
  }
 public void renderBackground() {
   batch.disableBlending();
   batch.begin();
   //        batch.draw(Assets.backgroundRegion, cam.position.x - FRUSTUM_WIDTH / 2, cam.position.y
   // - FRUSTUM_HEIGHT / 2, FRUSTUM_WIDTH,
   //                FRUSTUM_HEIGHT);
   batch.draw(
       Assets.backgroundRegion,
       cam.position.x - this.world.WORLD_WIDTH / 2,
       cam.position.y - this.world.WORLD_HEIGHT / 2,
       this.world.WORLD_WIDTH,
       this.world.WORLD_HEIGHT);
   batch.end();
 }
示例#6
0
  public void draw(float deltaTime) {
    GLCommon gl = Gdx.gl;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    guiCam.update();

    batcher.disableBlending();
    batcher.begin();
    batcher.draw(helpRegion, 0, 0, 320, 480);
    batcher.end();

    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.arrow, 320, 0, -64, 64);
    batcher.end();

    gl.glDisable(GL10.GL_BLEND);
  }
  public void draw() {
    GLCommon gl = Gdx.gl;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    guiCam.update();

    batcher.setProjectionMatrix(guiCam.combined);
    batcher.disableBlending();
    batcher.begin();
    batcher.draw(helpRegion, 0, 0, 320, 480);
    batcher.end();

    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.arrow, 320, 0, -64, 64);
    batcher.end();

    gl.glDisable(GL10.GL_BLEND);
  }
示例#8
0
  public void draw(float deltaTime) {
    GLCommon gl = Gdx.gl;
    gl.glClearColor(1, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    guiCam.update();
    batcher.setProjectionMatrix(guiCam.combined);

    batcher.disableBlending();
    batcher.begin();
    batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
    batcher.end();

    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.logo, 160 - 274 / 2, 480 - 10 - 142, 274, 142);
    batcher.draw(Assets.mainMenu, 10, 200 - 110 / 2, 300, 110);
    batcher.draw(Settings.soundEnabled ? Assets.soundOn : Assets.soundOff, 0, 0, 64, 64);
    batcher.end();
  }
示例#9
0
  @Override
  public void draw(float delta) {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    viewMatrix.setToOrtho2D(0, 0, 480, 320);
    spriteBatch.setProjectionMatrix(viewMatrix);
    spriteBatch.setTransformMatrix(transformMatrix);
    spriteBatch.begin();
    spriteBatch.disableBlending();
    spriteBatch.setColor(Color.WHITE);
    spriteBatch.draw(background, 0, 0, 480, 320, 0, 0, 512, 512, false, false);
    spriteBatch.enableBlending();
    spriteBatch.draw(logo, 0, 320 - 128, 480, 128, 0, 256, 512, 256, false, false);
    String text = "It is the end my friend.\nTouch to continue!";
    TextBounds bounds = font.getMultiLineBounds(text);
    spriteBatch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
    font.drawMultiLine(spriteBatch, text, 0, 160 + bounds.height / 2, 480, HAlignment.CENTER);
    spriteBatch.end();
  }
  public void draw(SpriteBatch spriteBatch) {

    if (background != null) {
      spriteBatch.disableBlending();

      float x = 0;

      for (AtlasRegion tile : background) {
        spriteBatch.draw(tile, x, 0f);
        x += tile.getRegionWidth();
      }

      spriteBatch.enableBlending();
    }

    // draw layers from bottom to top
    for (int i = layers.size() - 1; i >= 0; i--) {
      SceneLayer layer = layers.get(i);
      layer.draw(spriteBatch);
    }

    // Draw the light map
    if (lightMap != null) {
      // Multiplicative blending for light maps
      spriteBatch.setBlendFunction(GL20.GL_DST_COLOR, GL20.GL_ZERO);

      float x = 0;

      for (AtlasRegion tile : lightMap) {
        spriteBatch.draw(tile, x, 0f);
        x += tile.getRegionWidth();
      }

      spriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    }
  }