GraphicsContext imageContext = canvas.createImageGraphicsContext(dark);
walk = animFrontStill;
GraphicsContext testContext = canvas.createImageGraphicsContext(darktest);
// Draw the light shine
imageContext.setGraphicsListener(new GraphicsListener() {
public void draw(View view, Graphics graphics) {
graphics.setClearColor(new Color4f(.0f,.0f,.0f,.98f));
graphics.clear();
drawLight(graphics, walk, light, posX + xOffset, posY, lightShineRandom3);
drawLight(graphics, animFire, light, 150 - animFire.getWidth()/2, 100 - animFire.getHeight()/2, lightShineRandom1);
drawLight(graphics, animFire, light, 650 - animFire.getWidth()/2, 100 - animFire.getHeight()/2, lightShineRandom2);
drawLight(graphics, animFire, light, 150 - animFire.getWidth()/2, 450 - animFire.getHeight()/2, lightShineRandom3);
drawLight(graphics, animFire, light, 650 - animFire.getWidth()/2, 450 - animFire.getHeight()/2, lightShineRandom4);
// graphics.clearTransformation();
// graphics.setColor(white);
// graphics.drawImage(darktest, 128, 128);
}
public void init(View view, Graphics renderer) {
view.setCamera(0, 0, 0);
view.setSize(256, 256);
}
public void sizeChanged(GraphicsContext graphicsContext, View view) {}
});
testContext.setGraphicsListener(new GraphicsListener() {
public void draw(View view, Graphics graphics) {
graphics.setClearColor(new Color4f(.1f,.0f,.0f,.98f));
graphics.clear();
}
public void init(View view, Graphics renderer) {
view.setCamera(0, 0, 0);
view.setSize(256, 256);
}
public void sizeChanged(GraphicsContext graphicsContext, View view) {}
});
System.out.println("starting demo");
canvas.setGraphicsListener(new GraphicsListener() {
// Variables for fire simulation
Random random = new Random();
long lightShineTime = 0;
long start = System.nanoTime();