Переглянути джерело

Correct NullPointerExceptions

jost_vincent.schultz 11 роки тому
батько
коміт
631c1c87d9
1 змінених файлів з 5 додано та 6 видалено
  1. 5 6
      bbiwarg/VideoHandle.cs

+ 5 - 6
bbiwarg/VideoHandle.cs

@@ -58,7 +58,7 @@ namespace bbiwarg
 
         private TouchEventVisualizer touchEventVisualizer;
 
-        private int videoFrame = 0;
+        private int videoFrame = 1;
 
         public VideoHandle(IInputProvider inputProvider)
         {
@@ -68,13 +68,12 @@ namespace bbiwarg
         public void start()
         {
             palmDetector = new PalmDetector();
+            server = new TuioServer("127.0.0.1", 3333);
 
             inputProvider.init();
             inputProvider.start();
             inputProvider.updateFrame();
             processFrameUpdate();
-
-            server = new TuioServer("127.0.0.1", 3333);
         }
 
         public void stop()
@@ -127,7 +126,7 @@ namespace bbiwarg
         {
             Timer.start("processFrameUpdate");
 
-            if (CurrentFrame == 0) {
+            if (CurrentFrame == 1) {
                 //initialize trackers
                 touchTracker = new TouchTracker();
                 fingerTracker = new FingerTracker();
@@ -191,7 +190,7 @@ namespace bbiwarg
 
             //detect palm
             Timer.start("palmDetection");
-            if (CurrentFrame == 0)
+            if (CurrentFrame == 1)
                 palmDetector.reset();
             palmDetector.findPalmQuad(OutputImages[3], handDetector.Hands);
             Timer.stop("palmDetection");
@@ -233,7 +232,7 @@ namespace bbiwarg
             // touch event visualizer
             if (touchEventVisualizer == null)
                 touchEventVisualizer = new TouchEventVisualizer(Width, Height);
-            if (CurrentFrame == 0)
+            if (CurrentFrame == 1)
                 touchEventVisualizer.Reset();
             if (palmTouchDetector != null)
             {