Example usage for com.badlogic.gdx.graphics.g2d Batch setProjectionMatrix

List of usage examples for com.badlogic.gdx.graphics.g2d Batch setProjectionMatrix

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d Batch setProjectionMatrix.

Prototype

public void setProjectionMatrix(Matrix4 projection);

Source Link

Document

Sets the projection matrix to be used by this Batch.

Usage

From source file:CB_Locator.Map.MapViewBase.java

License:Open Source License

private void renderMapTiles(Batch batch) {
    batch.disableBlending();//from  w  w  w  .  j a  v a  2s .  c  o  m

    float faktor = camera.zoom;
    float dx = this.thisWorldRec.getCenterPosX() - MainViewBase.mainView.getCenterPosX();
    float dy = this.thisWorldRec.getCenterPosY() - MainViewBase.mainView.getCenterPosY();

    dy -= ySpeedVersatz;

    camera.position.set(0, 0, 0);
    float dxr = dx;
    float dyr = dy;

    if (!this.NorthOriented || CarMode) {
        camera.up.x = 0;
        camera.up.y = 1;
        camera.up.z = 0;
        camera.rotate(-mapHeading, 0, 0, 1);
        double angle = mapHeading * MathUtils.DEG_RAD;
        dxr = (float) (Math.cos(angle) * dx + Math.sin(angle) * dy);
        dyr = (float) (-Math.sin(angle) * dx + Math.cos(angle) * dy);
    } else {
        camera.up.x = 0;
        camera.up.y = 1;
        camera.up.z = 0;
    }
    camera.translate(-dxr * faktor, -dyr * faktor, 0);

    camera.update();

    Matrix4 mat = camera.combined;

    batch.setProjectionMatrix(mat);

    try {
        // das Alter aller Tiles um 1 erhhen
        mapTileLoader.increaseLoadedTilesAge();
    } catch (Exception e) {
        // LogCat announces a java.util.ConcurrentModificationException
    }
    // for (int tmpzoom = zoom; tmpzoom <= zoom; tmpzoom++)
    {
        int tmpzoom = aktZoom;

        int halfMapIntWidth = mapIntWidth / 2;
        int halfMapIntHeight = mapIntHeight / 2;

        int halfDrawingtWidth = drawingWidth / 2;
        int halfDrawingHeight = drawingHeight / 2;

        loVector.set(halfMapIntWidth - halfDrawingtWidth, halfMapIntHeight - halfDrawingHeight - ySpeedVersatz);
        ruVector.set(halfMapIntWidth + halfDrawingtWidth, halfMapIntHeight + halfDrawingHeight + ySpeedVersatz);
        lo.set(screenToDescriptor(loVector, aktZoom, lo));
        ru.set(screenToDescriptor(ruVector, aktZoom, ru));

        for (int i = lo.getX(); i <= ru.getX(); i++) {
            for (int j = lo.getY(); j <= ru.getY(); j++) {
                Descriptor desc = new Descriptor(i, j, tmpzoom, this.NightMode);
                boolean canDraw = mapTileLoader.markToDraw(desc);
                boolean canDrawOverlay = false;
                if (mapTileLoader.getCurrentOverlayLayer() != null) {
                    canDrawOverlay = mapTileLoader.markToDrawOverlay(desc);
                }

                if (!canDraw && tmpzoom == aktZoom) {

                    // create this Tile new
                    desc.Data = this;
                    mapTileLoader.reloadTile(this, desc, aktZoom);

                    // fr den aktuellen Zoom ist kein Tile vorhanden ->
                    // kleinere Zoomfaktoren durchsuchen
                    if (!renderBiggerTiles(batch, i, j, aktZoom)) {
                        // grere Zoomfaktoren noch durchsuchen, ob davon Tiles
                        // vorhanden sind...
                        // dafr mssen aber pro fehlendem Tile mehrere kleine
                        // Tiles gezeichnet werden (4 oder 16 oder 64...)
                        // dieser Aufruf kann auch rekursiv sein...
                        renderSmallerTiles(batch, i, j, aktZoom);
                    }
                }

                if (mapTileLoader.getCurrentOverlayLayer() != null) {
                    if (!canDrawOverlay && tmpzoom == aktZoom) {
                        if (!renderBiggerOverlayTiles(batch, i, j, aktZoom))
                            renderSmallerOverlayTiles(batch, i, j, aktZoom);
                    }
                }
            }
        }
    }

    // FIXME Change to Sorted List, close Texture changing!!
    /*
     * Sort First Symbols then Text!
     * 
     * Sort Symbols with Texture, close Texture changing!
     * 
     * Sort Text with TextType and Size, close Texture changing!
     */
    CB_List<TileGL_RotateDrawables> rotateList = new CB_List<TileGL_RotateDrawables>();

    mapTileLoader.sort();

    synchronized (screenCenterW) {
        for (int i = mapTileLoader.getDrawingSize() - 1; i > -1; i--) {
            TileGL tile = mapTileLoader.getDrawingTile(i);
            if (tile == null)
                continue;

            // Faktor, mit der dieses MapTile vergrert gezeichnet
            // werden mu
            long posFactor = getscaledMapTilePosFactor(tile);

            long xPos = tile.Descriptor.getX() * posFactor * tile.getWidth() - screenCenterW.x;
            long yPos = -(tile.Descriptor.getY() + 1) * posFactor * tile.getHeight() - screenCenterW.y;
            float xSize = tile.getWidth() * posFactor;
            float ySize = tile.getHeight() * posFactor;

            // Draw Names and Symbols only from Tile with right zoom factor
            boolean addToRotateList = tile.Descriptor.getZoom() == aktZoom;

            tile.draw(batch, xPos, yPos, xSize, ySize, addToRotateList ? rotateList : null);

        }
        batch.enableBlending();

        // FIXME sort rotate List first the Symbols then the Text! sort Text with same Font!
        // Don't change the Texture (improve the Performance)

        for (int i = 0, n = rotateList.size(); i < n; i++) {
            TileGL_RotateDrawables drw = rotateList.get(i);
            if (drw != null)
                drw.draw(batch, -mapHeading);
        }
        rotateList.truncate(0);
        rotateList = null;

    }
    mapTileLoader.clearDrawingTiles();

    if (mapTileLoader.getCurrentOverlayLayer() != null) {
        synchronized (screenCenterW) {
            for (int i = mapTileLoader.getDrawingSizeOverlay() - 1; i > -1; i--) {
                TileGL tile = mapTileLoader.getDrawingTileOverlay(i);
                if (tile == null)
                    continue;

                // Faktor, mit der dieses MapTile vergrert gezeichnet
                // werden mu
                long posFactor = getscaledMapTilePosFactor(tile);

                long xPos = tile.Descriptor.getX() * posFactor * tile.getWidth() - screenCenterW.x;
                long yPos = -(tile.Descriptor.getY() + 1) * posFactor * tile.getHeight() - screenCenterW.y;
                float xSize = tile.getWidth() * posFactor;
                float ySize = tile.getHeight() * posFactor;
                tile.draw(batch, xPos, yPos, xSize, ySize, rotateList);

            }
        }
        mapTileLoader.clearDrawingTilesOverlay();
    }

}

