本文整理了Java中com.badlogic.gdx.scenes.scene2d.Group.draw()
方法的一些代码示例,展示了Group.draw()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.draw()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Group
类名称:Group
方法名:draw
[英]Draws the group and its children. The default implementation calls #applyTransform(Batch,Matrix4) if needed, then #drawChildren(Batch,float), then #resetTransform(Batch) if needed.
[中]绘制组及其子对象。默认实现在需要时调用#applyTransform(Batch,Matrix4),然后调用#drawChildren(Batch,float),然后调用#resetTransform(Batch)。
代码示例来源:origin: libgdx/libgdx
/** If this method is overridden, the super method or {@link #validate()} should be called to ensure the widget group is laid
* out. */
public void draw (Batch batch, float parentAlpha) {
validate();
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: libgdx/libgdx
/** If this method is overridden, the super method or {@link #validate()} should be called to ensure the widget group is laid
* out. */
public void draw (Batch batch, float parentAlpha) {
validate();
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: libgdx/libgdx
public void draw () {
Camera camera = viewport.getCamera();
camera.update();
if (!root.isVisible()) return;
Batch batch = this.batch;
batch.setProjectionMatrix(camera.combined);
batch.begin();
root.draw(batch, 1);
batch.end();
if (debug) drawDebug();
}
代码示例来源:origin: libgdx/libgdx
public void draw () {
Camera camera = viewport.getCamera();
camera.update();
if (!root.isVisible()) return;
Batch batch = this.batch;
batch.setProjectionMatrix(camera.combined);
batch.begin();
root.draw(batch, 1);
batch.end();
if (debug) drawDebug();
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
// Use Stage#toScreenCoordinates, which we know is correct.
toScreenCoordinates.set(testX, testY).sub(getOriginX(), getOriginY()).scl(getScaleX(), getScaleY()).rotate(getRotation())
.add(getOriginX(), getOriginY()).add(getX(), getY());
getStage().toScreenCoordinates(toScreenCoordinates, batch.getTransformMatrix());
// Do the same as toScreenCoordinates via Actor#localToParentCoordinates.
localToAscendantCoordinates(null, localToParentCoordinates.set(testX, testY));
getStage().stageToScreenCoordinates(localToParentCoordinates);
// System.out.println(name + " " + toScreenCoordinates + " " + localToParentCoordinates);
batch.setColor(getColor());
batch.draw(region, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(),
getRotation());
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: SquidPony/SquidLib
@Override
public void draw(Batch batch, float parentAlpha) {
//textFactory.configureShader(batch);
super.draw(batch, parentAlpha);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
/** If this method is overridden, the super method or {@link #validate()} should be called to ensure the widget group is laid
* out. */
public void draw (Batch batch, float parentAlpha) {
validate();
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: Var3D/var3dframe
public void draw(Batch batch, float parentAlpha) {
bg0.act(Gdx.graphics.getDeltaTime());
bg0.draw(batch, 1);
super.draw(batch, parentAlpha);
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
@Override
public void draw(Batch batch, float alpha) {
super.draw(batch, alpha);
// DRAW TARGET DESCRIPTION
String desc = iActor.getDesc();
if (desc != null) {
float margin = DPIUtils.UI_SPACE;
float textX = x - layout.width / 2;
float textY = y - layout.height - DPIUtils.UI_SPACE;
if (textX < 0)
textX = 0;
RectangleRenderer.draw(batch, textX - margin, textY - layout.height - margin,
layout.width + margin*2, layout.height + margin*2, Color.BLACK);
font.draw(batch, layout, textX, textY);
}
}
代码示例来源:origin: lycying/c2d-engine
@Override
public void draw(Batch batch, float parentAlpha) {
final Vector2 position = model.body.getPosition();
this.setPosition(position.x*RADIO -model.drawableOffsetX,position.y*RADIO -model.drawableOffsetY);
this.setRotation(MathUtils.radiansToDegrees * model.body.getAngle());
super.draw(batch, parentAlpha);
}
/**
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
@Override
public void draw(Batch batch, float alpha) {
// check if the interactive or visible property has change and hide it.
if (!iActor.canInteract()) {
hide();
return;
}
super.draw(batch, alpha);
// DRAW TARGET DESCRIPTION
String desc = iActor.getDesc();
if (desc != null) {
float margin = DPIUtils.UI_SPACE;
float textX = x - layout.width / 2;
float textY = y - layout.height - DPIUtils.UI_SPACE;
if (textX < 0)
textX = 0;
RectangleRenderer.draw(batch, textX - margin, textY - layout.height - margin, layout.width + margin * 2,
layout.height + margin * 2, Color.BLACK);
font.draw(batch, layout, textX, textY);
}
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void draw () {
Camera camera = viewport.getCamera();
camera.update();
if (!root.isVisible()) return;
Batch batch = this.batch;
batch.setProjectionMatrix(camera.combined);
batch.begin();
root.draw(batch, 1);
batch.end();
if (debug) drawDebug();
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
@Override
public void draw (Batch batch, float parentAlpha) {
if (color != null) {
batch.setColor(color);
batch.draw(texture, getX(), getY(), getWidth(), getHeight());
batch.setColor(Color.WHITE);
}
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: lycying/c2d-engine
@Override
public void draw() {
if (!getRoot().isVisible()) return;
Engine.getSpriteBatch().begin();
getRoot().draw(Engine.getSpriteBatch(), 1);
Engine.getSpriteBatch().end();
}
}
代码示例来源:origin: SquidPony/SquidLib
super.draw(batch, parentAlpha);
int len = animatedEntities.size();
for (int i = 0; i < len; i++) {
代码示例来源:origin: lycying/c2d-engine
@Override
public void draw(Batch batch, float parentAlpha) {
float currentX = - parallaxGroup.getResult().speedTracker.x * parallaxRatio.x % ( this.getWidth() + padding.x) ;
if(currentX>0){
currentX -= ( this.getWidth() + padding.x);
}
do{
this.setX(startPosition.x + currentX);
float currentY = - parallaxGroup.getResult().speedTracker.y * parallaxRatio.y % ( this.getHeight() + padding.y) ;
if(currentY>0){
currentY -= ( this.getHeight() + padding.y);
}
do{
this.setY(startPosition.y+currentY);
super.draw(batch, parentAlpha);
currentY += ( this.getHeight() + padding.y);
}while(currentY < parallaxGroup.getHeight());
currentX += ( this.getWidth() + padding.x);
}while(currentX < parallaxGroup.getWidth() );
}
}
代码示例来源:origin: crashinvaders/gdx-texture-packer-gui
@Override
public void draw(Batch batch, float parentAlpha) {
float x = getX();
float y = getY();
float width = getWidth() * getScaleX();
float height = getHeight() * getScaleY();
Texture pageTexture = page.getTexture();
if (pageTexture != null) {
if (firstPageRender) {
firstPageRender = false;
startPageAppearAnimation();
}
Color col = getColor();
batch.setColor(col.r, col.g, col.b, col.a * parentAlpha * pageAlpha);
batch.draw(pageTexture, x, y, width, height);
}
batch.setColor(Color.BLACK);
borderFrame.draw(batch, x, y, width, height);
// Draws children after all
super.draw(batch, parentAlpha);
}
代码示例来源:origin: moribitotech/MTX
@Override
public void draw(SpriteBatch batch, float parentAlpha) {
super.draw(batch, parentAlpha);
// For fade out/in effect
batch.setColor(this.getColor().r, this.getColor().g, this.getColor().b,
parentAlpha * this.getColor().a);
// DRAW TEXTURE REGION (Draw only if set active and not null)
// ##################################################################
if (isTextureRegionActive && textureRegion != null) {
// Draw it due to actors' settings
batch.draw(textureRegion, getX(), getY(), getOriginX(),
getOriginY(), getWidth(), getHeight(), getScaleX(),
getScaleY(), getRotation());
}
}
代码示例来源:origin: org.mini2Dx/mini2Dx-core
@Override
public void drawStage(Stage stage) {
endRendering();
Camera stageCamera = stage.getViewport().getCamera();
stageCamera.up.set(0, -1, 0);
stageCamera.direction.set(0, 0, 1);
stageCamera.update();
if (!stage.getRoot().isVisible()) {
return;
}
renderingStage = true;
beginRendering();
spriteBatch.setProjectionMatrix(stageCamera.combined);
polygonSpriteBatch.setProjectionMatrix(stageCamera.combined);
shapeRenderer.setProjectionMatrix(stageCamera.combined);
spriteBatch.begin();
stage.getRoot().draw(spriteBatch, 1);
spriteBatch.end();
endRendering();
renderingStage = false;
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
@Override
public void draw(Batch batch, float alpha) {
Inventory inventory = sceneScreen.getUI().getWorld().getInventory();
if (!inventory.isVisible()) {
setVisible(false);
return;
}
if (style.background != null) {
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
// DRAW ITEMS
int capacity = cols * rows;
for (int i = 0; i < inventory.getNumItems() && i < capacity; i++) {
SpriteActor a = inventory.get(i);
ActorRenderer r = a.getRenderer();
float size = (tileSize - rowSpace) / (r.getHeight() > r.getWidth() ? r.getHeight() : r.getWidth());
float x = i % cols;
float y = (rows - 1) - i / cols;
if (style.itemBackground != null) {
style.itemBackground.draw(batch, getX() + x * tileSize + x * rowSpace + margin,
getY() + y * tileSize + y * rowSpace + margin, tileSize, tileSize);
}
r.draw((SpriteBatch) batch, getX() + x * tileSize + x * rowSpace + tileSize / 2 + margin,
getY() + (tileSize - r.getHeight() * size) / 2 + y * tileSize + y * rowSpace + margin, size, size, 0f,
a.getTint());
}
super.draw(batch, alpha);
}
内容来源于网络,如有侵权,请联系作者删除!