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


Java Batch.flush方法代碼示例

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


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

示例1: draw

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void draw (Batch batch, float parentAlpha) {
    Rectangle scissors = new Rectangle();
    Rectangle clipBounds = new Rectangle(getX(),getY(),getWidth(),getHeight());
    ScissorStack.calculateScissors(getStage().getCamera(), batch.getTransformMatrix(), clipBounds, scissors);
    ScissorStack.pushScissors(scissors);

    drawBg(batch, parentAlpha);

    batch.draw(texture,
            getX() + getWidth() / 2 - texture.getRegionWidth() / 2 + shift.x,
            getY() + getHeight() / 2 - texture.getRegionHeight() / 2 + shift.y,
            texture.getRegionWidth() / 2f,
            texture.getRegionHeight() / 2f,
            texture.getRegionWidth(), texture.getRegionHeight(),
            currZoom, currZoom, 0);

    drawSplits(batch, parentAlpha);

    batch.flush();
    ScissorStack.popScissors();
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:23,代碼來源:EditingZone.java

示例2: draw

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void draw(Batch batch, float alpha){
	float ratio = 1f / ((float)editor.pixmap().getWidth() / editor.pixmap().getHeight());
	float size = Math.min(width, height);
	float sclwidth = size * zoom;
	float sclheight = size * zoom * ratio;
	float centerx = x + width/2 + offsetx * zoom;
	float centery = y + height/2 + offsety * zoom;

	image.setImageSize(editor.pixmap().getWidth(), editor.pixmap().getHeight());
	
	batch.flush();
	boolean pop = ScissorStack.pushScissors(Tmp.r1.set(x + width/2 - size/2, y + height/2 - size/2, size, size));
	
	batch.draw(editor.texture(), centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);

	if(grid){
		Draw.color(Color.GRAY);
		image.setBounds(centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);
		image.draw(batch, alpha);
		Draw.color();
	}

	if(tool == EditorTool.line && drawing){
		Vector2 v1 = unproject(startx, starty).add(x, y);
		float sx = v1.x, sy = v1.y;
		Vector2 v2 = unproject(lastx, lasty).add(x, y);

		Draw.color(Tmp.c1.set(ColorMapper.getColor(editor.getDrawBlock())));
		Draw.thick(Unit.dp.scl(3f * zoom));
		Draw.line(sx, sy, v2.x, v2.y);

		Draw.polygon(sx, sy, 40, editor.getBrushSize() * zoom * 3);

           Draw.polygon(v2.x, v2.y, 40, editor.getBrushSize() * zoom * 3);
	}

	batch.flush();
	
	if(pop) ScissorStack.popScissors();
	
	Draw.color(Colors.get("accent"));
	Draw.thick(Unit.dp.scl(3f));
	Draw.linerect(x + width/2 - size/2, y + height/2 - size/2, size, size);
	Draw.reset();
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:47,代碼來源:MapView.java


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