From source file:CB_Locator.Map.MapViewBase.java

License:Open Source License

protected void renderDebugInfo(Batch batch) {

    CB_RectF r = this.thisWorldRec;

    Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST);

    BitmapFont font = Fonts.getNormal();

    font.setColor(Color.BLACK);//  w  w  w .  ja v a  2 s.co m

    Matrix4 def = new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    def.translate(r.getX(), r.getY(), 1);
    batch.setProjectionMatrix(def);

    // str = debugString;
    font.draw(batch, str, 20, 120);

    str = "fps: " + Gdx.graphics.getFramesPerSecond();
    font.draw(batch, str, 20, 100);

    str = String.valueOf(aktZoom) + " - camzoom: " + Math.round(camera.zoom * 100) / 100;
    font.draw(batch, str, 20, 80);

    str = "lTiles: " + mapTileLoader.LoadedTilesSize() + " - qTiles: " + mapTileLoader.QueuedTilesSize();
    font.draw(batch, str, 20, 60);

    str = "lastMove: " + lastMovement.x + " - " + lastMovement.y;
    font.draw(batch, str, 20, 20);
    Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST);
}

From source file:CB_UI.GL_UI.Activitys.CreateTrackOverMapActivity.java

License:Open Source License

@Override
public void renderChilds(final Batch batch, ParentInfo parentInfo) {
    super.renderChilds(batch, parentInfo);

    // render WPs
    if (waypoints == null)
        return;//from w  ww  .  j a  v  a  2 s  . c  o  m
    tmplist.clear();

    for (int i = 0; i < waypoints.size(); i++) {
        Waypoint wp = waypoints.get(i);

        double MapX = 256.0 * Descriptor.LongitudeToTileX(MapTileLoader.MAX_MAP_ZOOM, wp.Pos.getLongitude());
        double MapY = -256.0 * Descriptor.LatitudeToTileY(MapTileLoader.MAX_MAP_ZOOM, wp.Pos.getLatitude());
        if (true)// isVisible(MapX, MapY)
        {
            WaypointRenderInfo wpi = new WaypointRenderInfo();
            wpi.MapX = (float) MapX;
            wpi.MapY = (float) MapY;
            wpi.Icon = Sprites.getSprite("mapTrailhead");
            wpi.Cache = null;
            wpi.Waypoint = wp;
            wpi.UnderlayIcon = null;

            wpi.Selected = false;
            if (selectedWP != null) {
                if (selectedWP.getGcCode().equals(wp.getGcCode())) {
                    wpi.Selected = true;
                    wpi.UnderlayIcon = Sprites.MapOverlay.get(1);
                }
            }
            tmplist.add(wpi);
        }
    }

    batch.setProjectionMatrix(mapView.myParentInfo.Matrix());

    Gdx.gl.glScissor((int) mapView.thisWorldRec.getX(), (int) mapView.thisWorldRec.getY(),
            (int) mapView.thisWorldRec.getWidth() + 1, (int) mapView.thisWorldRec.getHeight() + 1);
    Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST);

    SizeF drawingSize = new SizeF(40, 40);

    for (int i = 0; i < tmplist.size(); i++) {

        mapView.renderWPI(batch, drawingSize, drawingSize, tmplist.get(i));

    }

}

