package com.bzrkthecoder.javagame;

import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

import javax.swing.JFrame;

public class Game extends Canvas implements Runnable {
	private static final long serialVersionUID = 1L;
	
	public static int width = 300;
	public static int height = width * 16 / 9;
	public static int scale = 3;
	
	private Thread thread;
	private JFrame frame;
	private boolean running = false;
	
	public Game() {
		Dimension size = new Dimension(width * scale, height * scale);
		setPreferredSize(size);
		
		frame = new JFrame();
	}
	
	public synchronized void start() {
		running = true;
		thread = new Thread(this, "Display");
		thread.start();
	}
	
	public synchronized void stop() {
		running = false;
		try {
		thread.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	public void run() {
		while(running);
			update();
			render();
	}
	
	public void update() {
	}
	
	public void render() {
	BufferStrategy bs = getBufferStrategy();
	if (bs == null) {
		createBufferStrategy(3);
		return;
	}
		
		Graphics g = bs.getDrawGraphics();
		g.setColor(Color.BLACK);
		g.fillRect(0, 0, getWidth(), getHeight());
		g.dispose();
		bs.show();
	}
	
	
	public static void main(String[] args) {
		Game game = new Game();
		game.frame.setResizable(false);
		game.frame.setTitle("'The Community Game'");
		game.frame.add(game);
		game.frame.pack();
		game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		game.frame.setVisible(true);
		
		game.start();
	}

}

@@ -18,20 +18,28 @@
 hecoder.
-java
+thecommunity
 game;%0A%0Ai
@@ -61,16 +61,39 @@
 Canvas;%0A
+import java.awt.Color;%0A
 import j
@@ -174,16 +174,90 @@
 trategy;
+%0Aimport java.awt.image.BufferedImage;%0Aimport java.awt.image.DataBufferInt;
 %0A%0Aimport
@@ -455,14 +455,14 @@
 dth 
-*
+/
  16 
-/
+*
  9;%0A
@@ -572,24 +572,205 @@
  = false;%0A%09%0A
+%09private BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);%0A%09private int%5B%5D pixels = ((DataBufferInt)image.getRaster().getDataBuffer()).getData();%0A%09%0A
 %09public Game
@@ -1286,16 +1286,17 @@
 der() %7B%0A
+%09
 %09BufferS
@@ -1329,16 +1329,17 @@
 tegy();%0A
+%09
 %09if (bs 
@@ -1349,16 +1349,17 @@
 null) %7B%0A
+%09
 %09%09create
@@ -1383,16 +1383,17 @@
 ;%0A%09%09
+%09
 return;%0A
 %09%7D%0A%09
@@ -1388,16 +1388,17 @@
 return;%0A
+%09
 %09%7D%0A%09%09%0A%09%09
@@ -1536,15 +1536,13 @@
 ();%0A
+
 %09%7D%0A%09%0A
-%09%0A
 %09pub

Update Game.java