@Override public float height() { return graphics().height(); } });
public void render(Surface surf) { surf.setFillColor(0xFFFFFFFF).fillRect(0, 0, graphics().width(), graphics().height()); } });
@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); } }
@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); } }
public void render(Surface surf) { surf.setFillColor(Color.rgb(255, 255, 255)); surf.fillRect(0, 0, graphics().width(), graphics().height()); } });
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); } });
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); } }));
@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()); } }
@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); } } }
@Override public void init() { CanvasImage canvasImage = graphics().createImage(graphics().width(), graphics().height()); canvas = canvasImage.canvas(); graphics().rootLayer().add(graphics().createImageLayer(canvasImage)); }