From source file:CB_UI.GL_UI.Views.MapView.java

License:Open Source License

@Override
protected void renderSyncronOverlay(Batch batch) {
    batch.setProjectionMatrix(myParentInfo.Matrix());

    // calculate icon size
    int iconSize = 0; // 8x8
    if ((aktZoom >= 13) && (aktZoom <= 14))
        iconSize = 1; // 13x13
    else if (aktZoom > 14)
        iconSize = 2; // default Images

    if (Mode != MapMode.Compass)
        CB_UI.RouteOverlay.RenderRoute(batch, this);
    renderWPs(GL_UISizes.WPSizes[iconSize], GL_UISizes.UnderlaySizes[iconSize], batch);
    renderPositionMarker(batch);//from   w  w  w .j  ava 2  s.  co  m
    RenderTargetArrow(batch);
}

From source file:CB_UI.GL_UI.Views.MapView.java

License:Open Source License

void renderUI(Batch batch) {
    batch.setProjectionMatrix(myParentInfo.Matrix());

    if (showMapCenterCross) {
        if (getMapState() == MapState.FREE) {
            if (CrossLines == null) {
                int crossSize = Math.min(mapIntHeight / 3, mapIntWidth / 3) / 2;
                float strokeWidth = 2 * UI_Size_Base.that.getScale();

                GeometryList geomList = new GeometryList();
                Line l1 = new Line(mapIntWidth / 2 - crossSize, mapIntHeight / 2, mapIntWidth / 2 + crossSize,
                        mapIntHeight / 2);
                Line l2 = new Line(mapIntWidth / 2, mapIntHeight / 2 - crossSize, mapIntWidth / 2,
                        mapIntHeight / 2 + crossSize);
                Quadrangle q1 = new Quadrangle(l1, strokeWidth);
                Quadrangle q2 = new Quadrangle(l2, strokeWidth);

                geomList.add(q1);/*ww  w. j  a  v  a2s .c o  m*/
                geomList.add(q2);

                GL_Paint paint = new GL_Paint();
                paint.setGLColor(COLOR.getCrossColor());
                CrossLines = new PolygonDrawable(geomList.getVertices(), geomList.getTriangles(), paint,
                        mapIntWidth, mapIntHeight);

                geomList.dispose();
                l1.dispose();
                l2.dispose();
                q1.dispose();
                q2.dispose();

            }

            CrossLines.draw(batch, 0, 0, mapIntWidth, mapIntHeight, 0);
        }
    }
}

From source file:CB_UI_Base.GL_UI.Activitys.ImageActivity.java

License:Open Source License

