}
byte signal = Signal.getSignal(data);
data = Signal.getData(data);
if (signal == Signal.SPRITE) {
SpriteSet o = null;
try {
o = (SpriteSet) Signal.toObject(data);
} catch (IOException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
if (o != null)
buffer.add(o);
Common.info(1,"new SpriteSet :"+o.get(0).getFileName());
}
if (signal == Signal.SCREEN) {
synchronized (screen)
{
screen.clear();
// Common.info(7,"parsing screen"+data.length);
//int N = 5;
int N = 4;
int dimE=2;
for (int i = 0; i < (int) (data.length / (N*2)); i++) {
/*
byte[] z = new byte[N + 1];
z[0] = (int)data[0 + i * N];
z[1] = (int)data[1 + i * N];
z[2] = (int)data[2 + i * N];
z[3] = (int)data[3 + i * N];
z[4] = data[4 + i * N];
z[5] = 0;
*//*
short[] z = new short[N + 1];
z[0] = (short)pezzi[0 + i * N];
z[1] = (short)pezzi[1 + i * N];
z[2] = (short)pezzi[2 + i * N];
z[3] = (short)pezzi[3 + i * N];
/*z[4] = data[4 + i * N];
z[5] = 0;
*/
// int[] dati = Signal.from6ByteTo5Int(z);
/*int x = dati[0];
int y = dati[1];
int t = dati[2];
int d = dati[3];
float theta = t / 100f;*/
/*
int x=(int)z[0];
int y=(int)z[1];
int t=(int)z[2];
int d=(int)z[3];*/
int x=(int) Signal.from2ByteTo1Short(data[0 + i * N*2],data[0 + i * N*2 +1]);
int y=(int) Signal.from2ByteTo1Short(data[1*2 + i * N*2 ],data[1*2 + i * N*2 + 1]);
int t=(int) Signal.from2ByteTo1Short(data[2*2 + i * N*2 ],data[2*2 + i * N*2 + 1]);
int d=(int) Signal.from2ByteTo1Short(data[3*2 + i * N*2 ],data[3*2 + i * N*2 + 1]);/*
Common.info(1,"sending: "+x+" "+y+" "+d+" "+t);
Common.info(1," d=" +Signal.from2ByteTo1Short(data[1*2 + i * N*2 ],data[1*2 + i * N*2 + 1])+" ; "
+Signal.from2ByteTo1Short(data[1*2 + i * N*2 +1],data[1*2 + i * N*2 ])+" ;"+d);
Common.info(1," t=" +Signal.from2ByteTo1Short(data[3*2 + i * N *2],data[3*2 + i * N*2 + 1])+" ; "
+Signal.from2ByteTo1Short(data[3*2 + i * N*2 +1],data[3*2 + i * N*2 ])+" ;"+t);
Common.info(1,"sending: "+x+":["+data[0 + i * 2*N]+" "+data[1 + i *2* N]+"]"
+y+":["+data[2 + i *2* N]+" "+data[3 + i *2* N]+"]"
+t+":["+data[4 + i *2* N]+" "+data[5 + i *2* N]+"]"
+d+":["+data[6 + i *2* N]+" "+data[7 + i *2* N]+"]"
);
*/
/* Common.info(1," s=" +Signal.from2ByteTo1Short((byte)0x01,(byte)0x00)+" ; "
+Signal.from2ByteTo1Short((byte)0x00,(byte)0x01)+" ; "
+Signal.from2ByteTo1Short((byte)0x01,(byte)0x01));*/
float theta = t / 1000f;
// int d = dati[4];
// float t= ((byte)data[6+i*7]*255)*3.14f;
// Common.info(7,"x="+x+" y="+y+" t="+t+" d="+d+" theta+"+theta);
// Common.info(7,"x="+x+"y="+y+"w="+w+"h="+h+"d="+d);
// if(w==0 && h==0 && x==0 && y==0 && d==0)
// i=data.length;else
// {
ShownElement e;
SpriteSet thisSS;
if (d < buffer.size()) {
// e = new ShownElement(new
// Rectangle(x,y,w,h),buffer.get(d),0f);
thisSS = buffer.get(d);
// e = new ShownElement(new Point(x,y),,theta);
} else {
// Common.info(7,"received a block with no sprite! :( "+d);
thisSS = new SpriteSet();
}
e = new ShownElement(new Point(x, y), thisSS, theta);
screen.add(e);
// }