public override TypingStatus ProcessNewFrame(Point3D cursor, ICollection<TypingGesture> gestures, Microsoft.Kinect.Skeleton stableSkeleton, double deltaTimeMilliseconds, TypingDexterity dexterity) { double columnData = cursor.X; double rowData = cursor.Y; double constraintData = cursor.Z; if (cursor.IsFrozen) { columnData = cursor.FrozenX; rowData = cursor.FrozenY; constraintData = cursor.FrozenZ; } if (columnData < 0 || rowData < 0) return new TypingStatus(); double stepX = 1.0 / layoutCols; double stepY = 1.0 / layoutRows; int col = (int)(columnData / stepX); int row = (int)(rowData / stepY); TypingStatus status = new TypingStatus(); status.HighlightedKey = layout[row * layoutCols + col]; if (gestures != null && gestures.Count > 0 && gestures.ElementAt(0).Type == GestureType.Tap) { TypingGesture gesture = gestures.ElementAt(0); col = (int)(gesture.Position.X / stepX); row = (int)(gesture.Position.Y / stepY); status.SelectedKey = layout[row * layoutCols + col]; } return status; }
public override TypingStatus ProcessNewFrame(Point3D cursor, ICollection<TypingGesture> gestures, Microsoft.Kinect.Skeleton stableSkeleton, double deltaTimeMilliseconds, TypingDexterity dexterity) { double columnData = cursor.X; double rowData = cursor.Y; double constraintData = cursor.Z; if (columnData < 0 || rowData < 0) return new TypingStatus(); double stepX = 1.0 / layoutCols; double stepY = 1.0 / layoutRows; int col = (int)(columnData / stepX); int row = (int)(rowData / stepY); currentPointingIndex = row * layoutCols + col; TypingStatus status = new TypingStatus(); if (currentSequenceIndex == 36) { return status; } if (layout[currentPointingIndex] == sequence[currentSequenceIndex]) { status.HighlightedKey = layout[currentPointingIndex]; if (currentSequenceIndex < sequence.Length) { currentSequenceIndex++; if (!started) started = true; else correctCount++; } } else { if (currentPointingIndex != previousPointingIndex) { if (started) { errorCount++; } } } if (gestures != null && gestures.Count > 0 && gestures.ElementAt(0).Type == GestureType.Tap) { TypingGesture gesture = gestures.ElementAt(0); col = (int)(gesture.Position.X / stepX); row = (int)(gesture.Position.Y / stepY); currentPointingIndex = row * layoutCols + col; status.SelectedKey = layout[currentPointingIndex]; } previousPointingIndex = currentPointingIndex; return status; }