本文整理了Java中playn.core.Graphics.height()
方法的一些代码示例,展示了Graphics.height()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics.height()
方法的具体详情如下:
包路径:playn.core.Graphics
类名称:Graphics
方法名:height
[英]Gets the height of the drawable surface, in pixels.
[中]获取可绘制曲面的高度(以像素为单位)。
代码示例来源:origin: threerings/playn
@Override
public float height() {
return graphics().height();
}
});
代码示例来源:origin: threerings/playn
public void render(Surface surf) {
surf.setFillColor(0xFFFFFFFF).fillRect(0, 0, graphics().width(), graphics().height());
}
});
代码示例来源:origin: threerings/playn
@Override
public void paint(float alpha) {
float t = (time + alpha*UPDATE_RATE) / 1000;
square.setTranslation((FloatMath.cos(t) + 1) * (graphics().width() - width) / 2,
(FloatMath.sin(t) + 1) * (graphics().height() - height) / 2);
}
}
代码示例来源:origin: com.googlecode.playn/playn-tests-core
@Override
public void paint(float alpha) {
float t = (time + alpha) / 1000;
square.setTranslation((FloatMath.cos(t) + 1) * (graphics().width() - width) / 2,
(FloatMath.sin(t) + 1) * (graphics().height() - height) / 2);
}
}
代码示例来源:origin: com.googlecode.playn/playn-tests-core
public void render(Surface surf) {
surf.setFillColor(Color.rgb(255, 255, 255));
surf.fillRect(0, 0, graphics().width(), graphics().height());
}
});
代码示例来源:origin: com.googlecode.playn/playn-tests-core
public void render (Surface surf) {
surf.setFillColor(0xFFFFCC99);
surf.fillRect(0, 0, graphics().width(), graphics().height());
// fill a rect that will be covered except for one pixel by the clipped immediate layer
surf.setFillColor(0xFF000000);
surf.fillRect(99, 99, 202, 202);
}
});
代码示例来源:origin: threerings/playn
public void render (Surface surf) {
surf.setFillColor(0xFFFFCC99);
surf.fillRect(0, 0, graphics().width(), graphics().height());
// fill a rect that will be covered except for one pixel by the clipped immediate layers
surf.setFillColor(0xFF000000);
surf.fillRect(29, 29, 202, 202);
surf.fillRect(259, 29, 102, 102);
surf.fillRect(259, 159, 102, 102);
}
}));
代码示例来源:origin: threerings/playn
@Override public void init () {
final float spacing = 5;
float y = spacing, x = spacing, nextX = spacing;
for (final Mode mode : host.enumerateModes()) {
ImageLayer button = createButton(mode.toString(), new Runnable() {
@Override public void run () {
host.setMode(mode);
}
});
graphics().rootLayer().add(button);
if (y + button.height() + spacing >= graphics().height()) {
x = nextX + spacing;
y = spacing;
}
button.setTranslation(x, y);
y += button.height() + spacing;
nextX = Math.max(nextX, x + button.width());
}
}
代码示例来源:origin: threerings/playn
@Override
public void update(int delta) {
canvas.clear();
canvas.setStrokeWidth(3);
canvas.setStrokeColor(0x88ff0000);
noSegs += direction;
if (noSegs > 50) direction = -1;
if (noSegs < 20) direction = 1;
final float r = 100;
for (int ii = 0; ii < noSegs; ii++) {
float angle = 2*FloatMath.PI * ii / noSegs;
float x = (r * FloatMath.cos(angle)) + graphics().width() / 2;
float y = (r * FloatMath.sin(angle)) + graphics().height() /2;
canvas.strokeCircle(x, y, 100);
}
}
}
代码示例来源:origin: threerings/playn
@Override
public void init() {
CanvasImage canvasImage = graphics().createImage(graphics().width(), graphics().height());
canvas = canvasImage.canvas();
graphics().rootLayer().add(graphics().createImageLayer(canvasImage));
}
内容来源于网络,如有侵权,请联系作者删除!