package client;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.*;
import java.net.*;
import java.util.Vector;
import java.lang.Math;

import server.Server;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.SlickException;

import slimpleslickgame.Application;

public class Client{

    public static int WIDTH   = 1280;
    public static int HEIGHT  = 720;
    public static final int FPS     = 60;
    public static final double VERSION = 1.0;

	public static void main(String[] args) {
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		//WIDTH = (int) screenSize.getWidth();
		//HEIGHT = (int) screenSize.getHeight();
		//TODO: implement
		
		try{
			AppGameContainer container = new AppGameContainer(new Application("SpaceDefence"));
            container.setDisplayMode(WIDTH, HEIGHT, false);
            container.setTargetFrameRate(FPS);
            container.setShowFPS(true);
            container.start();
		} catch (SlickException e){
			e.printStackTrace();
		}
	}
	
	private String name;
    private Socket connection;
    private InputStream in;
    private OutputStream out;
    private InThread inputThread;

    public Client(Socket connection, String name){
        this.connection = connection;
        this.name = name;
        
        try{
        	in = connection.getInputStream();
    		out = connection.getOutputStream();
        	
        	AppGameContainer container = new AppGameContainer(new Application("SpaceDefence"));
            container.setDisplayMode(WIDTH, HEIGHT, false);
            container.setTargetFrameRate(FPS);
            container.setShowFPS(true);
            container.start();
            
		} catch (SlickException e){
			e.printStackTrace();
		} catch(IOException ioe){
			ioe.printStackTrace();
		}
    }
    

    public void writeMessage(byte[] msg){
        try{
            Writer writer;
            writer = new OutputStreamWriter(connection.getOutputStream()); 
            writer.write(msg.toString(), 0, msg.length);
            writer.flush();
        }catch(IOException ioe){ioe.printStackTrace();}
    }
}

@@ -13,169 +13,8 @@
 nt;%0A
-import java.awt.Dimension;%0Aimport java.awt.Toolkit;%0Aimport java.io.*;%0Aimport java.net.*;%0Aimport java.util.Vector;%0Aimport java.lang.Math;%0A%0Aimport server.Server;%0A%0A
 impo
@@ -52,16 +52,16 @@
 tainer;%0A
+
 import o
@@ -364,182 +364,8 @@
 ) %7B%0A
-%09%09Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();%0A%09%09//WIDTH = (int) screenSize.getWidth();%0A%09%09//HEIGHT = (int) screenSize.getHeight();%0A%09%09//TODO: implement%0A
 %09%09%0A%09
@@ -697,1102 +697,9 @@
 %09%09%7D%0A
+
 %09%7D%0A
-%09%0A%09private String name;%0A    private Socket connection;%0A    private InputStream in;%0A    private OutputStream out;%0A    private InThread inputThread;%0A%0A    public Client(Socket connection, String name)%7B%0A        this.connection = connection;%0A        this.name = name;%0A        %0A        try%7B%0A        %09in = connection.getInputStream();%0A    %09%09out = connection.getOutputStream();%0A        %09%0A        %09AppGameContainer container = new AppGameContainer(new Application(%22SpaceDefence%22));%0A            container.setDisplayMode(WIDTH, HEIGHT, false);%0A            container.setTargetFrameRate(FPS);%0A            container.setShowFPS(true);%0A            container.start();%0A            %0A%09%09%7D catch (SlickException e)%7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D catch(IOException ioe)%7B%0A%09%09%09ioe.printStackTrace();%0A%09%09%7D%0A    %7D%0A    %0A%0A    public void writeMessage(byte%5B%5D msg)%7B%0A        try%7B%0A            Writer writer;%0A            writer = new OutputStreamWriter(connection.getOutputStream()); %0A            writer.write(msg.toString(), 0, msg.length);%0A            writer.flush();%0A        %7Dcatch(IOException ioe)%7Bioe.printStackTrace();%7D%0A    %7D%0A
 %7D%0A

remove unused code