@Override
public void render(Batch batch) {

    imageHeading = Gdx.input.getRotation();
    float x = Gdx.input.getAccelerometerX();
    float y = Gdx.input.getAccelerometerY();
    float z = Gdx.input.getAccelerometerZ();

    //  (|Gpz| < 0.5g) AND (Gpx > 0.5g) AND (|Gpy| < 0.4g): Change orientation to Left
    //  (|Gpz| < 0.5g) AND (Gpx < -0.5g) AND (|Gpy| < 0.4g): Change orientation to Right
    //  (|Gpz| < 0.5g) AND (Gpy > 0.5g) AND (|Gpx| < 0.4g): Change orientation to Bottom
    //  (|Gpz| < 0.5g) AND (Gpy < -0.5g) AND (|Gpx| < 0.4g): Change orientation to Top.

    if (z < 5 && x > 5 && y < 4) {
        imageHeading = -90;//from   w w  w . j av a 2s.  co m
        //       Log.debug(log, "LEFT");
    } else if (z < 5 && x < -5 && y < 4) {
        imageHeading = 90;
        //       Log.debug(log, "RIGHT");
    } else if (z < 5 && y > 5 && x < 4) {
        //       Log.debug(log, "BOTTOM");
    } else {
        imageHeading = 0;
        //       Log.debug(log, "TOP");
    }

    // do not rotate until there is a button
    imageHeading = 0;

    super.render(batch);
    boolean reduceFps = ((kineticZoom != null) || ((kineticPan != null) && (kineticPan.getStarted())));
    if (kineticZoom != null) {
        camera.zoom = kineticZoom.getAktZoom();
        // float tmpZoom = mapTileLoader.convertCameraZommToFloat(camera);
        // aktZoom = (int) tmpZoom;

        int zoom = MAX_MAP_ZOOM;
        float tmpZoom = camera.zoom;
        float faktor = 1.5f;

        while (tmpZoom > faktor) {
            tmpZoom /= 2;
            zoom--;
        }
        aktZoom = zoom;

        if (kineticZoom.getFertig()) {
            GL.that.removeRenderView(this);
            kineticZoom = null;
        } else
            reduceFps = false;

    }

    if ((kineticPan != null) && (kineticPan.getStarted())) {
        if (kineticPan.getFertig()) {
            kineticPan = null;
        } else
            reduceFps = false;
    }

    if (reduceFps) {
        GL.that.removeRenderView(this);
    }
    Matrix4 mat = batch.getProjectionMatrix();
    renderImage(batch);
    batch.setProjectionMatrix(mat);
}

From source file:CB_UI_Base.GL_UI.Activitys.ImageActivity.java

License:Open Source License

private void renderImage(Batch batch) {
    //   batch.disableBlending();

    float faktor = camera.zoom;
    float dx = this.thisWorldRec.getCenterPosX() - MainViewBase.mainView.getCenterPosX();
    float dy = this.thisWorldRec.getCenterPosY() - MainViewBase.mainView.getCenterPosY();
    camera.position.set(0, 0, 0);//from  w w w  .  ja va 2 s .  c  o  m
    float dxr = dx;
    float dyr = dy;

    camera.up.x = 0;
    camera.up.y = 1;
    camera.up.z = 0;
    camera.rotate(-imageHeading, 0, 0, 1);
    double angle = imageHeading * MathUtils.DEG_RAD;
    dxr = (float) (Math.cos(angle) * dx + Math.sin(angle) * dy);
    dyr = (float) (-Math.sin(angle) * dx + Math.cos(angle) * dy);

    camera.translate(-dxr * faktor, -dyr * faktor, 0);
    camera.update();
    Matrix4 mat = camera.combined;
    batch.setProjectionMatrix(mat);

    Drawable drw = img.getDrawable();

    if (drw != null) {

        float drawwidth = getWidth();
        float drawHeight = getHeight();

        ImageLoader imageLoader = img.getImageLoader();

        if (imageLoader.getSpriteWidth() > 0 && imageLoader.getSpriteHeight() > 0) {
            float proportionWidth = getWidth() / imageLoader.getSpriteWidth();
            float proportionHeight = getHeight() / imageLoader.getSpriteHeight();

            float proportion = Math.min(proportionWidth, proportionHeight);

            drawwidth = imageLoader.getSpriteWidth() * proportion;
            drawHeight = imageLoader.getSpriteHeight() * proportion;
        }

        long posFactor = getPosFactor(0);

        float xPos = -(screenCenterW.x * posFactor) - (screenCenterT.x * camera.zoom);
        float yPos = (screenCenterW.y * posFactor) - (screenCenterT.y * camera.zoom);
        float xSize = drawwidth * posFactor;
        float ySize = drawHeight * posFactor;

        drw.draw(batch, xPos, yPos, xSize, ySize);
    }
}

From source file:CB_UI_Base.GL_UI.Controls.Dialog.java

