package com.bzrkthecoder.javagame;

import java.awt.Canvas;
import java.awt.Dimension;
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;
	}
	
	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();
	}

}

@@ -80,16 +80,42 @@
 ension;%0A
+import java.awt.Graphics;%0A
 import j
@@ -144,16 +144,17 @@
 rategy;%0A
+%0A
 import j
@@ -1000,17 +1000,16 @@
 der() %7B%0A
-%09
 %09BufferS
@@ -1042,17 +1042,16 @@
 tegy();%0A
-%09
 %09if (bs 
@@ -1058,18 +1058,19 @@
 == null)
+ %7B
 %0A
-%09
 %09%09create
@@ -1097,24 +1097,169 @@
 %09return;%0A%09%7D%0A
+%09%09%0A%09%09Graphics g = bs.getDrawGraphics();%0A%09%09g.setColor(Color.BLACK);%0A%09%09g.fillRect(0, 0, getWidth(), getHeight());%0A%09%09g.dispose();%0A%09%09bs.show();%0A%09%7D%0A%09%0A
 %09%0A%09public st

Update render();