Remove some system outs

This commit is contained in:
jancoow
2015-06-19 10:25:44 +02:00
parent 2ed5ceeaba
commit d86d4dc62e
8 changed files with 12 additions and 56 deletions
-2
View File
@@ -32,13 +32,11 @@ public class GameControl implements JoystickListener, ButtonListener, ActionList
@Override
public void buttonPressed(ButtonEvent e) {
// System.out.println("Game control, button pressed: "+e.getButton().getButtonID());
gsm.buttonPressed(e);
}
@Override
public void buttonReleased(ButtonEvent e) {
// System.out.println("Game control, button released: "+e.getButton().getButtonID());
gsm.buttonReleased(e);
}
+11 -27
View File
@@ -14,7 +14,6 @@ import control.joystick.JoystickHandler;
public class NetworkHandler implements Runnable{
DatagramSocket udp;
DatagramSocket udpsend;
String host;
int port;
@@ -28,8 +27,6 @@ public class NetworkHandler implements Runnable{
ButtonHandler bth;
JoystickHandler jth;
InetAddress adr;
public NetworkHandler(String host, int port, ButtonHandler bth, JoystickHandler jth)
{
this.host = host;
@@ -43,19 +40,8 @@ public class NetworkHandler implements Runnable{
send = new byte[1024];
receive = new byte[1024];
try {
adr = InetAddress.getByName("192.168.1.5");
} catch (UnknownHostException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// try {
// udp = new DatagramSocket(1112);
// } catch (SocketException e) {
// e.printStackTrace();
// }
try {
udpsend = new DatagramSocket();
try {
udp = new DatagramSocket(1113);
} catch (SocketException e) {
e.printStackTrace();
}
@@ -78,12 +64,7 @@ public class NetworkHandler implements Runnable{
private void send(String str)
{
send = str.getBytes();
try {
udpsend.send(new DatagramPacket(send, send.length, adr, port));
} catch (IOException e) {
e.printStackTrace();
}
}
public void close()
@@ -100,19 +81,19 @@ public class NetworkHandler implements Runnable{
{
DatagramPacket receivePacket = new DatagramPacket(receive, receive.length);
try {
udpsend.receive(receivePacket);
udp.receive(receivePacket);
} catch (IOException e) {
e.printStackTrace();
}
String sentence = new String( receivePacket.getData());
sentence = sentence.trim();
String[] controls = sentence.split("\\|");
int[] control = new int[controls.length];
for(int i=0; i<controls.length; i++){
for(int i=0; i<controls.length; i++)
control[i] = Integer.parseInt(controls[i]);
}
for(int i = 0; i < 7; i++){
if(control[i] != ButtonHandler.getButton(i).pressed)
{
@@ -178,6 +159,9 @@ public class NetworkHandler implements Runnable{
JoystickHandler.j.setPosition(Position.DOWN);
jth.onJoystickMoved(JoystickHandler.j);
}
}else {
JoystickHandler.j.setPosition(Position.CENTER);
}
}