InputChannelGestureDrag.h 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 "InputChannelGesture.h"
  10. #include <Gestures/GestureRecognizerDrag.h>
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////
  12. namespace Gestures
  13. {
  14. ////////////////////////////////////////////////////////////////////////////////////////////////
  15. //! Input channel that recognizes continuous drag gestures.
  16. class InputChannelGestureDrag : public InputChannelGesture
  17. , public RecognizerDrag
  18. {
  19. public:
  20. ////////////////////////////////////////////////////////////////////////////////////////////
  21. //! The gesture configuration values that are exposed to the editor.
  22. struct TypeAndConfig : public Type, public Config
  23. {
  24. public:
  25. ////////////////////////////////////////////////////////////////////////////////////////
  26. // Allocator
  27. AZ_CLASS_ALLOCATOR(TypeAndConfig, AZ::SystemAllocator);
  28. ////////////////////////////////////////////////////////////////////////////////////////
  29. // Type Info
  30. AZ_RTTI(TypeAndConfig, "{E62A1944-F7AC-435E-9EC3-3F0B4BCB93F0}", Type, Config);
  31. ////////////////////////////////////////////////////////////////////////////////////////
  32. // Reflection
  33. static void Reflect(AZ::ReflectContext* context);
  34. protected:
  35. ////////////////////////////////////////////////////////////////////////////////////////
  36. //! \ref Gestures::InputChannelGesture::CreateInputChannel
  37. InputChannelGesture* CreateInputChannel(const AzFramework::InputChannelId& channelId,
  38. const AzFramework::InputDevice& inputDevice) override;
  39. };
  40. ////////////////////////////////////////////////////////////////////////////////////////////
  41. // Allocator
  42. AZ_CLASS_ALLOCATOR(InputChannelGestureDrag, AZ::SystemAllocator);
  43. ////////////////////////////////////////////////////////////////////////////////////////////
  44. // Type Info
  45. AZ_RTTI(InputChannelGestureDrag, "{A860D040-5931-4232-915E-7B41E747853F}", InputChannel);
  46. ////////////////////////////////////////////////////////////////////////////////////////////
  47. //! Constructor
  48. //! \param[in] inputChannelId Id of the input channel being constructed
  49. //! \param[in] inputDevice Input device that owns the input channel
  50. //! \param[in] config The configuration used to setup the gesture recognizer base class
  51. explicit InputChannelGestureDrag(const AzFramework::InputChannelId& inputChannelId,
  52. const AzFramework::InputDevice& inputDevice,
  53. const Config& config);
  54. ////////////////////////////////////////////////////////////////////////////////////////////
  55. // Disable copying
  56. AZ_DISABLE_COPY_MOVE(InputChannelGestureDrag);
  57. ////////////////////////////////////////////////////////////////////////////////////////////
  58. //! Destructor
  59. ~InputChannelGestureDrag() override;
  60. protected:
  61. ////////////////////////////////////////////////////////////////////////////////////////////
  62. //! \ref AzFramework::InputChannel::GetValue
  63. float GetValue() const override;
  64. ////////////////////////////////////////////////////////////////////////////////////////////
  65. //! \ref AzFramework::InputChannel::GetCustomData
  66. const InputChannel::CustomData* GetCustomData() const override;
  67. ////////////////////////////////////////////////////////////////////////////////////////////
  68. //! \ref Gestures::RecognizerContinuous::OnContinuousGestureInitiated
  69. void OnContinuousGestureInitiated() override;
  70. ////////////////////////////////////////////////////////////////////////////////////////////
  71. //! \ref Gestures::RecognizerContinuous::OnContinuousGestureUpdated
  72. void OnContinuousGestureUpdated() override;
  73. ////////////////////////////////////////////////////////////////////////////////////////////
  74. //! \ref Gestures::RecognizerContinuous::OnContinuousGestureEnded
  75. void OnContinuousGestureEnded() override;
  76. };
  77. } // namespace Gestures