License:Open Source License

@Override
public void renderChilds(final Batch batch, ParentInfo parentInfo) {
    if (this.isDisposed())
        return;/*from ww  w  . j ava 2 s  .  c o  m*/
    batch.flush();

    try {
        if (mHeader9patch != null && !dontRenderDialogBackground) {
            mHeader9patch.draw(batch, 0, this.getHeight() - mTitleHeight - mHeaderHeight, this.getWidth(),
                    mHeaderHeight);
        }
        if (mFooter9patch != null && !dontRenderDialogBackground) {
            mFooter9patch.draw(batch, 0, 0, this.getWidth(), mFooterHeight + 2);
        }
        if (mCenter9patch != null && !dontRenderDialogBackground) {
            mCenter9patch.draw(batch, 0, mFooterHeight, this.getWidth(),
                    (this.getHeight() - mFooterHeight - mHeaderHeight - mTitleHeight) + 3.5f);
        }

        if (mHasTitle) {
            if (mTitleWidth < this.getWidth()) {
                if (mTitle9patch != null && !dontRenderDialogBackground) {
                    mTitle9patch.draw(batch, 0, this.getHeight() - mTitleHeight - mTitleVersatz, mTitleWidth,
                            mTitleHeight);
                }
            } else {
                if (mHeader9patch != null && !dontRenderDialogBackground) {
                    mHeader9patch.draw(batch, 0, this.getHeight() - mTitleHeight - mTitleVersatz, mTitleWidth,
                            mTitleHeight);
                }
            }
        }

        batch.flush();
    } catch (Exception e1) {
    }

    if (this.isDisposed())
        return;

    super.renderChilds(batch, parentInfo);

    try {
        if (overlay != null) {
            for (Iterator<GL_View_Base> iterator = overlay.iterator(); iterator.hasNext();) {
                // alle renderChilds() der in dieser GL_View_Base
                // enthaltenen Childs auf rufen.

                GL_View_Base view;
                try {
                    view = iterator.next();

                    // hier nicht view.render(batch) aufrufen, da sonnst die in der
                    // view enthaldenen Childs nicht aufgerufen werden.
                    if (view != null && view.isVisible()) {

                        if (childsInvalidate)
                            view.invalidate();

                        getMyInfoForChild().setParentInfo(myParentInfo);
                        getMyInfoForChild().setWorldDrawRec(intersectRec);

                        getMyInfoForChild().add(view.getX(), view.getY());

                        batch.setProjectionMatrix(getMyInfoForChild().Matrix());
                        nDepthCounter++;

                        view.renderChilds(batch, getMyInfoForChild());
                        nDepthCounter--;
                        batch.setProjectionMatrix(myParentInfo.Matrix());
                    }

                } catch (java.util.ConcurrentModificationException e) {
                    // da die Liste nicht mehr gltig ist, brechen wir hier den Iterator ab
                    break;
                }
            }
        }
    } catch (Exception e) {
    }

}

From source file:CB_UI_Base.GL_UI.GL_View_Base.java

License:Open Source License

/**
 * Die renderChilds() Methode wird vom GL_Listener bei jedem Render-Vorgang aufgerufen.
 * Hier wird dann zuerst die render() Methode dieser View aufgerufen.
 * Danach werden alle Childs iteriert und deren renderChilds() Methode aufgerufen, wenn die View sichtbar ist (Visibility).
 *
 * @param batch/*from ww w  . ja  v  a 2s.c  o m*/
 */
