本文整理了Java中com.badlogic.gdx.scenes.scene2d.utils.Drawable.draw()
方法的一些代码示例,展示了Drawable.draw()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.draw()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.utils.Drawable
类名称:Drawable
方法名:draw
[英]Draws this drawable at the specified bounds. The drawable should be tinted with Batch#getColor(), possibly by mixing its own color.
[中]在指定的边界处绘制此可绘制对象。应使用Batch#getColor()对可拉伸材料着色,可能是通过混合其自身颜色。
代码示例来源:origin: libgdx/libgdx
/** Draws selection rectangle **/
protected void drawSelection (Drawable selection, Batch batch, BitmapFont font, float x, float y) {
selection.draw(batch, x + textOffset + selectionX + fontOffset, y - textHeight - font.getDescent(), selectionWidth,
textHeight);
}
代码示例来源:origin: libgdx/libgdx
/** Draws selection rectangle **/
protected void drawSelection (Drawable selection, Batch batch, BitmapFont font, float x, float y) {
selection.draw(batch, x + textOffset + selectionX + fontOffset, y - textHeight - font.getDescent(), selectionWidth,
textHeight);
}
代码示例来源:origin: libgdx/libgdx
protected void drawStageBackground (Batch batch, float parentAlpha, float x, float y, float width, float height) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
style.stageBackground.draw(batch, x, y, width, height);
}
代码示例来源:origin: libgdx/libgdx
protected void drawStageBackground (Batch batch, float parentAlpha, float x, float y, float width, float height) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
style.stageBackground.draw(batch, x, y, width, height);
}
代码示例来源:origin: libgdx/libgdx
/** Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background
* drawable. */
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
if (background == null) return;
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
background.draw(batch, x, y, getWidth(), getHeight());
}
代码示例来源:origin: libgdx/libgdx
/** Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background
* drawable. */
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
if (background == null) return;
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
background.draw(batch, x, y, getWidth(), getHeight());
}
代码示例来源:origin: libgdx/libgdx
/** Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background
* drawable. */
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
if (background == null) return;
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
background.draw(batch, x, y, getWidth(), getHeight());
}
代码示例来源:origin: libgdx/libgdx
/** Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background
* drawable. */
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
if (background == null) return;
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
background.draw(batch, x, y, getWidth(), getHeight());
}
代码示例来源:origin: libgdx/libgdx
protected void drawCursor (Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y) {
cursorPatch.draw(batch,
x + textOffset + glyphPositions.get(cursor) - glyphPositions.get(visibleTextStart) + fontOffset + font.getData().cursorX,
y - textHeight - font.getDescent(), cursorPatch.getMinWidth(), textHeight);
}
代码示例来源:origin: libgdx/libgdx
protected void drawCursor (Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y) {
cursorPatch.draw(batch,
x + textOffset + glyphPositions.get(cursor) - glyphPositions.get(visibleTextStart) + fontOffset + font.getData().cursorX,
y - textHeight - font.getDescent(), cursorPatch.getMinWidth(), textHeight);
}
代码示例来源:origin: libgdx/libgdx
/** Called to draw the background. Default implementation draws the style background drawable. */
protected void drawBackground (Batch batch, float parentAlpha) {
if (style.background != null) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void render () {
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
drawable.draw(batch, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch.end();
}
代码示例来源:origin: libgdx/libgdx
/** Called to draw the background. Default implementation draws the style background drawable. */
protected void drawBackground (Batch batch, float parentAlpha) {
if (style.background != null) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void draw (Batch batch, float parentAlpha) {
validate();
Color c = getColor();
batch.setColor(c.r, c.g, c.b, c.a * parentAlpha);
float x = getX();
float y = getY();
float w = getWidth();
float h = getHeight();
final Drawable bg = style.background;
if (bg != null) bg.draw(batch, x, y, w, h);
final Drawable knob = style.knob;
if (knob != null) {
x += knobPosition.x - knob.getMinWidth() / 2f;
y += knobPosition.y - knob.getMinHeight() / 2f;
knob.draw(batch, x, y, knob.getMinWidth(), knob.getMinHeight());
}
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void drawCursor (Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y) {
float textOffset = cursor >= glyphPositions.size || cursorLine * 2 >= linesBreak.size ? 0
: glyphPositions.get(cursor) - glyphPositions.get(linesBreak.items[cursorLine * 2]);
cursorPatch.draw(batch, x + textOffset + fontOffset + font.getData().cursorX,
y - font.getDescent() / 2 - (cursorLine - firstLineShowing + 1) * font.getLineHeight(), cursorPatch.getMinWidth(),
font.getLineHeight());
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void drawCursor (Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y) {
float textOffset = cursor >= glyphPositions.size || cursorLine * 2 >= linesBreak.size ? 0
: glyphPositions.get(cursor) - glyphPositions.get(linesBreak.items[cursorLine * 2]);
cursorPatch.draw(batch, x + textOffset + fontOffset + font.getData().cursorX,
y - font.getDescent() / 2 - (cursorLine - firstLineShowing + 1) * font.getLineHeight(), cursorPatch.getMinWidth(),
font.getLineHeight());
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float x = getX();
float y = getY();
float scaleX = getScaleX();
float scaleY = getScaleY();
if (drawable instanceof TransformDrawable) {
float rotation = getRotation();
if (scaleX != 1 || scaleY != 1 || rotation != 0) {
((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
imageWidth, imageHeight, scaleX, scaleY, rotation);
return;
}
}
if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float x = getX();
float y = getY();
float scaleX = getScaleX();
float scaleY = getScaleY();
if (drawable instanceof TransformDrawable) {
float rotation = getRotation();
if (scaleX != 1 || scaleY != 1 || rotation != 0) {
((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
imageWidth, imageHeight, scaleX, scaleY, rotation);
return;
}
}
if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = tempColor.set(getColor());
color.a *= parentAlpha;
if (style.background != null) {
batch.setColor(color.r, color.g, color.b, color.a);
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
if (style.fontColor != null) color.mul(style.fontColor);
cache.tint(color);
cache.setPosition(getX(), getY());
cache.draw(batch);
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = tempColor.set(getColor());
color.a *= parentAlpha;
if (style.background != null) {
batch.setColor(color.r, color.g, color.b, color.a);
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
if (style.fontColor != null) color.mul(style.fontColor);
cache.tint(color);
cache.setPosition(getX(), getY());
cache.draw(batch);
}
内容来源于网络,如有侵权,请联系作者删除!