當前位置: 首頁>>代碼示例>>Java>>正文


Java Batch.begin方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Batch.begin方法的典型用法代碼示例。如果您正苦於以下問題:Java Batch.begin方法的具體用法?Java Batch.begin怎麽用?Java Batch.begin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.g2d.Batch的用法示例。


在下文中一共展示了Batch.begin方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawBg

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
public void drawBg(Batch batch, float parentAlpha) {
    batch.end();
    Gdx.gl.glLineWidth(1.0f);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    shapeRenderer.setProjectionMatrix(getStage().getCamera().combined);
    Matrix4 matrix = batch.getTransformMatrix();
    shapeRenderer.setTransformMatrix(matrix);

    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    BG.a = parentAlpha;
    shapeRenderer.setColor(BG);
    shapeRenderer.rect(getX(), getY(), getWidth(), getHeight());
    shapeRenderer.end();

    Gdx.gl.glDisable(GL20.GL_BLEND);
    batch.begin();
    batch.setColor(Color.WHITE.r, Color.WHITE.g, Color.WHITE.b, Color.WHITE.a * parentAlpha);
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:21,代碼來源:EditingZone.java

示例2: draw

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void draw (Batch batch, float parentAlpha) {
    batch.end();

    Gdx.gl.glLineWidth(10);

    for (PolygonRegion region : polygonRegions) {

        this.batch.begin();
        this.batch.draw(region, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        this.batch.end();

        Polyline line = new Polyline(region.getVertices());
        line.setScale(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
        shapeRenderer.setColor(Color.BROWN);
        shapeRenderer.polyline(line.getTransformedVertices());
        shapeRenderer.end();
    }

    batch.begin();
}
 
開發者ID:cpppwner,項目名稱:NoRiskNoFun,代碼行數:25,代碼來源:GameObjectMap.java

示例3: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(float delta) {
    Klooni.theme.glClearBackground();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(Math.min(Gdx.graphics.getDeltaTime(), MIN_DELTA));
    stage.draw();

    // After everything is drawn, showcase the current shop item
    SnapshotArray<Actor> children = shopGroup.getChildren();
    if (children.size > 0) {
        final ShopCard card = (ShopCard)children.get(showcaseIndex);

        final Batch batch = stage.getBatch();
        batch.begin();
        // For some really strange reason, we need to displace the particle effect
        // by "buyBand.height", or it will render exactly that height below where
        // it should.
        // TODO Fix this - maybe use the same project matrix as stage.draw()?
        // batch.setProjectionMatrix(stage.getViewport().getCamera().combined)
        if (!card.showcase(batch, buyBand.getHeight())) {
            showcaseIndex = (showcaseIndex + 1) % children.size;
        }
        batch.end();
    }

    if (Gdx.input.isKeyJustPressed(Input.Keys.BACK)) {
        goBack();
    }
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:31,代碼來源:CustomizeScreen.java

示例4: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch)
{
	batch.setProjectionMatrix(camera.combined);
	batch.end();
	mapRenderer.render();
	mapRenderer.setView(camera);
	batch.begin();
	Collection<GameObject> toRender = gameObjects.values();
	for (GameObject object : toRender)
		object.render(batch);
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:13,代碼來源:PlayState.java

示例5: drawSplits

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
public void drawSplits(Batch batch, float parentAlpha) {
    batch.end();
    Gdx.gl.glLineWidth(1.0f);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    shapeRenderer.setProjectionMatrix(getStage().getCamera().combined);
    Matrix4 matrix = batch.getTransformMatrix();
    shapeRenderer.setTransformMatrix(matrix);

    shapeRenderer.begin(ShapeRenderer.ShapeType.Line);

    // left, right, top , bottom
    Color guideColor = new Color(GUIDE_COLOR);
    guideColor.a*=parentAlpha;
    Color overColor = new Color(OVER_GUIDE_COLOR);
    overColor.a*=parentAlpha;

    splitPositions[0] = shift.x + getWidth() / 2f + (-texture.getRegionWidth() / 2f + splits[0]) * currZoom;
    splitPositions[1] = shift.x + getWidth() / 2f + (texture.getRegionWidth() / 2f - splits[1]) * currZoom;
    splitPositions[2] = shift.y + getHeight()/2f + (texture.getRegionHeight()/2 - splits[2])*currZoom;
    splitPositions[3] = shift.y + getHeight() / 2f + (-texture.getRegionHeight() / 2 + splits[3]) * currZoom;


    if(mouseOverSplit == 0) shapeRenderer.setColor(overColor); else shapeRenderer.setColor(guideColor);
    shapeRenderer.line(getX() + splitPositions[0], getY(), getX() + splitPositions[0], getY() + getHeight());

    if(mouseOverSplit == 1) shapeRenderer.setColor(overColor); else shapeRenderer.setColor(guideColor);
    shapeRenderer.line(getX() + splitPositions[1], getY(), getX() + splitPositions[1], getY() + getHeight());

    if(mouseOverSplit == 2) shapeRenderer.setColor(overColor); else shapeRenderer.setColor(guideColor);
    shapeRenderer.line(getX(), getY() + splitPositions[2], getX() + getWidth(), getY() + splitPositions[2]);

    if(mouseOverSplit == 3) shapeRenderer.setColor(overColor); else shapeRenderer.setColor(guideColor);
    shapeRenderer.line(getX(), getY() + splitPositions[3], getX() + getWidth(), getY() + splitPositions[3]);

    shapeRenderer.end();
    Gdx.gl.glDisable(GL20.GL_BLEND);
    batch.begin();
    batch.setColor(Color.WHITE.r, Color.WHITE.g, Color.WHITE.b, Color.WHITE.a * parentAlpha);
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:42,代碼來源:EditingZone.java

示例6: renderBackground

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
private void renderBackground(Batch backupBatch)
{
	backupBatch.begin();
       backupBatch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
       backupBatch.end();
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:7,代碼來源:GameClient.java

示例7: renderCursor

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
private void renderCursor(Batch backupBatch)
{
	backupBatch.begin();
       backupBatch.draw(mousePointer, Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY() - 24, 24, 24);
       backupBatch.end();
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:7,代碼來源:GameClient.java


注:本文中的com.badlogic.gdx.graphics.g2d.Batch.begin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。