本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Batch.setTransformMatrix方法的典型用法代碼示例。如果您正苦於以下問題:Java Batch.setTransformMatrix方法的具體用法?Java Batch.setTransformMatrix怎麽用?Java Batch.setTransformMatrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.Batch
的用法示例。
在下文中一共展示了Batch.setTransformMatrix方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: draw
import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void draw(Batch batch) {
age += Gdx.graphics.getDeltaTime();
final float progress = age * INV_LIFETIME;
final float currentSize = Interpolation.pow2In.apply(size, 0, progress);
final float currentRotation = Interpolation.sine.apply(0, TOTAL_ROTATION, progress);
final Matrix4 original = batch.getTransformMatrix().cpy();
final Matrix4 rotated = batch.getTransformMatrix();
final float disp =
+ 0.5f * (size - currentSize) // the smaller, the more we need to "push" to center
+ currentSize * 0.5f; // center the cell for rotation
rotated.translate(pos.x + disp, pos.y + disp, 0);
rotated.rotate(0, 0, 1, currentRotation);
rotated.translate(currentSize * -0.5f, currentSize * -0.5f, 0); // revert centering for rotation
batch.setTransformMatrix(rotated);
Cell.draw(color, batch, 0, 0, currentSize);
batch.setTransformMatrix(original);
}
示例2: draw
import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
public void draw(final Batch batch) {
batch.setTransformMatrix(batch.getTransformMatrix().translate(pos.x, pos.y, 0));
for (int i = 0; i < cellCount; ++i)
for (int j = 0; j < cellCount; ++j)
cells[i][j].draw(batch);
for (int i = effects.size; i-- != 0;) {
effects.get(i).draw(batch);
if (effects.get(i).isDone())
effects.removeIndex(i);
}
batch.setTransformMatrix(batch.getTransformMatrix().translate(-pos.x, -pos.y, 0));
}