3
0

InputChannelGestureSwipe.h 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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/GestureRecognizerSwipe.h>
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////
  12. namespace Gestures
  13. {
  14. ////////////////////////////////////////////////////////////////////////////////////////////////
  15. //! Input channel that recognizes discrete click or tap gestures.
  16. class InputChannelGestureSwipe : public InputChannelGesture
  17. , public RecognizerSwipe
  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, "{507A8F2C-2FC0-4923-80EB-79D52828CBF8}", 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(InputChannelGestureSwipe, AZ::SystemAllocator);
  43. ////////////////////////////////////////////////////////////////////////////////////////////
  44. // Type Info
  45. AZ_RTTI(InputChannelGestureSwipe, "{AFBD665B-8101-4183-8506-FEAFBDB8766B}", 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 InputChannelGestureSwipe(const AzFramework::InputChannelId& inputChannelId,
  52. const AzFramework::InputDevice& inputDevice,
  53. const Config& config);
  54. ////////////////////////////////////////////////////////////////////////////////////////////
  55. // Disable copying
  56. AZ_DISABLE_COPY_MOVE(InputChannelGestureSwipe);
  57. ////////////////////////////////////////////////////////////////////////////////////////////
  58. //! Destructor
  59. ~InputChannelGestureSwipe() 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::RecognizerDiscrete::OnDiscreteGestureRecognized
  69. void OnDiscreteGestureRecognized() override;
  70. };
  71. } // namespace Gestures