private void render() {
   BufferStrategy bs = this.getBufferStrategy();
   if (bs == null) {
     this.createBufferStrategy(2);
     return;
   }
   Graphics g = bs.getDrawGraphics();
   if (scene != null) scene.render();
   g.drawImage(image, 0, 0, WIDTH * SCALE, HEIGHT * SCALE, this);
   g.dispose();
   bs.show();
 }
 public void setScene(Scene s) {
   if (scene != null) scene.dispose();
   scene = s;
   scene.pixels = pixels;
   if (scene != null) scene.init();
 }
 private void dispose() {
   if (scene != null) scene.dispose();
   System.exit(0);
 }
 private void update() {
   if (scene != null) scene.update();
 }