public void renderChilds(final Batch batch, ParentInfo parentInfo) {
    if (myParentInfo == null)
        return;

    if (this.isDisposed)
        return;

    if (thisInvalidate) {
        myParentInfo.setParentInfo(parentInfo);
        CalcMyInfoForChild();
    }

    if (!withoutScissor) {
        if (intersectRec == null || intersectRec.getHeight() + 1 < 0 || intersectRec.getWidth() + 1 < 0)
            return; // hier gibt es nichts zu rendern
        if (!disableScissor)
            Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST);
        Gdx.gl.glScissor((int) intersectRec.getX(), (int) intersectRec.getY(),
                (int) intersectRec.getWidth() + 1, (int) intersectRec.getHeight() + 1);
    }

    float A = 0, R = 0, G = 0, B = 0; // Farbwerte der batch um diese wieder einzustellen, wenn ein ColorFilter angewandt wurde!

    boolean ColorFilterSeted = false; // Wir benutzen hier dieses Boolean um am ende dieser Methode zu entscheiden, ob wir die alte
    // Farbe des Batches wieder herstellen mssen. Wir verlassen uns hier nicht darauf, das
    // mColorFilter!= null ist, da dies in der zwichenzeit passiert sein kann.

    // Set Colorfilter ?
    if (mColorFilter != null) {
        ColorFilterSeted = true;
        // zuerst alte Farbe abspeichern, um sie Wieder Herstellen zu knnen
        // hier muss jeder Wert einzeln abgespeichert werden, da bei getColor()
        // nur eine Referenz zurck gegeben wird
        Color c = batch.getColor();
        A = c.a;
        R = c.r;
        G = c.g;
        B = c.b;

        batch.setColor(mColorFilter);
    }

    // first Draw Background?

    if (drawableBackground != null) {
        drawableBackground.draw(batch, 0, 0, getWidth(), getHeight());
    }

    // set rotation
    boolean isRotated = false;

    if (mRotate != 0 || mScale != 1) {
        isRotated = true;

        rotateMatrix.idt();
        rotateMatrix.translate(mOriginX, mOriginY, 0);
        rotateMatrix.rotate(0, 0, 1, mRotate);
        rotateMatrix.scale(mScale, mScale, 1);
        rotateMatrix.translate(-mOriginX, -mOriginY, 0);

        batch.setTransformMatrix(rotateMatrix);
    }

    try {
        this.render(batch);
    } catch (IllegalStateException e) {
        e.printStackTrace();
        // reset Colorfilter ?
        if (ColorFilterSeted) {
            // alte abgespeicherte Farbe des Batches wieder herstellen!
            batch.setColor(R, G, B, A);
        }
        return;
    }

    // reverse rotation
    if (isRotated) {
        rotateMatrix.idt();
        // rotateMatrix.rotate(0, 0, 1, 0);
        // rotateMatrix.scale(1, 1, 1);

        batch.setTransformMatrix(rotateMatrix);
    }

    if (childs != null && childs.size() > 0) {
        for (int i = 0, n = childs.size(); i < n; i++) {

            if (i >= childs.size()) {
                break; // ConcurrentModificationException
            }

            // alle renderChilds() der in dieser GL_View_Base
            // enthaltenen Childs auf rufen.

            try {
                GL_View_Base view = childs.get(i);
                // hier nicht view.render(batch) aufrufen, da sonnst die in der
                // view enthaldenen Childs nicht aufgerufen werden.
                try {
                    if (view != null && !view.isDisposed() && view.isVisible()) {
                        synchronized (view) {
                            if (childsInvalidate)
                                view.invalidate();

                            getMyInfoForChild().setParentInfo(myParentInfo);
                            getMyInfoForChild().setWorldDrawRec(intersectRec);

                            getMyInfoForChild().add(view.getX(), view.getY());

                            batch.setProjectionMatrix(getMyInfoForChild().Matrix());
                            nDepthCounter++;

                            view.renderChilds(batch, getMyInfoForChild());
                            nDepthCounter--;
                        }
                    } else {
                        if (view != null && view.isDisposed()) {
                            // Remove disposedView from child list
                            this.removeChild(view);
                        }
                    }
                } catch (java.lang.IllegalStateException e) {
                    if (view != null && view.isDisposed()) {
                        // Remove disposedView from child list
                        this.removeChild(view);
                    }
                }

            } catch (java.util.NoSuchElementException e) {
                break; // da die Liste nicht mehr gltig ist, brechen wir hier den Iterator ab
            } catch (java.util.ConcurrentModificationException e) {
                break; // da die Liste nicht mehr gltig ist, brechen wir hier den Iterator ab
            } catch (java.lang.IndexOutOfBoundsException e) {
                break; // da die Liste nicht mehr gltig ist, brechen wir hier den Iterator ab
            }
        }
        childsInvalidate = false;
    }

    // Draw Debug REC
    if (debug) {

        if (DebugSprite != null) {
            batch.flush();
            DebugSprite.draw(batch);

        }

    }

    // reset Colorfilter ?
    if (ColorFilterSeted) {
        // alte abgespeicherte Farbe des Batches wieder herstellen!
        batch.setColor(R, G, B, A);
    }

}

From source file:ch.coldpixel.alpha.main.Camera.java

public void camUpdate(Batch batch) {
    handleInput();/*from  www  .  j  av a 2  s  .c om*/
    gravity();
    //Updates our OrthographicCamera after handleInput()!
    camera.update();
    batch.setProjectionMatrix(camera.combined);
}