GraphicsContext imageContext = canvas.createImageGraphicsContext(dark);
walk = animFrontStill;
// Draw the light shine
imageContext.setGraphicsListener(new GraphicsListener() {
public void draw(View view, Graphics graphics) {
view.setCamera(-400+posX, -300+posY, 0);
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);
}
public void init(View view, Graphics renderer) {
view.setCamera(0, 0, 0);
view.setSize(1024, 1024);
}
public void sizeChanged(GraphicsContext graphicsContext, View view) {}
});
canvas.setGraphicsListener(new GraphicsListener() {
// Variables for fire simulation
Random random = new Random();
long lightShineTime = 0;
long start = System.nanoTime();