本文整理匯總了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();
}
示例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();
}