diff --git a/Sources/KinectUtils/AllGesturesFactory.cs b/Sources/KinectUtils/AllGesturesFactory.cs index 7ef77ae..719a15e 100644 --- a/Sources/KinectUtils/AllGesturesFactory.cs +++ b/Sources/KinectUtils/AllGesturesFactory.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using MyGesturesBank; namespace KinectUtils { @@ -12,7 +13,9 @@ namespace KinectUtils { return new List { - new PostureHandsOnHead() + new SwipeRightHand(), + new ClapHands() + // Ajoutez d'autres gestes ici }; } } diff --git a/Sources/KinectUtils/GestureManager.cs b/Sources/KinectUtils/GestureManager.cs index 8d703c9..cece5c1 100644 --- a/Sources/KinectUtils/GestureManager.cs +++ b/Sources/KinectUtils/GestureManager.cs @@ -9,7 +9,7 @@ using Microsoft.Kinect; namespace KinectUtils { - static class GestureManager + public static class GestureManager { static private BodyFrameReader bodyFrameReader; static private Body[] bodies; @@ -17,24 +17,31 @@ namespace KinectUtils static KinectManager KinectManager { get; set; } static List KnownGestures { get; set; } - static public void AddGestures(IGestureFactory factory) + public static void AddGestures(IGestureFactory factory) { - KnownGestures = (List)factory.CreateGestures(); + var gestures = factory.CreateGestures(); + foreach (var gesture in gestures) + { + AddGesture(gesture); + } } - static public void AddGestures(params BaseGesture[] gestures) + public static void AddGesture(BaseGesture gesture) { - foreach (var gesture in gestures) + if (!KnownGestures.Contains(gesture)) { - if (!gestures.Contains(gesture)) - { - KnownGestures.Add(gesture); - } + KnownGestures.Add(gesture); + gesture.GestureRecognized += (sender, e) => GestureRecognized?.Invoke(sender, e); } } - static public void RemoveGesture(BaseGesture gesture) + public static void RemoveGesture(BaseGesture gesture) { - KnownGestures.Remove(gesture); + if (KnownGestures.Contains(gesture)) + { + KnownGestures.Remove(gesture); + gesture.GestureRecognized -= (sender, e) => GestureRecognized?.Invoke(sender, e); + } } + static public void StartAcquiringFrames(KinectManager kinectManager) { bodyFrameReader = kinectManager.Sensor.BodyFrameSource.OpenReader(); diff --git a/Sources/KinectUtils/KinectUtils.csproj b/Sources/KinectUtils/KinectUtils.csproj index c64f282..8343b15 100644 --- a/Sources/KinectUtils/KinectUtils.csproj +++ b/Sources/KinectUtils/KinectUtils.csproj @@ -52,6 +52,10 @@ + + {2496dfb1-eb55-47a1-a780-211e079b289d} + MyGesturesBank + {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/LibMyGesturesBank/MyGesturesBank.csproj b/Sources/LibMyGesturesBank/MyGesturesBank.csproj index aedd2ed..0601293 100644 --- a/Sources/LibMyGesturesBank/MyGesturesBank.csproj +++ b/Sources/LibMyGesturesBank/MyGesturesBank.csproj @@ -47,12 +47,11 @@ + + + - - {2d44487e-f514-4063-9494-2af1e8c9e9c8} - KinectUtils - {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/LibMyGesturesBank/RightHandUp.cs b/Sources/LibMyGesturesBank/RightHandUp.cs new file mode 100644 index 0000000..1c6734a --- /dev/null +++ b/Sources/LibMyGesturesBank/RightHandUp.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyGesturesBank +{ + internal class RightHandUp + { + } +} diff --git a/Sources/LibMyGesturesBank/SwipeRightHand.cs b/Sources/LibMyGesturesBank/SwipeRightHand.cs new file mode 100644 index 0000000..d58ddd0 --- /dev/null +++ b/Sources/LibMyGesturesBank/SwipeRightHand.cs @@ -0,0 +1,38 @@ +using KinectUtils; +using Microsoft.Kinect; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyGesturesBank +{ + public class SwipeRightHand : Gesture + { + protected override bool TestInitialConditions(Body body) + { + // Implémentez la logique pour vérifier les conditions initiales du balayage à droite + return false; + } + + protected override bool TestPosture(Body body) + { + // Implémentez la vérification de la posture pour le balayage à droite + return false; + } + + protected override bool TestRunningGesture(Body body) + { + // Implémentez la dynamique du geste de balayage à droite + return false; + } + + protected override bool TestEndConditions(Body body) + { + // Vérifiez si les conditions de fin du geste de balayage à droite sont remplies + return false; + } + } + +} diff --git a/Sources/LibMyGesturesBank/TwoHandsDragon.cs b/Sources/LibMyGesturesBank/TwoHandsDragon.cs new file mode 100644 index 0000000..6cafd63 --- /dev/null +++ b/Sources/LibMyGesturesBank/TwoHandsDragon.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyGesturesBank +{ + internal class TwoHandsDragon + { + } +}