@Override protected void paintImpl (Surface surf) { surf.setFillColor(0xFFFFCC99).fillRect( 0, 0, game.graphics.viewSize.width(), game.graphics.viewSize.height()); // fill a rect that will be covered except for one pixel by the clipped immediate layers surf.setFillColor(0xFF000000); surf.fillRect(29, 29, 152, 152); surf.fillRect(259, 29, 102, 102); surf.fillRect(389, 29, 102, 102); } });
void drawLine(Surface surf, float x1, float y1, float x2, float y2, float width) { float xmin = Math.min(x1, x2), xmax = Math.max(x1, x2); float ymin = Math.min(y1, y2), ymax = Math.max(y1, y2); surf.setFillColor(0xFF0000AA); surf.fillRect(xmin, ymin, xmax-xmin, ymax-ymin); surf.setFillColor(0xFF99FFCC); surf.drawLine(x1, y1, x2, y2, width); surf.setFillColor(0xFFFF0000); surf.fillRect(x1, y1, 1, 1); surf.fillRect(x2, y2, 1, 1); }
void drawLine(Surface surf, float x1, float y1, float x2, float y2, float width) { float xmin = Math.min(x1, x2), xmax = Math.max(x1, x2); float ymin = Math.min(y1, y2), ymax = Math.max(y1, y2); surf.setFillColor(0xFF0000AA).fillRect(xmin, ymin, xmax-xmin, ymax-ymin); surf.setFillColor(0xFF99FFCC).drawLine(x1, y1, x2, y2, width); surf.setFillColor(0xFFFF0000).fillRect(x1, y1, 1, 1).fillRect(x2, y2, 1, 1); }
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); } }));
public void render (Surface surf) { surf.setFillColor(0xFF0000FF).fillRect(0, 0, 100, 25); // these two alpha fills should look the same surf.setFillColor(0x80FF0000).fillRect(0, 0, 50, 25); surf.setAlpha(0.5f).setFillColor(0xFFFF0000).fillRect(50, 0, 50, 25).setAlpha(1f); } }, 100, 25, "left and right half both same color");
protected void paintImpl (Surface surf) { surf.setFillColor(0xFF0000FF).fillRect(0, 0, 100, 25); // these two alpha fills should look the same surf.setFillColor(0x80FF0000).fillRect(0, 0, 50, 25); surf.setAlpha(0.5f).setFillColor(0xFFFF0000).fillRect(50, 0, 50, 25).setAlpha(1f); } }, 100, 25, "left and right half both same color");
public void render (Surface surf) { // this fill should be clipped to our bounds surf.setFillColor(0xFF99CCFF); surf.fillRect(-50, -50, 300, 300); // and this image should be clipped to our bounds surf.drawImage(circle, 125, -25); } });
protected void paintClipped (Surface surf) { // this fill should be clipped to our bounds surf.setFillColor(0xFF99CCFF); surf.fillRect(-50, -50, 200, 200); // and this image should be clipped to our bounds surf.draw(cirtex, 80, -25); } };
public void render (Surface surf) { surf.setFillColor(0xFF99CCFF); // this fill should be clipped to our bounds surf.fillRect(-50, -50, 300, 300); surf.drawImage(image, 125, -25); } });
public void render (Surface surf) { // fill some shapes with patterns surf.setFillPattern(pattern).fillRect(10, 0, 100, 100); // use same fill pattern for the triangles surf.translate(0, 160); // render a sliding window of half of our triangles to test the slice rendering surf.fillTriangles(verts, offset*4, (hsamples+1)*4, indices, offset*6, hsamples*6, offset*2); offset += doff; if (offset == 0) doff = 1; else if (offset == hsamples) doff = -1; } private int offset = 0, doff = 1;
protected void paintImpl (Surface surf) { surf.setFillColor(0xFFFFFFFF).fillRect( 0, 0, graphics.viewSize.width(), graphics.viewSize.height()); } };
public void render (Surface surf) { surf.setFillColor(0xFFCC99FF); surf.fillRect(0, 0, orange.width(), orange.height()); surf.drawImage(orange, 0, 0); } });
protected void paintClipped (Surface surf) { surf.setFillColor(0xFF99CCFF).fillRect(0, 0, 100, 100); surf.translate(50, 50).rotate(rotation).translate(-50, -50); surf.draw(saustex, 0, 25); } }, 260, 30);
protected void paintClipped (Surface surf) { surf.setFillColor(0xFF99CCFF).fillRect(0, 0, 100, 100); surf.translate(FloatMath.sin(elapsed) * 50, FloatMath.cos(elapsed) * 50 + 25); surf.draw(saustex, 0, 0); } }, 390, 30);
public void render (Surface surf) { surf.setFillColor(0xFF99CCFF); surf.fillRect(0, 0, 100, 100); surf.translate(FloatMath.sin(elapsed) * 50, FloatMath.cos(elapsed) * 50 + 25); surf.drawImage(sausage, 0, 0); } }), 260, 160);
public void render(Surface surf) { surf.setFillColor(Color.rgb(255, 255, 255)); surf.fillRect(0, 0, graphics().width(), graphics().height()); } });
@Override public void init() { // remove the background layer added by default graphics().rootLayer().removeAll(); // add a grey square SurfaceImage surf = graphics().createSurface(width, height); surf.surface().setFillColor(Color.rgb(200, 200, 200)); surf.surface().fillRect(0, 0, width, height); square = graphics().createImageLayer(surf); graphics().rootLayer().add(square); }
@Override public void init() { // remove the background layer added by default graphics().rootLayer().clear(); // add a grey square square = graphics().createSurfaceLayer(width, height); square.surface().setFillColor(Color.rgb(200, 200, 200)); square.surface().fillRect(0, 0, square.surface().width(), square.surface().height()); graphics().rootLayer().add(square); }