Пример #1
0
 public void UpdatePlot(SensorData sd)
 {
     int x, y;
     if (sd.touched[0])
     {
         x = (int)sd.f0[0] / 100;
         y = (int)sd.f0[1] / 100;
         v[x,y] = sd.f0[2];
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            WebClient  webClient = new WebClient();
            string     IPaddress = webClient.DownloadString("http://transgame.csail.mit.edu:9537/?varname=jedeyeserver");
            TcpClient  client    = new TcpClient(IPaddress, 1101);
            TextReader reader    = new StreamReader(client.GetStream());
            DrawClass  dc        = new DrawClass();

            while (true)
            {
                string data = reader.ReadLine();
                //Console.WriteLine(data);
                SensorData sensor = Newtonsoft.Json.JsonConvert.DeserializeObject <SensorData>(data);
                dc.HandleSensorData(sensor);
                Console.WriteLine(dc.state);
                //dc.UpdatePlot(sensor);
                //Console.WriteLine(dc.ToString());
                //Console.WriteLine(sensor);
            }
        }
Пример #3
0
 public void HandleSensorData(SensorData sd)
 {
     State origState = state;
     dataSinceStateStart = dataSinceStateStart.EnqueueRight(sd);
     ChangeState(sd.FingerCount(), sd.Distance());
     if (origState != state)
     {
         // state changed! Send off the vanish event for the previous gesture, and a appear event for the current gesture
         gestures.Enqueue(new Gesture(origState, EventType.VANISH, stateEntryTime, dataSinceStateStart));
         stateEntryTime = DateTime.Now;
         dataSinceStateStart = Deque<SensorData>.Empty;
         dataSinceStateStart = dataSinceStateStart.EnqueueRight(sd);
         gestures.Enqueue(new Gesture(state, EventType.APPEAR, stateEntryTime, dataSinceStateStart));
     }
     else
     {
         // continuation of the existing gesture
         gestures.Enqueue(new Gesture(state, EventType.MOVE, stateEntryTime, dataSinceStateStart));
     }
 }
Пример #4
0
 public void HandleSensorData(SensorData sd)
 {
     ChangeState(sd.FingerCount(), sd.Distance());
 }
Пример #5
0
 public void HandleSensorData(SensorData sd)
 {
     ChangeState(sd.FingerCount(), sd.Distance());
 }