GesturesSystemComponent.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include <AzCore/std/smart_ptr/unique_ptr.h>
  11. #include "InputDeviceGestures.h"
  12. #include "InputChannelGestureClickOrTap.h"
  13. #include "InputChannelGestureDrag.h"
  14. #include "InputChannelGestureHold.h"
  15. #include "InputChannelGesturePinch.h"
  16. #include "InputChannelGestureRotate.h"
  17. #include "InputChannelGestureSwipe.h"
  18. ////////////////////////////////////////////////////////////////////////////////////////////////////
  19. namespace Gestures
  20. {
  21. ////////////////////////////////////////////////////////////////////////////////////////////////
  22. class GesturesSystemComponent : public AZ::Component
  23. {
  24. public:
  25. ////////////////////////////////////////////////////////////////////////////////////////////
  26. // AZ::Component Setup
  27. AZ_COMPONENT(GesturesSystemComponent, "{18F55947-9ED4-483D-A3AB-86B848350AF5}");
  28. ////////////////////////////////////////////////////////////////////////////////////////////
  29. // AZ::ComponentDescriptor Services
  30. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  31. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  32. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  33. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  34. ////////////////////////////////////////////////////////////////////////////////////////////
  35. //! \ref AZ::ComponentDescriptor::Reflect
  36. static void Reflect(AZ::ReflectContext* context);
  37. ////////////////////////////////////////////////////////////////////////////////////////////
  38. //! Constructor
  39. GesturesSystemComponent();
  40. GesturesSystemComponent(const GesturesSystemComponent&) = delete;
  41. public:
  42. ////////////////////////////////////////////////////////////////////////////////////////////
  43. //! Destructor
  44. ~GesturesSystemComponent() override;
  45. ////////////////////////////////////////////////////////////////////////////////////////////
  46. //! \ref AZ::Component::Init
  47. void Init() override;
  48. ////////////////////////////////////////////////////////////////////////////////////////////
  49. //! \ref AZ::Component::Activate
  50. void Activate() override;
  51. ////////////////////////////////////////////////////////////////////////////////////////////
  52. //! \ref AZ::Component::Deactivate
  53. void Deactivate() override;
  54. private:
  55. ////////////////////////////////////////////////////////////////////////////////////////////
  56. ///@{
  57. //! The config used to create a default gesture input channel
  58. InputChannelGestureClickOrTap::TypeAndConfig m_doublePressConfig;
  59. InputChannelGestureDrag::TypeAndConfig m_dragConfig;
  60. InputChannelGestureHold::TypeAndConfig m_holdConfig;
  61. InputChannelGesturePinch::TypeAndConfig m_pinchConfig;
  62. InputChannelGestureRotate::TypeAndConfig m_rotateConfig;
  63. InputChannelGestureSwipe::TypeAndConfig m_swipeConfig;
  64. ///@}
  65. ////////////////////////////////////////////////////////////////////////////////////////////
  66. //! A map of custom gesture name/config pairs that will be used to create additional gesture
  67. //! input channels, in addition to the default gestures that are provided "out of the box".
  68. InputDeviceGestures::ConfigsByNameMap m_customGestureConfigsByName;
  69. ////////////////////////////////////////////////////////////////////////////////////////////
  70. //! Unique pointer to the gestures device
  71. AZStd::unique_ptr<InputDeviceGestures> m_gesturesDevice;
  72. };
  73. } // namespace Gestures